avoid doubles

This commit is contained in:
HB9HIL
2024-05-10 14:04:18 +02:00
parent 226d1cd783
commit 88c6edf14f

View File

@@ -182,8 +182,20 @@ class Contestcalendar extends CI_Controller {
$contestsNextWeekend[] = $contest;
}
if ($start <= $nextSunday && $end >= $nextFriday) {
$contestExists = false;
foreach ($contestsNextWeekend as $existingContest) {
if ($existingContest['title'] === $contest['title']) {
$contestExists = true;
break;
}
}
if (!$contestExists) {
$contestsNextWeekend[] = $contest;
$contestsNextWeekend[] = $contest;
$contestsNextWeekend[] = $contest;
}
}
}
return $contestsNextWeekend;