Opened 6 years ago

Last modified 5 years ago

#18577 closed enhancement

[Patch] Update opening_hours.js — at Version 1

Reported by: simon04 Owned by: simon04
Priority: normal Milestone: 20.02
Component: Core validator Version:
Keywords: opening_hours Cc: ypid23

Description (last modified by simon04)

opening_hours.js has gotten many improvements since its last release on 2017-02-18: https://github.com/opening-hours/opening_hours.js/compare/v3.5.0...master
In particular a rather heavy external library could be removed via https://github.com/opening-hours/opening_hours.js/pull/250
When also excluding the country holiday data via https://github.com/opening-hours/opening_hours.js/pull/314, one can build a opening_hours+deps.min.js bundle with only 170KB whereas data/validator/opening_hours.js now has 316KB.

There are the few necessary modifications within JOSM: attachment:18577.patch

Two JOSM tests fail with the new version, however:

java.lang.AssertionError: 
Expected :isEmpty()
Actual   :<[service_times - Mo-Fr 00:00-00:30,04:00-00:30; Sa,Su,PH 00:00-24:00 <--- (This rule overwrites parts of the previous rule. This happens because normal rules apply to the whole day and overwrite any definition made by previous rules. You can make this rule an additional rule by using a "," instead of the normal ";" to separate the rules. Note that the overwriting can also be desirable in which case you can ignore this warning.) => Mo-Fr 00:00-00:30,04:00-00:30; Sa,Su,PH 00:00-24:00]>

	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.openstreetmap.josm.data.validation.tests.OpeningHourTestTest.testCheckServiceTimeSyntax1(OpeningHourTestTest.java:190)
	at org.openstreetmap.josm.testutils.JOSMTestRules$CreateJosmEnvironment.evaluate(JOSMTestRules.java:670)
java.lang.AssertionError: opening_hours=sunset-sunrise open; sunrise-sunset closed is valid

Expected :isEmpty()
Actual   :<[opening_hours - sunset-sunrise open; sunrise-sunset closed <--- (This rule overwrites parts of the previous rule. This happens because normal rules apply to the whole day and overwrite any definition made by previous rules. You can make this rule an additional rule by using a "," instead of the normal ";" to separate the rules. Note that the overwriting can also be desirable in which case you can ignore this warning.) => sunset-sunrise open; sunrise-sunset closed]>

	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.openstreetmap.josm.data.validation.tests.OpeningHourTestTest.testPresetValues(OpeningHourTestTest.java:235)
	at org.openstreetmap.josm.testutils.JOSMTestRules$CreateJosmEnvironment.evaluate(JOSMTestRules.java:670)

Change History (2)

by simon04, 6 years ago

Attachment: 18577.patch added

comment:1 by simon04, 6 years ago

Description: modified (diff)
Summary: Update opening_hours.js[Patch] Update opening_hours.js
Note: See TracTickets for help on using tickets.