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
#
if estjust:
J = ""
just_str = ""
else:
J = "NON "
just_str = "NON "
indication_module = ""
if moduleimpl_id and moduleimpl_id != "NULL":
mod = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0]
@ -137,31 +137,35 @@ def doSignaleAbsence(
]
if dates:
H.append(
"""<p>Ajout de %d absences <b>%sjustifiées</b> du %s au %s %s</p>"""
% (nbadded, J, datedebut, datefin, indication_module)
f"""<p>Ajout de {nbadded} absences <b>{just_str}justifiées</b>
du {datedebut} au {datefin} {indication_module}
</p>
"""
)
else:
H.append(
"""<p class="warning">Aucune date ouvrable entre le %s et le %s !</p>"""
% (datedebut, datefin)
f"""<p class="warning">Aucune date ouvrable
entre le {datedebut} et le {datefin} !
</p>
"""
)
H.append(
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
)}">Autre absence pour <b>{etud.nomprenom}</b></a>
</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
)}">Calendrier de ses absences</a>
</li>
</ul>
<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)

View File

@ -1036,11 +1036,14 @@ def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display
t_nbabsam = 0
t_nbabsjustpm = 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(
"""<table border="0" cellspacing="4" cellpadding="0">
<tr><th>&nbsp;</th>
<th style="width: 10em;">Matin</th><th style="width: 10em;">Après-midi</th></tr>
<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:
@ -1059,10 +1062,15 @@ def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display
etudid=etud["etudid"], debut=dateiso, fin=dateiso, matin=0
)
H.append(
"""<tr bgcolor="#FFFFFF"><td>
<a href="CalAbs?etudid=%(etudid)s"><font color="#A00000">%(nomprenom)s</font></a></td><td align="center">"""
% etud
) # """
f"""<tr bgcolor="#FFFFFF">
<td>
<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 nbabsjustam:
H.append("Just.")
@ -1084,10 +1092,14 @@ def EtatAbsencesDate(group_ids=[], date=None): # list of groups to display
H.append("")
H.append("</td></tr>")
H.append(
"""<tr bgcolor="#FFFFFF"><td></td><td>%d abs, %d just.</td><td>%d abs, %d just.</td></tr>"""
% (t_nbabsam, t_nbabsjustam, t_nbabspm, t_nbabsjustpm)
f"""<tr bgcolor="#FFFFFF">
<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:
H.append("<p>Aucune absence !</p>")
else:

View File

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