Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oh
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
oh
Commits
f75b01f1
Commit
f75b01f1
authored
2 years ago
by
dpi
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3323047
by dpi: Review sidebar infinite loop
parent
40e3ec92
Branches
Branches containing commit
Tags
3.1.0-beta2
Tags containing commit
1 merge request
!6
Issue #3323047: Review sidebar infinite loop
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/oh_review/oh_review.module
+4
-4
4 additions, 4 deletions
modules/oh_review/oh_review.module
modules/oh_review/src/OhReviewUtility.php
+8
-7
8 additions, 7 deletions
modules/oh_review/src/OhReviewUtility.php
with
12 additions
and
11 deletions
modules/oh_review/oh_review.module
+
4
−
4
View file @
f75b01f1
...
...
@@ -85,7 +85,7 @@ function template_preprocess_oh_review_occurrences_list(array &$variables): void
ksort
(
$days
);
$startOfWeek
=
(
new
\DateTime
())
->
setISODate
(
...
explode
(
'-'
,
$weekCode
))
->
setISODate
(
...
array_map
(
'intval'
,
explode
(
'-'
,
$weekCode
))
)
->
setTime
(
0
,
0
,
0
,
0
);
$week
=
[
'days'
=>
[],
...
...
@@ -110,10 +110,10 @@ function template_preprocess_oh_review_occurrences_list(array &$variables): void
foreach
(
$occurrences
as
$occurrence
)
{
$dayInfo
[
'times'
][]
=
[
'attributes'
=>
(
new
Attribute
())
->
addClass
(
$occurrence
->
isOpen
()
?
'is-open'
:
'is-closed'
),
'start'
=>
$occurrence
->
getStart
()
->
format
(
$timeFormat
),
'end'
=>
$occurrence
->
getEnd
()
->
format
(
$timeFormat
),
'start'
=>
$occurrence
->
period
()
->
getStart
Date
()
->
format
(
$timeFormat
),
'end'
=>
$occurrence
->
period
()
->
getEnd
Date
()
->
format
(
$timeFormat
),
'is_open'
=>
$occurrence
->
isOpen
(),
'is_full_day'
=>
$isFullDay
(
$occurrence
->
getStart
(),
$occurrence
->
getEnd
()),
'is_full_day'
=>
$isFullDay
(
$occurrence
->
period
()
->
getStart
Date
(),
$occurrence
->
period
()
->
getEnd
Date
()),
'message'
=>
implode
(
','
,
$occurrence
->
getMessages
()),
];
$open
=
(
$open
or
$occurrence
->
isOpen
());
...
...
This diff is collapsed.
Click to expand it.
modules/oh_review/src/OhReviewUtility.php
+
8
−
7
View file @
f75b01f1
...
...
@@ -29,25 +29,26 @@ final class OhReviewUtility {
$weekFormat
=
'o-W'
;
$dayFormat
=
'Y-m-d'
;
/** @var array<string, \Drupal\oh\OhOccurrence[]> $occurrencesByDay */
$occurrencesByDay
=
[];
if
(
$fillDays
)
{
// Fill in the days.
$fillPointer
=
$range
->
getStart
();
$fillEnd
=
$range
->
getEnd
();
$fillEnd
->
modify
(
'-1 second'
);
$fillPointer
=
$range
->
period
()
->
getStart
Date
();
$fillEnd
=
$range
->
period
()
->
getEnd
Date
();
$fillEnd
=
$fillEnd
->
modify
(
'-1 second'
);
while
(
$fillPointer
<
$fillEnd
)
{
$pointerDay
=
$fillPointer
->
format
(
$dayFormat
);
if
(
!
isset
(
$occurrencesByDay
[
$pointerDay
]))
{
$occurrencesByDay
[
$pointerDay
]
=
[];
}
$fillPointer
->
modify
(
'+1 day'
);
$fillPointer
=
$fillPointer
->
modify
(
'+1 day'
);
}
}
uasort
(
$occurrences
,
[
OhOccurrence
::
class
,
'sort'
]);
foreach
(
$occurrences
as
$occurrence
)
{
$day
=
$occurrence
->
getStart
()
->
format
(
$dayFormat
);
$day
=
$occurrence
->
period
()
->
getStart
Date
()
->
format
(
$dayFormat
);
$occurrencesByDay
[
$day
][]
=
$occurrence
;
}
...
...
@@ -61,8 +62,8 @@ final class OhReviewUtility {
$groupedByWeek
[
$week
][
$dayCode
]
=
$groupedByWeek
[
$week
][
$dayCode
]
??
[];
}
foreach
(
$occurrences
as
$occurrence
)
{
$week
=
$occurrence
->
getStart
()
->
format
(
$weekFormat
);
$day
=
$occurrence
->
getStart
()
->
format
(
$dayFormat
);
$week
=
$occurrence
->
period
()
->
getStart
Date
()
->
format
(
$weekFormat
);
$day
=
$occurrence
->
period
()
->
getStart
Date
()
->
format
(
$dayFormat
);
$groupedByWeek
[
$week
][
$day
][]
=
$occurrence
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment