diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-06-07 14:22:24 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-06-23 18:58:28 +0300 |
commit | 0ace7df8390afe16e42162d97463b04511d6783b (patch) | |
tree | c57a1e29d059da52e2e2fe250bfcb196a19422ef /editor | |
parent | c50413ea557f9eae44d5d171171036f6b81892ff (diff) |
Open end is now handled.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_tests/ui2oh_test.cpp | 17 | ||||
-rw-r--r-- | editor/ui2oh.cpp | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/editor/editor_tests/ui2oh_test.cpp b/editor/editor_tests/ui2oh_test.cpp index f11d75d63f..7d58ae87b1 100644 --- a/editor/editor_tests/ui2oh_test.cpp +++ b/editor/editor_tests/ui2oh_test.cpp @@ -309,6 +309,23 @@ UNIT_TEST(OpeningHours2TimeTableSet_off) } } +UNIT_TEST(OpeningHours2TimeTableSet_plus) +{ + OpeningHours oh("Mo-Su 11:00+"); + TEST(oh.IsValid(), ()); + + TimeTableSet tts; + + TEST(MakeTimeTableSet(oh, tts), ()); + TEST_EQUAL(tts.Size(), 1, ()); + + auto const tt = tts.Get(0); + TEST_EQUAL(tts.GetUnhandledDays(), TOpeningDays(), ()); + + TEST_EQUAL(tt.GetOpeningTime().GetStart().GetHourMinutes().GetHoursCount(), 11, ()); + TEST_EQUAL(tt.GetOpeningTime().GetEnd().GetHourMinutes().GetHoursCount(), 24, ()); +} + UNIT_TEST(TimeTableSt2OpeningHours) { { diff --git a/editor/ui2oh.cpp b/editor/ui2oh.cpp index 19e0abfd79..d7f3b317f9 100644 --- a/editor/ui2oh.cpp +++ b/editor/ui2oh.cpp @@ -42,6 +42,10 @@ void SetUpTimeTable(osmoh::TTimespans spans, editor::ui::TimeTable & tt) { using namespace osmoh; + // Expand plus: 13:15+ -> 13:15-24:00. + for (auto & span : spans) + span.ExpandPlus(); + sort(begin(spans), end(spans), [](Timespan const & a, Timespan const & b) { auto const start1 = a.GetStart().GetHourMinutes().GetDuration(); |