From 74f6704fefb4e50b4a7e7e8bd98cae37af63933b Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 15 Mar 2024 20:01:43 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F:=20Fix=20empty=20rooms=20?= =?UTF-8?q?and=20usless=20classes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/Service/ClassesScraperService.php | 12 ++++++++++++ backend/src/Service/TimetableService.php | 1 + 2 files changed, 13 insertions(+) diff --git a/backend/src/Service/ClassesScraperService.php b/backend/src/Service/ClassesScraperService.php index 9ae65af..6dfb1b4 100644 --- a/backend/src/Service/ClassesScraperService.php +++ b/backend/src/Service/ClassesScraperService.php @@ -35,6 +35,18 @@ public function scrapeClasses(): array $classes[] = $classGroup; }); + return $this->removeUslessClasses($classes); + } + + private function removeUslessClasses(array $classes): array + { + $uselessClasses = ['TSST -', 'CPI2 Groupe 3 INT', 'CQPM -']; + foreach ($classes as $key => $class) { + if (in_array($class->getName(), $uselessClasses)) { + unset($classes[$key]); + } + } + return $classes; } } diff --git a/backend/src/Service/TimetableService.php b/backend/src/Service/TimetableService.php index cbf41db..adbc0ac 100644 --- a/backend/src/Service/TimetableService.php +++ b/backend/src/Service/TimetableService.php @@ -66,6 +66,7 @@ public function parseData(array $parsedData): array $creneaux = $this->defineCreneaux(); $weeks = []; + foreach ($parsedData['GROUPE']['PLAGES']['SEMAINE'] as $week) { $weekSchedule = new WeekSchedule(); $weekSchedule->setId($week['SemId']);