code cleaning

This commit is contained in:
Emmanuel Viennet 2022-10-04 21:55:43 +02:00
parent 77c0294c83
commit 678959c76a
3 changed files with 37 additions and 21 deletions

View File

@ -112,9 +112,9 @@ def doSignaleAbsence(
nbadded += 1 nbadded += 1
# #
if estjust: if estjust:
J = "" just_str = ""
else: else:
J = "NON " just_str = "NON "
indication_module = "" indication_module = ""
if moduleimpl_id and moduleimpl_id != "NULL": if moduleimpl_id and moduleimpl_id != "NULL":
mod = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0] mod = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0]
@ -137,31 +137,35 @@ def doSignaleAbsence(
] ]
if dates: if dates:
H.append( H.append(
"""<p>Ajout de %d absences <b>%sjustifiées</b> du %s au %s %s</p>""" f"""<p>Ajout de {nbadded} absences <b>{just_str}justifiées</b>
% (nbadded, J, datedebut, datefin, indication_module) du {datedebut} au {datefin} {indication_module}
</p>
"""
) )
else: else:
H.append( H.append(
"""<p class="warning">Aucune date ouvrable entre le %s et le %s !</p>""" f"""<p class="warning">Aucune date ouvrable
% (datedebut, datefin) entre le {datedebut} et le {datefin} !
</p>
"""
) )
H.append( H.append(
f"""<ul> f"""<ul>
<li><a href="{url_for("absences.SignaleAbsenceEtud", <li><a class="stdlink" href="{url_for("absences.SignaleAbsenceEtud",
scodoc_dept=g.scodoc_dept, etudid=etud.id scodoc_dept=g.scodoc_dept, etudid=etud.id
)}">Autre absence pour <b>{etud.nomprenom}</b></a> )}">Autre absence pour <b>{etud.nomprenom}</b></a>
</li> </li>
<li><a href="{url_for("absences.CalAbs", <li><a class="stdlink" href="{url_for("absences.CalAbs",
scodoc_dept=g.scodoc_dept, etudid=etud.id scodoc_dept=g.scodoc_dept, etudid=etud.id
)}">Calendrier de ses absences</a> )}">Calendrier de ses absences</a>
</li> </li>
</ul> </ul>
<hr> <hr>
{sco_find_etud.form_search_etud()}
{html_sco_header.sco_footer()}
""" """
) )
H.append(sco_find_etud.form_search_etud())
H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -1036,11 +1036,14 @@ def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display
t_nbabsam = 0 t_nbabsam = 0
t_nbabsjustpm = 0 t_nbabsjustpm = 0
t_nbabspm = 0 t_nbabspm = 0
H.append("<h2>État des absences le %s</h2>" % date) H.append(f"<h2>État des absences le {date}</h2>")
H.append( H.append(
"""<table border="0" cellspacing="4" cellpadding="0"> """<table border="0" cellspacing="4" cellpadding="0">
<tr><th>&nbsp;</th> <tr>
<th style="width: 10em;">Matin</th><th style="width: 10em;">Après-midi</th></tr> <th>&nbsp;</th>
<th style="width: 10em;">Matin</th>
<th style="width: 10em;">Après-midi</th>
</tr>
""" """
) )
for etud in groups_infos.members: for etud in groups_infos.members:
@ -1059,10 +1062,15 @@ def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display
etudid=etud["etudid"], debut=dateiso, fin=dateiso, matin=0 etudid=etud["etudid"], debut=dateiso, fin=dateiso, matin=0
) )
H.append( H.append(
"""<tr bgcolor="#FFFFFF"><td> f"""<tr bgcolor="#FFFFFF">
<a href="CalAbs?etudid=%(etudid)s"><font color="#A00000">%(nomprenom)s</font></a></td><td align="center">""" <td>
% etud <a href="{url_for("absences.CalAbs",
) # """ scodoc_dept=g.scodoc_dept, etudid=etud["etudid"])
}"><font color="#A00000">{etud["nomprenom"]}</font></a>
</td>
<td align="center">
"""
)
if nbabsam != 0: if nbabsam != 0:
if nbabsjustam: if nbabsjustam:
H.append("Just.") H.append("Just.")
@ -1084,10 +1092,14 @@ def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display
H.append("") H.append("")
H.append("</td></tr>") H.append("</td></tr>")
H.append( H.append(
"""<tr bgcolor="#FFFFFF"><td></td><td>%d abs, %d just.</td><td>%d abs, %d just.</td></tr>""" f"""<tr bgcolor="#FFFFFF">
% (t_nbabsam, t_nbabsjustam, t_nbabspm, t_nbabsjustpm) <td></td>
<td>{t_nbabsam} abs, {t_nbabsjustam} just.</td>
<td>{t_nbabspm} abs, {t_nbabsjustpm} just.</td>
</tr>
</table>
"""
) )
H.append("</table>")
if nbetud == 0: if nbetud == 0:
H.append("<p>Aucune absence !</p>") H.append("<p>Aucune absence !</p>")
else: else:

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.3.52" SCOVERSION = "9.3.53"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"