Skip to content
Snippets Groups Projects
Commit c2a4da64 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix Course::getDatesWithExDates() in the wake of the changes in #4758, re #4758

parent 04aedd8a
No related branches found
No related tags found
No related merge requests found
...@@ -234,7 +234,6 @@ class SimpleORMapCollection extends SimpleCollection ...@@ -234,7 +234,6 @@ class SimpleORMapCollection extends SimpleCollection
*/ */
public function merge(SimpleCollection $a_collection, string $mode = 'ignore') public function merge(SimpleCollection $a_collection, string $mode = 'ignore')
{ {
$mode = func_get_arg(1);
foreach ($a_collection as $element) { foreach ($a_collection as $element) {
try { try {
/** /**
......
...@@ -1906,17 +1906,25 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe ...@@ -1906,17 +1906,25 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
*/ */
public function getDatesWithExdates($range_begin = 0, $range_end = 0) public function getDatesWithExdates($range_begin = 0, $range_end = 0)
{ {
$dates = []; $dates = SimpleCollection::createFromArray([]);
if (($range_begin > 0) && ($range_end > 0) && ($range_end > $range_begin)) { if (
$ex_dates = $this->ex_dates->findBy('content', '', '<>') $range_begin > 0
->findBy('date', $range_begin, '>=') && $range_end > 0
->findBy('end_time', $range_end, '<='); && $range_end > $range_begin
$dates = $this->dates->findBy('date', $range_begin, '>=') ) {
->findBy('end_time', $range_end, '<='); $dates->merge(
$dates->merge($ex_dates); $this->dates->findBy('date', $range_begin, '>=')
->findBy('end_time', $range_end, '<=')
);
$dates->merge(
$this->ex_dates->findBy('content', '', '<>')
->findBy('date', $range_begin, '>=')
->findBy('end_time', $range_end, '<=')
);
} else { } else {
$dates = $this->ex_dates->findBy('content', '', '<>');
$dates->merge($this->dates); $dates->merge($this->dates);
$dates->merge($this->ex_dates->findBy('content', '', '<>'));
} }
$dates->uasort(function($a, $b) { $dates->uasort(function($a, $b) {
return $a->date - $b->date return $a->date - $b->date
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment