From ff9ab2b751343bdd8e5d1aa55d4c637c4b51ed96 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 9 Jul 2021 10:26:31 +0200 Subject: [PATCH] Fix abs methods --- app/scodoc/sco_abs.py | 12 +-- app/scodoc/sco_abs_views.py | 78 +------------- app/scodoc/sco_formsemestre_status.py | 11 +- app/scodoc/sco_groups_view.py | 2 +- app/scodoc/sco_utils.py | 2 +- app/views/absences.py | 148 ++++++++++++++++++++++---- 6 files changed, 148 insertions(+), 105 deletions(-) diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index d4d016733..74043f9bb 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -145,7 +145,7 @@ class ddmmyyyy: "iso8601 representation of the date" return "%04d-%02d-%02d" % (self.year, self.month, self.day) - def next(self, days=1): + def next_day(self, days=1): "date for the next day (nota: may be a non workable day)" day = self.day + days month = self.month @@ -179,7 +179,7 @@ class ddmmyyyy: def next_monday(self): "date of next monday" - return self.next((7 - self.weekday) % 7) + return self.next_day((7 - self.weekday) % 7) def prev_monday(self): "date of last monday, but on sunday, pick next monday" @@ -213,7 +213,7 @@ def DateRangeISO(context, date_beg, date_end, workable=1): while cur <= end: if (not workable) or cur.iswork(): r.append(cur) - cur = cur.next() + cur = cur.next_day() return map(lambda x: x.ISO(), r) @@ -231,7 +231,7 @@ def day_names(context): def next_iso_day(context, date): "return date after date" d = ddmmyyyy(date, fmt="iso", work_saturday=is_work_saturday(context)) - return d.next().ISO() + return d.next_day().ISO() def YearTable( @@ -860,7 +860,7 @@ def MonthTableBody( cc.append("") cell = string.join(cc, "") if day == "D": - monday = monday.next(7) + monday = monday.next_day(7) if ( weeknum == current_weeknum and current_year == year @@ -894,7 +894,7 @@ def MonthTableBody( weeknum += " currentweek" if day == "D": - monday = monday.next(7) + monday = monday.next_day(7) T.append( '%d%s' % (bgcolor, weekclass, attrs, d, day) diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index e42aa9c06..41f5ec444 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -737,7 +737,9 @@ def CalAbs(context, REQUEST=None): # etud implied datedebut = str(anneescolaire) + "-08-31" datefin = str(anneescolaire + 1) + "-07-31" nbabs = sco_abs.CountAbs(context, etudid=etudid, debut=datedebut, fin=datefin) - nbabsjust = sco_abs.CountAbsJust(context, etudid=etudid, debut=datedebut, fin=datefin) + nbabsjust = sco_abs.CountAbsJust( + context, etudid=etudid, debut=datedebut, fin=datefin + ) events = [] for a in sco_abs.ListeAbsJust(context, etudid=etudid, datedebut=datedebut): events.append( @@ -1042,77 +1044,3 @@ def _TablesAbsEtud( columns_ids.append("justlink") return titles, columns_ids, absnonjust, absjust - - -def index_html(context, REQUEST=None): - """Gestionnaire absences, page principale""" - # crude portage from 1999 DTML - sems = sco_formsemestre.do_formsemestre_list(context) - authuser = REQUEST.AUTHENTICATED_USER - - H = [ - html_sco_header.sco_header( - context, - REQUEST, - page_title="Gestion des absences", - cssstyles=["css/calabs.css"], - javascripts=["js/calabs.js"], - ), - """

Gestion des Absences

""", - ] - if not sems: - H.append( - """

Aucun semestre défini (ou aucun groupe d'étudiant)

""" - ) - else: - H.append( - """