From 87e098f8a5a34cf65f95db71a6bd661743b8ce71 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 20 May 2018 12:21:35 +0300 Subject: [PATCH] Fix #5231 --- .../src/net/osmand/util/OpeningHoursParser.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java index 8aa2ab90ea..2ea9d4f5f1 100644 --- a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java +++ b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java @@ -1790,10 +1790,12 @@ public class OpeningHoursParser { } } String basicRuleComment = null; - for (BasicOpeningHourRule bRule : basicRules) { - if (!Algorithms.isEmpty(bRule.getComment())) { - basicRuleComment = bRule.getComment(); - break; + if (sequences.size() > 1) { + for (BasicOpeningHourRule bRule : basicRules) { + if (!Algorithms.isEmpty(bRule.getComment())) { + basicRuleComment = bRule.getComment(); + break; + } } } if (!Algorithms.isEmpty(basicRuleComment)) { @@ -2231,5 +2233,9 @@ public class OpeningHoursParser { testInfo("16.02.2018 14:00", hours, "Will close at 15:00"); testInfo("16.02.2018 16:00", hours, "Will open at 17:00"); testInfo("16.02.2018 18:00", hours, "Open till 23:00"); + + hours = parseOpenedHours("Mo-Fr 10:00-21:00; Sa 12:00-23:00; PH \"Wird auf der Homepage bekannt gegeben.\""); + testParsedAndAssembledCorrectly("Mo-Fr 10:00-21:00; Sa 12:00-23:00; PH - Wird auf der Homepage bekannt gegeben.", hours); + System.out.println(hours); } }