From 3097208ce64ded8798ab808fcef44bb91babf83e Mon Sep 17 00:00:00 2001 From: ViniRafaelVale Date: Fri, 7 Aug 2026 15:23:07 -0300 Subject: [PATCH] fix: torna o filtro de semestres dinamico --- app/Services/Tools.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Services/Tools.php b/app/Services/Tools.php index 4d1a372..9a55bf4 100644 --- a/app/Services/Tools.php +++ b/app/Services/Tools.php @@ -109,7 +109,20 @@ public static function iniFim($semestreIni, $semestreFim) */ public static function semestres() { - $semestres = ['20261', '20252', '20251', '20242', '20241', '20232', '20231', '20222', '20221', '20212', '20211', '20202', '20201', '20192', '20191', '20182', '20181']; - return $semestres; + $anoAtual = (int) date('Y'); + $mesAtual = (int) date('n'); + + $semestres = []; + $anoInicial = 2018; + + for ($ano = $anoInicial; $ano <= $anoAtual; $ano++) { + $semestres[] = $ano . '1'; + + if ($ano < $anoAtual || $mesAtual > 6) { + $semestres[] = $ano . '2'; + } + } + + return array_reverse($semestres); } }