Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KOpeningHours
Commits
b96e0800
Commit
b96e0800
authored
Mar 19, 2021
by
David Faure
Browse files
Generalize time-only-autocorrect to work with ',' as well.
parent
ba4e0c48
Pipeline
#54915
passed with stage
in 18 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
autotests/parsertest.cpp
View file @
b96e0800
...
...
@@ -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"
);
...
...
src/lib/openinghours.cpp
View file @
b96e0800
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment