fixed bug when generating shows for calendar.
This commit is contained in:
parent
909e37934f
commit
2ff9765fdf
|
@ -540,17 +540,22 @@ class Show {
|
|||
$newDate = $row["first_show"];
|
||||
}
|
||||
|
||||
$shows[] = $this->makeFullCalendarEvent($row, $newDate);
|
||||
|
||||
$new_epoch = strtotime($newDate);
|
||||
$end_epoch = strtotime($end);
|
||||
|
||||
if(!is_null($row["last_show"])) {
|
||||
$show_end_epoch = strtotime($row["last_show"]);
|
||||
}
|
||||
|
||||
if(isset($show_end_epoch) && $show_end_epoch <= $new_epoch) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$shows[] = $this->makeFullCalendarEvent($row, $newDate);
|
||||
|
||||
//add repeating events until the show end is reached or fullcalendar's end date is reached.
|
||||
if($row["repeats"]) {
|
||||
|
||||
if(!is_null($row["last_show"])) {
|
||||
$show_end_epoch = strtotime($row["last_show"]);
|
||||
}
|
||||
|
||||
while(true) {
|
||||
|
||||
$diff = "SELECT date '{$newDate}' + integer '7'";
|
||||
|
@ -562,7 +567,7 @@ class Show {
|
|||
$shows[] = $this->makeFullCalendarEvent($row, $repeatDate);
|
||||
}
|
||||
//case for non-ending shows.
|
||||
else if(!isset($show_end_epoch) && $repeat_epoch < $end_epoch) {
|
||||
else if(is_null($show_end_epoch) && $repeat_epoch < $end_epoch) {
|
||||
$shows[] = $this->makeFullCalendarEvent($row, $repeatDate);
|
||||
}
|
||||
else {
|
||||
|
@ -571,7 +576,9 @@ class Show {
|
|||
|
||||
$newDate = $repeatDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($show_end_epoch);
|
||||
}
|
||||
|
||||
return $shows;
|
||||
|
|
Loading…
Reference in New Issue