From 88c6edf14fcd89f9cbcf5fa1aa2181ebeaadb2f9 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 10 May 2024 14:04:18 +0200 Subject: [PATCH] avoid doubles --- application/controllers/Contestcalendar.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/application/controllers/Contestcalendar.php b/application/controllers/Contestcalendar.php index bed46615b..f3f22290c 100644 --- a/application/controllers/Contestcalendar.php +++ b/application/controllers/Contestcalendar.php @@ -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;