forked from ScoDoc/ScoDoc
Fix parcours DUT si étudiant désinscrit. Cosmetic/cleaning.
This commit is contained in:
parent
26b59ee547
commit
068b6a5c6a
@ -261,7 +261,7 @@ class ScoDocSiteConfig(db.Model):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_bul_pdf_disabled(cls) -> bool:
|
def is_bul_pdf_disabled(cls) -> bool:
|
||||||
"""True si on interdit les exports PDF des bulltins"""
|
"""True si on interdit les exports PDF des bulletins"""
|
||||||
cfg = ScoDocSiteConfig.query.filter_by(name="disable_bul_pdf").first()
|
cfg = ScoDocSiteConfig.query.filter_by(name="disable_bul_pdf").first()
|
||||||
return cfg is not None and cfg.value
|
return cfg is not None and cfg.value
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class DecisionSem(object):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
code_etat=None,
|
code_etat=None,
|
||||||
code_etat_ues={}, # { ue_id : code }
|
code_etat_ues: dict = None, # { ue_id : code }
|
||||||
new_code_prev="",
|
new_code_prev="",
|
||||||
explication="", # aide pour le jury
|
explication="", # aide pour le jury
|
||||||
formsemestre_id_utilise_pour_compenser=None, # None si code != ADC
|
formsemestre_id_utilise_pour_compenser=None, # None si code != ADC
|
||||||
@ -86,7 +86,7 @@ class DecisionSem(object):
|
|||||||
rule_id=None, # id regle correspondante
|
rule_id=None, # id regle correspondante
|
||||||
):
|
):
|
||||||
self.code_etat = code_etat
|
self.code_etat = code_etat
|
||||||
self.code_etat_ues = code_etat_ues
|
self.code_etat_ues = code_etat_ues or {}
|
||||||
self.new_code_prev = new_code_prev
|
self.new_code_prev = new_code_prev
|
||||||
self.explication = explication
|
self.explication = explication
|
||||||
self.formsemestre_id_utilise_pour_compenser = (
|
self.formsemestre_id_utilise_pour_compenser = (
|
||||||
@ -114,7 +114,6 @@ class DecisionSem(object):
|
|||||||
|
|
||||||
class SituationEtudCursus:
|
class SituationEtudCursus:
|
||||||
"Semestre dans un cursus"
|
"Semestre dans un cursus"
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class SituationEtudCursusClassic(SituationEtudCursus):
|
class SituationEtudCursusClassic(SituationEtudCursus):
|
||||||
@ -198,7 +197,7 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
fiduc = None
|
fiduc = None
|
||||||
# Detection d'incoherences (regles BUG)
|
# Detection d'incoherences (regles BUG)
|
||||||
if rule.conclusion[5] == BUG:
|
if rule.conclusion[5] == BUG:
|
||||||
log("get_possible_choices: inconsistency: state=%s" % str(state))
|
log(f"get_possible_choices: inconsistency: state={state}")
|
||||||
#
|
#
|
||||||
# valid_semestre = code_semestre_validant(rule.conclusion[0])
|
# valid_semestre = code_semestre_validant(rule.conclusion[0])
|
||||||
choices.append(
|
choices.append(
|
||||||
@ -224,9 +223,9 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
else:
|
else:
|
||||||
next_s = self._get_next_semestre_id()
|
next_s = self._get_next_semestre_id()
|
||||||
# log('s=%s next=%s' % (s, next_s))
|
# log('s=%s next=%s' % (s, next_s))
|
||||||
SA = self.parcours.SESSION_ABBRV # 'S' ou 'A'
|
sess_abrv = self.parcours.SESSION_ABBRV # 'S' ou 'A'
|
||||||
if self.semestre_non_terminal and not self.all_other_validated():
|
if self.semestre_non_terminal and not self.all_other_validated():
|
||||||
passage = "Passe en %s%s" % (SA, next_s)
|
passage = f"Passe en {sess_abrv}{next_s}"
|
||||||
else:
|
else:
|
||||||
passage = "Formation terminée"
|
passage = "Formation terminée"
|
||||||
if devenir == NEXT:
|
if devenir == NEXT:
|
||||||
@ -234,29 +233,23 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
elif devenir == REO:
|
elif devenir == REO:
|
||||||
return "Réorienté"
|
return "Réorienté"
|
||||||
elif devenir == REDOANNEE:
|
elif devenir == REDOANNEE:
|
||||||
return "Redouble année (recommence %s%s)" % (SA, (s_idx - 1))
|
return f"Redouble année (recommence {sess_abrv}{s_idx - 1})"
|
||||||
elif devenir == REDOSEM:
|
elif devenir == REDOSEM:
|
||||||
return "Redouble semestre (recommence en %s%s)" % (SA, s_idx)
|
return f"Redouble semestre (recommence en {sess_abrv}{s_idx})"
|
||||||
elif devenir == RA_OR_NEXT:
|
elif devenir == RA_OR_NEXT:
|
||||||
return passage + ", ou redouble année (en %s%s)" % (SA, (s_idx - 1))
|
return passage + ", ou redouble année (en {sess_abrv}{s_idx - 1})"
|
||||||
elif devenir == RA_OR_RS:
|
elif devenir == RA_OR_RS:
|
||||||
return "Redouble semestre %s%s, ou redouble année (en %s%s)" % (
|
return f"""Redouble semestre {sess_abrv}{s_idx}, ou redouble année (en {
|
||||||
SA,
|
sess_abrv}{s_idx - 1})"""
|
||||||
s_idx,
|
|
||||||
SA,
|
|
||||||
s_idx - 1,
|
|
||||||
)
|
|
||||||
elif devenir == RS_OR_NEXT:
|
elif devenir == RS_OR_NEXT:
|
||||||
return passage + ", ou semestre %s%s" % (SA, s_idx)
|
return f"{passage}, ou semestre {sess_abrv}{s_idx}"
|
||||||
elif devenir == NEXT_OR_NEXT2:
|
elif devenir == NEXT_OR_NEXT2:
|
||||||
return passage + ", ou en semestre %s%s" % (
|
# coherent avec get_next_semestre_ids
|
||||||
SA,
|
return f"{passage}, ou en semestre {sess_abrv}{s_idx + 2}"
|
||||||
s_idx + 2,
|
|
||||||
) # coherent avec get_next_semestre_ids
|
|
||||||
elif devenir == NEXT2:
|
elif devenir == NEXT2:
|
||||||
return "Passe en %s%s" % (SA, s_idx + 2)
|
return f"Passe en {sess_abrv}{s_idx + 2}"
|
||||||
else:
|
else:
|
||||||
log("explique_devenir: code devenir inconnu: %s" % devenir)
|
log(f"explique_devenir: code devenir inconnu: {devenir}")
|
||||||
return "Code devenir inconnu !"
|
return "Code devenir inconnu !"
|
||||||
|
|
||||||
def all_other_validated(self):
|
def all_other_validated(self):
|
||||||
@ -364,7 +357,7 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
l'étudiant (quelle que soit la formation), le plus ancien en tête"""
|
l'étudiant (quelle que soit la formation), le plus ancien en tête"""
|
||||||
return self.sems
|
return self.sems
|
||||||
|
|
||||||
def get_cursus_descr(self, filter_futur=False, filter_formation_code=False):
|
def get_cursus_descr(self, filter_futur=False, filter_formation_code=False) -> str:
|
||||||
"""Description brève du parcours: "S1, S2, ..."
|
"""Description brève du parcours: "S1, S2, ..."
|
||||||
Si filter_futur, ne mentionne pas les semestres qui sont après le semestre courant.
|
Si filter_futur, ne mentionne pas les semestres qui sont après le semestre courant.
|
||||||
Si filter_formation_code, restreint aux semestres de même code formation que le courant.
|
Si filter_formation_code, restreint aux semestres de même code formation que le courant.
|
||||||
@ -375,7 +368,7 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
for formsemestre in self.formsemestres:
|
for formsemestre in self.formsemestres:
|
||||||
inscription = formsemestre.etuds_inscriptions.get(self.etud.id)
|
inscription = formsemestre.etuds_inscriptions.get(self.etud.id)
|
||||||
if inscription is None:
|
if inscription is None:
|
||||||
raise ValueError("Etudiant non inscrit au semestre") # bug
|
return "non inscrit" # !!!
|
||||||
if inscription.etat == scu.DEMISSION:
|
if inscription.etat == scu.DEMISSION:
|
||||||
dem = " (dem.)"
|
dem = " (dem.)"
|
||||||
else:
|
else:
|
||||||
@ -461,7 +454,8 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
break
|
break
|
||||||
if not cur or cur.id != self.formsemestre_id:
|
if not cur or cur.id != self.formsemestre_id:
|
||||||
log(
|
log(
|
||||||
f"*** SituationEtudCursus: search_prev: cur not found (formsemestre_id={self.formsemestre_id}, etudid={self.etudid})"
|
f"""*** SituationEtudCursus: search_prev: cur not found (formsemestre_id={
|
||||||
|
self.formsemestre_id}, etudid={self.etudid})"""
|
||||||
)
|
)
|
||||||
return None # pas de semestre courant !!!
|
return None # pas de semestre courant !!!
|
||||||
# Cherche semestre antérieur de même formation (code) et semestre_id precedent
|
# Cherche semestre antérieur de même formation (code) et semestre_id precedent
|
||||||
@ -630,7 +624,8 @@ class SituationEtudCursusClassic(SituationEtudCursus):
|
|||||||
self.prev_formsemestre.id,
|
self.prev_formsemestre.id,
|
||||||
self.etudid,
|
self.etudid,
|
||||||
decision.new_code_prev,
|
decision.new_code_prev,
|
||||||
decision.assiduite, # attention: en toute rigueur il faudrait utiliser une indication de l'assiduite au sem. precedent, que nous n'avons pas...
|
decision.assiduite, # attention: en toute rigueur il faudrait utiliser
|
||||||
|
# une indication de l'assiduite au sem. precedent, que nous n'avons pas...
|
||||||
)
|
)
|
||||||
|
|
||||||
sco_cache.invalidate_formsemestre(
|
sco_cache.invalidate_formsemestre(
|
||||||
@ -760,14 +755,6 @@ class SituationEtudCursusECTS(SituationEtudCursusClassic):
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def int_or_null(s):
|
|
||||||
if s == "":
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
return int(s)
|
|
||||||
|
|
||||||
|
|
||||||
_scolar_formsemestre_validation_editor = ndb.EditableTable(
|
_scolar_formsemestre_validation_editor = ndb.EditableTable(
|
||||||
"scolar_formsemestre_validation",
|
"scolar_formsemestre_validation",
|
||||||
"formsemestre_validation_id",
|
"formsemestre_validation_id",
|
||||||
|
@ -2587,7 +2587,7 @@ def sco_bug_report_form():
|
|||||||
|
|
||||||
form = CreateBugReport()
|
form = CreateBugReport()
|
||||||
if request.method == "POST" and form.cancel.data: # cancel button
|
if request.method == "POST" and form.cancel.data: # cancel button
|
||||||
return flask.redirect(url_for("scodoc.index"))
|
return flask.redirect(url_for("scolar.index_html", scodoc_dept=g.scodoc_dept))
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
r = sco_bug_report.sco_bug_report(
|
r = sco_bug_report.sco_bug_report(
|
||||||
form.title.data, form.message.data, form.etab.data, form.include_dump.data
|
form.title.data, form.message.data, form.etab.data, form.include_dump.data
|
||||||
|
Loading…
Reference in New Issue
Block a user