Publidata / opening_hours_converter

OpenStreetMap Opening Hours to Date & Date to Opening Hours
https://rubygems.org/gems/opening_hours_converter
GNU Affero General Public License v3.0
12 stars 3 forks source link

Failing test. #13

Closed berkes closed 5 years ago

berkes commented 5 years ago

Test rspec ./spec/opening_hours_builder_spec.rb:463 fails.

expected: "2017 Dec 15-2018 Jan 15 00:00-03:00,10:00-24:00"
     got: "2017 Dec 15-2018 Jan 15 Mo 10:00-24:00; 2017 Dec 15-2018 Jan 15 Tu 00:00-03:00"

It looks like this test has never worked, according to git-bisect the first commit where this started failing, is the commit where it was introduced.

I'm not familiar enough with opening_hours_rule.rb yet to understand where the decision to place a ; or a , is made.

According to the specs, both are similar, just different in presentation. The first, however, is cleaner, but means the same as the last. So if it is enough to simply rewrite the test, I can do that.

Mziserman commented 5 years ago

You are right it never worked. I kept it to remind myself to correct this. The interpreter on http://openingh.openstreetmap.de/evaluation_tool/?EXP=2017%20Dec%2015-2018%20Jan%2015%2000%3A00-03%3A00%2C10%3A00-24%3A00&lat=48.7769&lon=9.1844&mode=0&DATE=1514648520000&diff_value=2017%20Dec%2015-2018%20Jan%2015%20Mo%2010%3A00-24%3A00%3B%202017%20Dec%2015-2018%20Jan%2015%20Tu%2000%3A00-03%3A00 is actually wrong, those two are not similar : "2017 Dec 15-2018 Jan 15 00:00-03:00,10:00-24:00" gives image

while "2017 Dec 15-2018 Jan 15 Mo 10:00-24:00; 2017 Dec 15-2018 Jan 15 Tu 00:00-03:00" gives image

So it's not just esthetical. I'll try to fix this tonight but from memories it's a pretty difficult problem to solve. I'll keep you up to date.

Mziserman commented 5 years ago

actually @berkes it was easier than I thought, https://github.com/Publidata/opening_hours_converter/pull/14 fix it.

There was a problem with intervals starting with a weekday higher than the end day (from sunday to monday in the spec).

Mziserman commented 5 years ago

I released a new version with the fix (1.7.19) feel free to reopen.