Opened 6 years ago
Closed 5 years ago
#17936 closed defect (fixed)
Validation of opening hours with PH and SH not possible
Reported by: | SlowMo24 | Owned by: | simon04 |
---|---|---|---|
Priority: | normal | Milestone: | 20.02 |
Component: | Core validator | Version: | |
Keywords: | opening_hours javascript SH/PH | Cc: | ypid23 |
Description (last modified by )
This is a follow up of #17932 . Fixing that error lead me to this one.
What steps will reproduce the problem?
- add tag 'opening_hours=PH off' to any object
- klick validate
What is the expected result?
Show a warning that this opening_hours-rule is useless.
What happens instead?
nothin in the gui but a ScriptException in the console.
Source of evil:
tl;dr -> opening_hours.js is outdated OR date of evaluation should be fixed
background:
The offical opening_hours.js (now index.js) from https://github.com/opening-hours/opening_hours.js has moved foreward quite a bit but no release has been made since v3.5.0 in feb. 2017. Therefore it is fair eignough for JOSM to stick with the old version.
But the testing of the PH and SH grammar requires opening_hours.js to know the dates of holydays in Bavaria (that is the testdummy). This should not be required (because it is only useful when displaying the result of the evaluation) but it does because JOSM does not use a customized opening_hours.js (there is no need but it might have advantages).
Now here is the point: The outdated opening_hours.js only provides holidays for Bavaria up until 2017. Therefore an error occusers when the test requests the dates for now()
(2019).
Possible solutions:
- add Public Holydays for Bavaria for the next years but this will only buy us time
better:
- inject a fixed date at wich the evaluation takes place to e.g. 2015
even better but problem of maintenance:
- reduce the unnecessary js-code (create a custom js) to only evaluate the grammar and not calculate the actual result so it does not need to know about SH
Disclaimer:
Although I have tried to investigate this issue as good as possible, I did not understand all code. Therefore the above information may be wrong. This is also why I cannot provide a coded solution, sorry.
PS: while we are at it, please autoformat opening_hours.js, it is unreadable in its current state.
Please provide any additional information below. Attach a screenshot if possible.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2019-07-10 00:52:47 +0200 (Wed, 10 Jul 2019) Revision:15238 Build-Date:2019-07-10 01:30:51 URL:https://josm.openstreetmap.de/svn/trunk Identification: JOSM/1.5 (15238 de) Linux Ubuntu 18.04.2 LTS Memory Usage: 449 MB / 4006 MB (200 MB allocated, but free) Java version: 11.0.3+7-Ubuntu-1ubuntu218.04.1, Oracle Corporation, OpenJDK 64-Bit Server VM Screen: :0.0 1920x1080, :0.1 1280x1024 Maximum Screen Size: 1920x1080 Java package: openjdk-11-jre:amd64-11.0.3+7-1ubuntu2~18.04.1 Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-20ubuntu0.1 libcommons-logging-java: libcommons-logging-java:all-1.2-2 fonts-noto: fonts-noto:- Dataset consistency test: No problems found Plugins: + FastDraw (34977) + OpeningHoursEditor (34977) + buildings_tools (34982) + pt_assistant (705) + wikipedia (v1.1.1) Map paint styles: + https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1 Last errors/warnings: - W: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - E: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - W: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - E: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - W: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - E: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - W: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - E: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - W: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined - E: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined
Attachments (1)
Change History (15)
comment:1 by , 6 years ago
Description: | modified (diff) |
---|
comment:3 by , 6 years ago
comment:4 by , 6 years ago
Ok, I have applied possible fix nr. 1 by adding dummy values for 2018-2021 which fixed the error for me (see attachment). But as mentioned, this will only buy us time.
comment:5 by , 6 years ago
interlinking issues: https://github.com/opening-hours/opening_hours.js/issues/86#issuecomment-513255975
comment:7 by , 5 years ago
Cc: | added |
---|
follow-up: 12 comment:10 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Upstream fix: https://github.com/opening-hours/opening_hours.js/pull/315
Will be fixed in the course of #18577.
comment:12 by , 5 years ago
Replying to simon04:
Upstream fix: https://github.com/opening-hours/opening_hours.js/pull/315
Will be fixed in the course of #18577.
So this ticket is fixed?
comment:14 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
typo