forked from ScoDoc/DocScoDoc
essaie de tolérer codes modules nulls (en principe non autorisé)
This commit is contained in:
parent
5ca4eed0cc
commit
3b8f28bbb3
@ -79,7 +79,7 @@ class ModuleImpl(db.Model):
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
"""as a dict, with the same conversions as in ScoDoc7"""
|
||||
"""as a dict, with the same conversions as in ScoDoc7, including module"""
|
||||
e = dict(self.__dict__)
|
||||
e.pop("_sa_instance_state", None)
|
||||
# ScoDoc7 output_formators: (backward compat)
|
||||
|
@ -479,7 +479,7 @@ def _get_abs_description(a, cursor=None):
|
||||
)
|
||||
if Mlist:
|
||||
M = Mlist[0]
|
||||
module += "%s " % M["module"]["code"]
|
||||
module += "%s " % (M["module"]["code"] or "(module sans code)")
|
||||
|
||||
if desc:
|
||||
return "(%s) %s" % (desc, module)
|
||||
|
@ -127,7 +127,9 @@ def doSignaleAbsence(
|
||||
modimpls = nt.get_modimpls_dict(ue_id=ue["ue_id"])
|
||||
for modimpl in modimpls:
|
||||
if modimpl["moduleimpl_id"] == moduleimpl_id:
|
||||
indication_module = "dans le module %s" % modimpl["module"]["code"]
|
||||
indication_module = "dans le module %s" % (
|
||||
modimpl["module"]["code"] or "(pas de code)"
|
||||
)
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=f"Signalement d'une absence pour {etud.nomprenom}",
|
||||
@ -218,7 +220,7 @@ def SignaleAbsenceEtud(): # etudid implied
|
||||
"""<option value="%(modimpl_id)s">%(modname)s</option>\n"""
|
||||
% {
|
||||
"modimpl_id": modimpl["moduleimpl_id"],
|
||||
"modname": modimpl["module"]["code"],
|
||||
"modname": modimpl["module"]["code"] or "",
|
||||
}
|
||||
)
|
||||
menu_module += """</select></p>"""
|
||||
@ -964,10 +966,10 @@ def _tables_abs_etud(
|
||||
ex.append(
|
||||
f"""<a href="{url_for('notes.moduleimpl_status',
|
||||
scodoc_dept=g.scodoc_dept, moduleimpl_id=mod["moduleimpl_id"])}
|
||||
">{mod["module"]["code"]}</a>"""
|
||||
">{mod["module"]["code"] or "(module sans code)"}</a>"""
|
||||
)
|
||||
else:
|
||||
ex.append(mod["module"]["code"])
|
||||
ex.append(mod["module"]["code"] or "(module sans code)")
|
||||
if ex:
|
||||
return ", ".join(ex)
|
||||
return ""
|
||||
@ -982,10 +984,10 @@ def _tables_abs_etud(
|
||||
ex.append(
|
||||
f"""<a href="{url_for('notes.moduleimpl_status',
|
||||
scodoc_dept=g.scodoc_dept, moduleimpl_id=mod["moduleimpl_id"])}
|
||||
">{mod["module"]["code"]}</a>"""
|
||||
">{mod["module"]["code"] or '(module sans code)'}</a>"""
|
||||
)
|
||||
else:
|
||||
ex.append(mod["module"]["code"])
|
||||
ex.append(mod["module"]["code"] or "(module sans code)")
|
||||
if ex:
|
||||
return ", ".join(ex)
|
||||
return ""
|
||||
|
@ -514,7 +514,7 @@ def _ue_mod_bulletin(etudid, formsemestre_id, ue_id, modimpls, nt, version):
|
||||
)
|
||||
if sco_preferences.get_preference("bul_show_codemodules", formsemestre_id):
|
||||
mod["code"] = modimpl["module"]["code"]
|
||||
mod["code_html"] = link_mod + mod["code"] + "</a>"
|
||||
mod["code_html"] = link_mod + (mod["code"] or "") + "</a>"
|
||||
else:
|
||||
mod["code"] = mod["code_html"] = ""
|
||||
mod["name"] = (
|
||||
@ -532,7 +532,7 @@ def _ue_mod_bulletin(etudid, formsemestre_id, ue_id, modimpls, nt, version):
|
||||
% (modimpl["moduleimpl_id"], mod_descr)
|
||||
)
|
||||
if sco_preferences.get_preference("bul_show_codemodules", formsemestre_id):
|
||||
mod["code_txt"] = modimpl["module"]["code"]
|
||||
mod["code_txt"] = modimpl["module"]["code"] or ""
|
||||
mod["code_html"] = link_mod + mod["code_txt"] + "</a>"
|
||||
else:
|
||||
mod["code_txt"] = ""
|
||||
|
@ -476,8 +476,8 @@ def _bulletin_pdf_table_legacy(I, version="long"):
|
||||
else:
|
||||
rang_minmax = mod["mod_rang_txt"] # vide si pas option rang
|
||||
t = [
|
||||
mod["code"],
|
||||
mod["name"],
|
||||
mod["code"] or "",
|
||||
mod["name"] or "",
|
||||
rang_minmax,
|
||||
mod["mod_moy_txt"],
|
||||
mod["mod_coef_txt"],
|
||||
|
@ -252,7 +252,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
x_mod = Element(
|
||||
"module",
|
||||
id=str(modimpl["moduleimpl_id"]),
|
||||
code=str(mod["code"]),
|
||||
code=str(mod["code"] or ""),
|
||||
coefficient=str(mod["coefficient"]),
|
||||
numero=str(mod["numero"]),
|
||||
titre=scu.quote_xml_attr(mod["titre"]),
|
||||
|
@ -65,7 +65,7 @@ def formsemestre_table_estim_cost(
|
||||
Mod = M["module"]
|
||||
T.append(
|
||||
{
|
||||
"code": Mod["code"],
|
||||
"code": Mod["code"] or "",
|
||||
"titre": Mod["titre"],
|
||||
"heures_cours": Mod["heures_cours"],
|
||||
"heures_td": Mod["heures_td"] * n_group_td,
|
||||
|
@ -237,7 +237,11 @@ def formsemestre_check_absences_html(formsemestre_id):
|
||||
if evals:
|
||||
H.append(
|
||||
'<div class="module_check_absences"><h2><a href="moduleimpl_status?moduleimpl_id=%s">%s: %s</a></h2>'
|
||||
% (M["moduleimpl_id"], M["module"]["code"], M["module"]["abbrev"])
|
||||
% (
|
||||
M["moduleimpl_id"],
|
||||
M["module"]["code"] or "",
|
||||
M["module"]["abbrev"] or "",
|
||||
)
|
||||
)
|
||||
for E in evals:
|
||||
H.append(
|
||||
|
@ -122,7 +122,7 @@ def evaluation_create_form(
|
||||
#
|
||||
mod_descr = '<a href="moduleimpl_status?moduleimpl_id=%s">%s %s</a> %s' % (
|
||||
moduleimpl_id,
|
||||
mod["code"],
|
||||
mod["code"] or "module sans code",
|
||||
mod["titre"],
|
||||
link,
|
||||
)
|
||||
|
@ -637,7 +637,14 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
|
||||
)
|
||||
mod_descr = (
|
||||
'<a href="moduleimpl_status?moduleimpl_id=%s">%s %s</a> <span class="resp">(resp. <a title="%s">%s</a>)</span> %s'
|
||||
% (moduleimpl_id, Mod["code"], Mod["titre"], nomcomplet, resp, link)
|
||||
% (
|
||||
moduleimpl_id,
|
||||
Mod["code"] or "",
|
||||
Mod["titre"] or "?",
|
||||
nomcomplet,
|
||||
resp,
|
||||
link,
|
||||
)
|
||||
)
|
||||
|
||||
etit = E["description"] or ""
|
||||
|
@ -601,7 +601,7 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
"input_type": "text_suggest",
|
||||
"size": 50,
|
||||
"withcheckbox": True,
|
||||
"title": "%s %s" % (mod["code"], mod["titre"]),
|
||||
"title": "%s %s" % (mod["code"] or "", mod["titre"] or ""),
|
||||
"allowed_values": allowed_user_names,
|
||||
"template": itemtemplate,
|
||||
"text_suggest_options": {
|
||||
@ -802,7 +802,9 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
}
|
||||
moduleimpl_id = sco_moduleimpl.do_moduleimpl_create(modargs)
|
||||
mod = sco_edit_module.module_list({"module_id": module_id})[0]
|
||||
msg += ["création de %s (%s)" % (mod["code"], mod["titre"])]
|
||||
msg += [
|
||||
"création de %s (%s)" % (mod["code"] or "?", mod["titre"] or "?")
|
||||
]
|
||||
# INSCRIPTIONS DES ETUDIANTS
|
||||
log(
|
||||
'inscription module: %s = "%s"'
|
||||
@ -824,7 +826,7 @@ def do_formsemestre_createwithmodules(edit=False):
|
||||
)
|
||||
msg += [
|
||||
"inscription de %d étudiants au module %s"
|
||||
% (len(etudids), mod["code"])
|
||||
% (len(etudids), mod["code"] or "(module sans code)")
|
||||
]
|
||||
else:
|
||||
log(
|
||||
@ -919,11 +921,19 @@ def formsemestre_delete_moduleimpls(formsemestre_id, module_ids_to_del):
|
||||
if evals:
|
||||
msg += [
|
||||
'<b>impossible de supprimer %s (%s) car il y a %d évaluations définies (<a href="moduleimpl_status?moduleimpl_id=%s" class="stdlink">supprimer les d\'abord</a>)</b>'
|
||||
% (mod["code"], mod["titre"], len(evals), moduleimpl_id)
|
||||
% (
|
||||
mod["code"] or "(module sans code)",
|
||||
mod["titre"],
|
||||
len(evals),
|
||||
moduleimpl_id,
|
||||
)
|
||||
]
|
||||
ok = False
|
||||
else:
|
||||
msg += ["suppression de %s (%s)" % (mod["code"], mod["titre"])]
|
||||
msg += [
|
||||
"suppression de %s (%s)"
|
||||
% (mod["code"] or "(module sans code)", mod["titre"] or "")
|
||||
]
|
||||
sco_moduleimpl.do_moduleimpl_delete(
|
||||
moduleimpl_id, formsemestre_id=formsemestre_id
|
||||
)
|
||||
|
@ -508,7 +508,7 @@ def formsemestre_inscription_option(etudid, formsemestre_id):
|
||||
modimpls_by_ue_ids[ue_id].append(mod["moduleimpl_id"])
|
||||
|
||||
modimpls_by_ue_names[ue_id].append(
|
||||
"%s %s" % (mod["module"]["code"], mod["module"]["titre"])
|
||||
"%s %s" % (mod["module"]["code"] or "", mod["module"]["titre"] or "")
|
||||
)
|
||||
vals = scu.get_request_args()
|
||||
if not vals.get("tf_submitted", False):
|
||||
@ -653,7 +653,7 @@ function chkbx_select(field_id, state) {
|
||||
"%s (%s)"
|
||||
% (
|
||||
modsdict[x]["module"]["titre"],
|
||||
modsdict[x]["module"]["code"],
|
||||
modsdict[x]["module"]["code"] or "(module sans code)",
|
||||
)
|
||||
for x in a_desinscrire
|
||||
]
|
||||
@ -672,7 +672,7 @@ function chkbx_select(field_id, state) {
|
||||
"%s (%s)"
|
||||
% (
|
||||
modsdict[x]["module"]["titre"],
|
||||
modsdict[x]["module"]["code"],
|
||||
modsdict[x]["module"]["code"] or "(module sans code)",
|
||||
)
|
||||
for x in a_inscrire
|
||||
]
|
||||
|
@ -638,7 +638,7 @@ def formsemestre_description_table(formsemestre_id, with_evals=False):
|
||||
)
|
||||
l = {
|
||||
"UE": M["ue"]["acronyme"],
|
||||
"Code": M["module"]["code"],
|
||||
"Code": M["module"]["code"] or "",
|
||||
"Module": M["module"]["abbrev"] or M["module"]["titre"],
|
||||
"_Module_class": "scotext",
|
||||
"Inscrits": len(ModInscrits),
|
||||
|
@ -92,7 +92,11 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
||||
"Appliquer les modifications".
|
||||
</p>
|
||||
"""
|
||||
% (moduleimpl_id, mod["titre"], mod["code"]),
|
||||
% (
|
||||
moduleimpl_id,
|
||||
mod["titre"] or "(module sans titre)",
|
||||
mod["code"] or "(module sans code)",
|
||||
),
|
||||
]
|
||||
# Liste des inscrits à ce semestre
|
||||
inscrits = sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(
|
||||
@ -308,8 +312,8 @@ def moduleimpl_inscriptions_stats(formsemestre_id):
|
||||
H.append(
|
||||
'<tr class="formsemestre_status"><td>%s</td><td class="formsemestre_status_code">%s</td><td class="formsemestre_status_inscrits">%s</td><td>%s</td></tr>'
|
||||
% (
|
||||
mod["ue"]["acronyme"],
|
||||
mod["module"]["code"],
|
||||
mod["ue"]["acronyme"] or "",
|
||||
mod["module"]["code"] or "(module sans code)",
|
||||
mod["nb_inscrits"],
|
||||
c_link,
|
||||
)
|
||||
@ -337,7 +341,11 @@ def moduleimpl_inscriptions_stats(formsemestre_id):
|
||||
c_link = mod["module"]["titre"]
|
||||
H.append(
|
||||
'<tr class="formsemestre_status_green"><td>%s</td><td class="formsemestre_status_code">%s</td><td>%s</td></tr>'
|
||||
% (mod["ue"]["acronyme"], mod["module"]["code"], c_link)
|
||||
% (
|
||||
mod["ue"]["acronyme"],
|
||||
mod["module"]["code"] or "(module sans code)",
|
||||
c_link,
|
||||
)
|
||||
)
|
||||
H.append("</table>")
|
||||
|
||||
|
@ -257,7 +257,7 @@ class PlacementRunner:
|
||||
self.moduleimpl_data["formsemestre_id"]
|
||||
)
|
||||
self.evalname = "%s-%s" % (
|
||||
self.module_data["code"],
|
||||
self.module_data["code"] or "?",
|
||||
ndb.DateDMYtoISO(self.eval_data["jour"]),
|
||||
)
|
||||
if self.eval_data["description"]:
|
||||
@ -266,7 +266,8 @@ class PlacementRunner:
|
||||
self.evaltitre = "évaluation du %s" % self.eval_data["jour"]
|
||||
self.desceval = [ # une liste de chaines: description de l'evaluation
|
||||
"%s" % self.sem["titreannee"],
|
||||
"Module : %s - %s" % (self.module_data["code"], self.module_data["abbrev"]),
|
||||
"Module : %s - %s"
|
||||
% (self.module_data["code"] or "?", self.module_data["abbrev"] or ""),
|
||||
"Surveillants : %s" % self.surveillants,
|
||||
"Batiment : %(batiment)s - Salle : %(salle)s" % self.__dict__,
|
||||
"Controle : %s (coef. %g)"
|
||||
|
@ -92,7 +92,7 @@ def etud_get_poursuite_info(sem, etud):
|
||||
for ue in ues: # on parcourt chaque UE
|
||||
for modimpl in modimpls: # dans chaque UE les modules
|
||||
if modimpl["module"]["ue_id"] == ue["ue_id"]:
|
||||
codeModule = modimpl["module"]["code"]
|
||||
codeModule = modimpl["module"]["code"] or ""
|
||||
noteModule = scu.fmt_note(
|
||||
nt.get_etud_mod_moy(modimpl["moduleimpl_id"], etudid)
|
||||
)
|
||||
|
@ -813,8 +813,8 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
||||
evaltitre = "évaluation du %s" % E["jour"]
|
||||
description = "%s en %s (%s) resp. %s" % (
|
||||
evaltitre,
|
||||
Mod["abbrev"],
|
||||
Mod["code"],
|
||||
Mod["abbrev"] or "",
|
||||
Mod["code"] or "",
|
||||
mod_responsable["prenomnom"],
|
||||
)
|
||||
|
||||
|
@ -443,8 +443,9 @@ def SignaleAbsenceGrHebdo(
|
||||
% {
|
||||
"modimpl_id": modimpl["moduleimpl_id"],
|
||||
"modname": modimpl["module"]["code"]
|
||||
or ""
|
||||
+ " "
|
||||
+ (modimpl["module"]["abbrev"] or modimpl["module"]["titre"]),
|
||||
+ (modimpl["module"]["abbrev"] or modimpl["module"]["titre"] or ""),
|
||||
"sel": sel,
|
||||
}
|
||||
)
|
||||
@ -611,6 +612,7 @@ def SignaleAbsenceGrSemestre(
|
||||
% {
|
||||
"modimpl_id": modimpl["moduleimpl_id"],
|
||||
"modname": modimpl["module"]["code"]
|
||||
or ""
|
||||
+ " "
|
||||
+ (modimpl["module"]["abbrev"] or modimpl["module"]["titre"]),
|
||||
"sel": sel,
|
||||
|
@ -1322,7 +1322,7 @@ def formsemestre_enseignants_list(formsemestre_id, format="html"):
|
||||
# description textuelle des modules
|
||||
for ens in sem_ens:
|
||||
sem_ens[ens]["descr_mods"] = ", ".join(
|
||||
[x["module"]["code"] for x in sem_ens[ens]["mods"]]
|
||||
[x["module"]["code"] or "?" for x in sem_ens[ens]["mods"]]
|
||||
)
|
||||
|
||||
# ajoute infos sur enseignant:
|
||||
|
Loading…
Reference in New Issue
Block a user