Modify

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 SlowMo24)

This is a follow up of #17932 . Fixing that error lead me to this one.

What steps will reproduce the problem?

  1. add tag 'opening_hours=PH off' to any object
  2. 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)

new_opening_hours.js (513.3 KB ) - added by SlowMo24 6 years ago.
formatted and fixed opening_hours.js

Download all attachments as: .zip

Change History (15)

comment:1 by SlowMo24, 6 years ago

Description: modified (diff)

typo

comment:2 by Don-vip, 6 years ago

related: #8913 / #16767

comment:3 by SlowMo24, 6 years ago

@Don-vip: great catch! #16767 seems to be the outcome for the general user. Unforutnately the error meassges shown here are not present in #16767, maybe the user did not run 'validate' before the bug-report.

by SlowMo24, 6 years ago

Attachment: new_opening_hours.js added

formatted and fixed opening_hours.js

comment:4 by SlowMo24, 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.

Last edited 6 years ago by SlowMo24 (previous) (diff)

comment:6 by Don-vip, 5 years ago

Ticket #18149 has been marked as a duplicate of this ticket.

comment:7 by Don-vip, 5 years ago

Cc: ypid23 added

comment:8 by Don-vip, 5 years ago

Ticket #18208 has been marked as a duplicate of this ticket.

comment:9 by Don-vip, 5 years ago

Ticket #18281 has been marked as a duplicate of this ticket.

comment:10 by simon04, 5 years ago

Owner: changed from team to simon04
Status: newassigned

Upstream fix: https://github.com/opening-hours/opening_hours.js/pull/315

Will be fixed in the course of #18577.

Last edited 5 years ago by simon04 (previous) (diff)

comment:11 by simon04, 5 years ago

Ticket #18760 has been marked as a duplicate of this ticket.

in reply to:  10 comment:12 by Klumbumbus, 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:13 by Don-vip, 5 years ago

Milestone: 20.02

Looks like it.

comment:14 by Don-vip, 5 years ago

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain simon04.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.