Commit b96e0800 authored by David Faure's avatar David Faure
Browse files

Generalize time-only-autocorrect to work with ',' as well.

parent ba4e0c48
Pipeline #54915 passed with stage
in 18 seconds
......@@ -313,6 +313,8 @@ private Q_SLOTS:
T2("Mo-Sa 12:00-15:00; 18:00-24:00", "Mo-Sa 12:00-15:00,18:00-24:00");
T2("Mo-Sa 12:00-15:00; Mo-Sa 18:00-24:00", "Mo-Sa 12:00-15:00,18:00-24:00");
T2("Mo 12:00-15:00; Mo 18:00-24:00", "Mo 12:00-15:00,18:00-24:00");
T2("Mo-Sa 12:00-15:00, Mo-Sa 18:00-24:00", "Mo-Sa 12:00-15:00,18:00-24:00");
T2("Mo 12:00-15:00, Mo 18:00-24:00", "Mo 12:00-15:00,18:00-24:00");
// recovery from wrong time selector separators
T2("Dimanche Fermé Lundi 08:00 – 12:30 14:00 – 19:00 Mardi 08:00 – 12:30 14:00 – 19:00 Mercredi 08:00 – 12:30 14:00 – 19:00 Jeudi 08:00 – 12:30 14:00 – 19:00 Vendredi 08:00 – 12:30 14:00 – 19:00 Samedi 08:00 – 12:30 14:30 – 18:00", "Su closed; Mo 08:00-12:30,14:00-19:00; Tu 08:00-12:30,14:00-19:00; We 08:00-12:30,14:00-19:00; Th 08:00-12:30,14:00-19:00; Fr 08:00-12:30,14:00-19:00; Sa 08:00-12:30,14:30-18:00");
......
......@@ -101,10 +101,12 @@ void OpeningHoursPrivate::autocorrect()
appendSelector(prevRule->m_timeSelector.get(), std::move(rule->m_timeSelector));
it = std::prev(m_rules.erase(it));
}
}
if (rule->m_ruleType == Rule::AdditionalRule || rule->m_ruleType == Rule::NormalRule) {
// Both rules have exactly the same selector apart from time
// For now this only supports weekday selectors, could be extended
else if (rule->selectorCount() == prevRule->selectorCount()
if (rule->selectorCount() == prevRule->selectorCount()
&& rule->m_timeSelector
&& prevRule->m_timeSelector
&& rule->selectorCount() == 2 && rule->m_weekdaySelector && prevRule->m_weekdaySelector
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment