diff --git a/app/auth/models.py b/app/auth/models.py index 8ee5bef79..758a836df 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -9,6 +9,7 @@ import json import os import re from time import time +from typing import Optional from flask import current_app, url_for, g from flask_login import UserMixin, AnonymousUserMixin @@ -265,13 +266,17 @@ class User(UserMixin, db.Model): ) @staticmethod - def get_user_name_from_nomplogin(nomplogin): - """Returns user_name from the string "Dupont Pierre (dupont)" """ + def get_user_id_from_nomplogin(nomplogin: str) -> Optional[int]: + """Returns id from the string "Dupont Pierre (dupont)" + or None if user does not exist + """ m = re.match(r".*\((.*)\)", nomplogin.strip()) if m: - return m.group(1) - else: - return None + user_name = m.group(1) + u = User.query.filter_by(user_name=user_name).first() + if u: + return u.id + return None def get_nom_fmt(self): """Nom formatté: "Martin" """ diff --git a/app/decorators.py b/app/decorators.py index c9cb0d7ba..6944b28e1 100644 --- a/app/decorators.py +++ b/app/decorators.py @@ -199,7 +199,7 @@ def scodoc7func(context): # necessary for db ids and boolean values try: v = int(v) - except ValueError: + except (ValueError, TypeError): pass kwargs[arg_name] = v # current_app.logger.info( diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index a62e5745c..7ce6f172c 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -287,9 +287,9 @@ class NotesEvaluation(db.Model): publish_incomplete = db.Column( db.Boolean, nullable=False, default=False, server_default="false" ) - # type d'evaluation: False normale, True rattrapage: + # type d'evaluation: 0 normale, 1 rattrapage, 2 "2eme session" evaluation_type = db.Column( - db.Boolean, nullable=False, default=False, server_default="false" + db.Integer, nullable=False, default=0, server_default="0" ) # ordre de presentation (par défaut, le plus petit numero # est la plus ancienne eval): diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index d0313534c..df31c1d26 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -209,7 +209,10 @@ class TF(object): # convert numbers, except ids if field.endswith("id") and self.values[field]: # enforce integer ids: - self.values[field] = int(self.values[field]) + try: + self.values[field] = int(self.values[field]) + except ValueError: + pass elif isinstance(self.values[field], (int, float)): self.values[field] = str(self.values[field]) # @@ -299,9 +302,9 @@ class TF(object): # boolean checkbox if descr.get("input_type", None) == "boolcheckbox": if int(val): - self.values[field] = 1 + self.values[field] = True else: - self.values[field] = 0 + self.values[field] = False # open('/tmp/toto','a').write('checkvalues: val=%s (%s) values[%s] = %s\n' % (val, type(val), field, self.values[field])) if descr.get("convert_numbers", False): if typ[:3] == "int": @@ -493,10 +496,15 @@ class TF(object): checked = "" else: # boolcheckbox # open('/tmp/toto','a').write('GenForm: values[%s] = %s (%s)\n' % (field, values[field], type(values[field]))) - try: - v = int(values[field]) - except: - v = 0 + if values[field] == "True": + v = True + elif values[field] == "False": + v = False + else: + try: + v = int(values[field]) + except: + v = False if v: checked = 'checked="checked"' else: @@ -562,7 +570,7 @@ class TF(object): '' % values) + lem.append(('value="%(' + field + ')s" />') % values) suggest_js.append( f"""var {field}_opts = {dict2js(descr.get("text_suggest_options", {}))}; var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); diff --git a/app/scodoc/notes_table.py b/app/scodoc/notes_table.py index 115db008d..f96dfec33 100644 --- a/app/scodoc/notes_table.py +++ b/app/scodoc/notes_table.py @@ -800,7 +800,7 @@ class NotesTable(object): # was_capitalized s'il y a precedemment une UE capitalisée (pas forcement meilleure) mu["was_capitalized"] = False - is_external = 0 + is_external = False event_date = None if not block_computation: for ue_cap in self.ue_capitalisees[etudid]: @@ -1098,7 +1098,7 @@ class NotesTable(object): if self.get_etud_etat(etudid) == DEF: return { "code": DEF, - "assidu": 0, + "assidu": False, "event_date": "", "compense_formsemestre_id": None, } diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 0e137710e..3d9cac178 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -764,6 +764,10 @@ _billet_absenceEditor = ndb.EditableTable( "justified", ), sortkey="entry_date desc", + input_formators={ + "etat": bool, + "justified": bool, + }, ) billet_absence_create = _billet_absenceEditor.create diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index bb7c9f851..9f70acc13 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -514,7 +514,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers mod["evaluations"] = [] for e in evals: e = e.copy() - if int(e["visibulletin"]) == 1 or version == "long": + if e["visibulletin"] or version == "long": # affiche "bonus" quand les points de malus sont négatifs if is_malus: val = e["notes"].get(etudid, {"value": "NP"})[ diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index 6b1e76fc1..7bfe725ce 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -94,7 +94,7 @@ def formsemestre_bulletinetud_published_dict( d = {} sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) - if sem["bul_hide_xml"] == "0" or force_publishing: + if (not sem["bul_hide_xml"]) or force_publishing: published = 1 else: published = 0 @@ -264,7 +264,7 @@ def formsemestre_bulletinetud_published_dict( m["evaluation"] = [] if version != "short": for e in evals: - if int(e["visibulletin"]) == 1 or version == "long": + if e["visibulletin"] or version == "long": val = e["notes"].get(etudid, {"value": "NP"})[ "value" ] # NA si etud demissionnaire diff --git a/app/scodoc/sco_bulletins_legacy.py b/app/scodoc/sco_bulletins_legacy.py index 318e479c1..7b70cd7b5 100644 --- a/app/scodoc/sco_bulletins_legacy.py +++ b/app/scodoc/sco_bulletins_legacy.py @@ -155,7 +155,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator): if self.version != "short": # --- notes de chaque eval: for e in mod["evaluations"]: - if int(e["visibulletin"]) == 1 or self.version == "long": + if e["visibulletin"] or self.version == "long": H.append( '
Bulletins non publiés sur le portail
' ) diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index 2ce5e291c..12430a011 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -323,7 +323,7 @@ def formsemestre_validation_etud_form( ) H.append('Formation ') - if Se.sem["gestion_semestrielle"] == "1": + if Se.sem["gestion_semestrielle"]: H.append("avec semestres décalés
") else: H.append("sans semestres décalés") @@ -375,7 +375,7 @@ def formsemestre_validation_etud_manu( ): """Enregistre validation""" if assidu: - assidu = 1 + assidu = True etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] Se = sco_parcours_dut.SituationEtudParcours(context, etud, formsemestre_id) if code_etat in Se.parcours.UNUSED_CODES: @@ -526,7 +526,7 @@ def formsemestre_recap_parcours_table( pv = dpv["decisions"][0] decision_sem = pv["decision_sem"] decisions_ue = pv["decisions_ue"] - if with_all_columns and decision_sem and decision_sem["assidu"] == 0: + if with_all_columns and decision_sem and not decision_sem["assidu"]: ass = " (non ass.)" else: ass = "" @@ -744,7 +744,7 @@ def form_decision_manuelle( '' % (cod, sco_codes_parcours.CODES_EXPL[cod], cod) ) - elif Se.sem["gestion_compensation"] == "1": + elif Se.sem["gestion_compensation"]: # traitement spécial pour ADC (compensation) # ne propose que les semestres avec lesquels on peut compenser # le code transmis est ADC_formsemestre_id @@ -795,7 +795,7 @@ def form_decision_manuelle( else: allowed_codes = set(sco_codes_parcours.DEVENIRS_STD) # semestres decales ? - if Se.sem["gestion_semestrielle"] == "1": + if Se.sem["gestion_semestrielle"]: allowed_codes = allowed_codes.union(sco_codes_parcours.DEVENIRS_DEC) # n'autorise les codes NEXT2 que si semestres décalés et s'il ne manque qu'un semestre avant le n+2 if Se.can_jump_to_next2(): @@ -1082,7 +1082,9 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST= return "\n".join(H) + tf[1] + X + warn + html_sco_header.sco_footer() elif tf[0] == -1: return flask.redirect( - scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + str(formsemestre_id) + scu.NotesURL() + + "/formsemestre_status?formsemestre_id=" + + str(formsemestre_id) ) else: if tf[2]["semestre_id"]: @@ -1143,7 +1145,7 @@ def do_formsemestre_validate_previous_ue( moy_ue=moy_ue, date=date, semestre_id=semestre_id, - is_external=1, + is_external=True, ) logdb( diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index 0d891b099..afd2d2baa 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -86,6 +86,10 @@ partitionEditor = ndb.EditableTable( "bul_show_rank", "show_in_lists", ), + input_formators={ + "bul_show_rank": bool, + "show_in_lists": bool, + }, ) groupEditor = ndb.EditableTable( @@ -390,14 +394,15 @@ def formsemestre_get_etud_groupnames(context, formsemestre_id, attr="group_name" { etudid : { partition_id : group_name }} (attr=group_name or group_id) """ infos = ndb.SimpleDictFetch( - """SELECT i.id AS etudid, p.is AS partition_id, gd.group_name, gd.id AS group_id + """SELECT i.id AS etudid, p.id AS partition_id, + gd.group_name, gd.id AS group_id FROM notes_formsemestre_inscription i, partition p, group_descr gd, group_membership gm WHERE i.formsemestre_id=%(formsemestre_id)s - and i.formsemestre_id=p.formsemestre_id - and p.id=gd.partition_id - and gm.etudid=i.etudid - and gm.group_id = gd.group_id + and i.formsemestre_id = p.formsemestre_id + and p.id = gd.partition_id + and gm.etudid = i.etudid + and gm.group_id = gd.id and p.partition_name is not NULL """, {"formsemestre_id": formsemestre_id}, @@ -505,9 +510,9 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG for group in groups: x_group = Element( "group", - partition_id=partition_id, + partition_id=str(partition_id), partition_name=partition["partition_name"], - group_id=group["group_id"], + group_id=str(group["group_id"]), group_name=group["group_name"], ) x_response.append(x_group) @@ -516,7 +521,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG x_group.append( Element( "etud", - etudid=e["etudid"], + etudid=str(e["etudid"]), civilite=etud["civilite_str"], sexe=etud["civilite_str"], # compat nom=sco_etud.format_nom(etud["nom"]), @@ -531,7 +536,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG if etuds_set: x_group = Element( "group", - partition_id=partition_id, + partition_id=str(partition_id), partition_name=partition["partition_name"], group_id="_none_", group_name="", @@ -542,7 +547,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG x_group.append( Element( "etud", - etudid=etud["etudid"], + etudid=str(etud["etudid"]), sexe=etud["civilite_str"], nom=sco_etud.format_nom(etud["nom"]), prenom=sco_etud.format_prenom(etud["prenom"]), @@ -618,10 +623,14 @@ def change_etud_group_in_partition( partition = get_partition(context, group["partition_id"]) # 1- Supprime membership dans cette partition ndb.SimpleQuery( - """DELETE FROM group_membership WHERE id IN + """DELETE FROM group_membership + WHERE id IN (SELECT gm.id FROM group_membership gm, group_descr gd - WHERE gm.etudid=%(etudid)s AND gm.group_id=gd.group_id AND gd.partition_id=%(partition_id)s)""", + WHERE gm.etudid = %(etudid)s + AND gm.group_id = gd.id + AND gd.partition_id = %(partition_id)s) + """, {"etudid": etudid, "partition_id": partition["partition_id"]}, ) @@ -688,7 +697,8 @@ def setGroups( old_members = get_group_members(context, group_id) old_members_set = set([x["etudid"] for x in old_members]) # Place dans ce groupe les etudiants indiqués: - for etudid in fs[1:-1]: + for etudid_str in fs[1:-1]: + etudid = int(etudid_str) if etudid in old_members_set: old_members_set.remove( etudid @@ -1175,7 +1185,7 @@ def group_set_name(context, group_id, group_name, REQUEST=None, redirect=1): # redirect to partition edit page: if redirect: - return flask.redirect("affectGroups?partition_id=" + group["partition_id"]) + return flask.redirect("affectGroups?partition_id=" + str(group["partition_id"])) def group_rename(context, group_id, REQUEST=None): diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index c1ff713bc..dd8da1f81 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -303,7 +303,7 @@ class DisplayedGroupsInfos(object): def __init__( self, context, - group_ids=[], # groupes specifies dans l'URL + group_ids=[], # groupes specifies dans l'URL, ou un seul int formsemestre_id=None, etat=None, select_all_when_unspecified=False, @@ -311,7 +311,7 @@ class DisplayedGroupsInfos(object): REQUEST=None, ): # log('DisplayedGroupsInfos %s' % group_ids) - if isinstance(group_ids, str): + if isinstance(group_ids, int): if group_ids: group_ids = [group_ids] # cas ou un seul parametre, pas de liste else: diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 6037a59fa..424d6c08f 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -436,7 +436,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No if etat["evalcomplete"]: etat_txt = """(prise en compte)""" etat_descr = "notes utilisées dans les moyennes" - elif eval["publish_incomplete"] != "0": + elif eval["publish_incomplete"]: etat_txt = """(prise en compte immédiate)""" etat_descr = ( "il manque des notes, mais la prise en compte immédiate a été demandée" @@ -511,7 +511,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No ) ) # - if eval["visibulletin"] == "1": + if eval["visibulletin"]: H.append( scu.icontag( "status_visible_img", title="visible dans bulletins intermédiaires" diff --git a/app/scodoc/sco_parcours_dut.py b/app/scodoc/sco_parcours_dut.py index 63a6c8cfc..09d2ed66e 100644 --- a/app/scodoc/sco_parcours_dut.py +++ b/app/scodoc/sco_parcours_dut.py @@ -146,7 +146,7 @@ class SituationEtudParcoursGeneric(object): # Verifie barres self._comp_barres() # Verifie compensation - if self.prev and self.sem["gestion_compensation"] == "1": + if self.prev and self.sem["gestion_compensation"]: self.can_compensate_with_prev = self.prev["can_compensate"] else: self.can_compensate_with_prev = False @@ -176,10 +176,9 @@ class SituationEtudParcoursGeneric(object): if rule.conclusion[0] in self.parcours.UNUSED_CODES: continue # Saute regles REDOSEM si pas de semestres decales: - if ( - self.sem["gestion_semestrielle"] != "1" - and rule.conclusion[3] == "REDOSEM" - ): + if (not self.sem["gestion_semestrielle"]) and rule.conclusion[ + 3 + ] == "REDOSEM": continue if rule.match(state): if rule.conclusion[0] == ADC: @@ -283,7 +282,7 @@ class SituationEtudParcoursGeneric(object): (et que le sem courant n soit validé, ce qui n'est pas testé ici) """ n = self.sem["semestre_id"] - if self.sem["gestion_semestrielle"] != "1": + if not self.sem["gestion_semestrielle"]: return False # pas de semestre décalés if n == NO_SEMESTRE_ID or n > self.parcours.NB_SEM - 2: return False # n+2 en dehors du parcours @@ -602,7 +601,7 @@ class SituationEtudParcoursGeneric(object): self.prev["formsemestre_id"], self.etudid, decision.new_code_prev, - assidu=1, + assidu=True, formsemestre_id_utilise_pour_compenser=fsid, ) logdb( @@ -779,8 +778,14 @@ _scolar_formsemestre_validation_editor = ndb.EditableTable( "semestre_id", "is_external", ), - output_formators={"event_date": ndb.DateISOtoDMY, "assidu": bool}, - input_formators={"event_date": ndb.DateDMYtoISO, "assidu": bool}, + output_formators={ + "event_date": ndb.DateISOtoDMY, + }, + input_formators={ + "event_date": ndb.DateDMYtoISO, + "assidu": bool, + "is_external": bool, + }, ) scolar_formsemestre_validation_create = _scolar_formsemestre_validation_editor.create @@ -837,7 +842,7 @@ def formsemestre_update_validation_sem( formsemestre_id, etudid, code, - assidu=1, + assidu=True, formsemestre_id_utilise_pour_compenser=None, ): "Update validation semestre" @@ -845,7 +850,7 @@ def formsemestre_update_validation_sem( "formsemestre_id": formsemestre_id, "etudid": etudid, "code": code, - "assidu": int(assidu), + "assidu": assidu, } log("formsemestre_update_validation_sem: %s" % args) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) diff --git a/app/scodoc/sco_prepajury.py b/app/scodoc/sco_prepajury.py index 057f8ea5b..f24c9082e 100644 --- a/app/scodoc/sco_prepajury.py +++ b/app/scodoc/sco_prepajury.py @@ -114,7 +114,7 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST): code[etudid] = decision["code"] if decision["compense_formsemestre_id"]: code[etudid] += "+" # indique qu'il a servi a compenser - assidu[etudid] = {0: "Non", 1: "Oui"}.get(decision["assidu"], "") + assidu[etudid] = {False: "Non", True: "Oui"}.get(decision["assidu"], "") aut_list = sco_parcours_dut.formsemestre_get_autorisation_inscription( context, etudid, formsemestre_id ) diff --git a/app/scodoc/sco_ue_external.py b/app/scodoc/sco_ue_external.py index b039d6218..bb0e55287 100644 --- a/app/scodoc/sco_ue_external.py +++ b/app/scodoc/sco_ue_external.py @@ -54,6 +54,7 @@ Solution proposée (nov 2014): """ import flask +from flask_login import current_user import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -87,9 +88,8 @@ def external_ue_create( log("external_ue_create( formsemestre_id=%s, titre=%s )" % (formsemestre_id, titre)) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) # Contrôle d'accès: - authuser = REQUEST.AUTHENTICATED_USER - if not authuser.has_permission(Permission.ScoImplement): - if not sem["resp_can_edit"] or str(authuser) not in sem["responsables"]: + if not current_user.has_permission(Permission.ScoImplement): + if not sem["resp_can_edit"] or (current_user.id not in sem["responsables"]): raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération") # formation_id = sem["formation_id"] @@ -107,7 +107,7 @@ def external_ue_create( "numero": numero, "type": ue_type, "ects": ects, - "is_external": 1, + "is_external": True, }, ) @@ -170,9 +170,9 @@ def external_ue_inscrit_et_note( moduleimpl_id=moduleimpl_id, note_max=20.0, coefficient=1.0, - publish_incomplete=1, - evaluation_type=0, - visibulletin=0, + publish_incomplete=True, + evaluation_type=scu.EVALUATION_NORMALE, + visibulletin=False, description="note externe", ) # Saisie des notes @@ -188,7 +188,7 @@ def external_ue_inscrit_et_note( def get_existing_external_ue(context, formation_id): "la liste de toutes les UE externes définies dans cette formation" return sco_edit_ue.do_ue_list( - context, args={"formation_id": formation_id, "is_external": 1} + context, args={"formation_id": formation_id, "is_external": True} ) @@ -221,9 +221,8 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None): """ sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) # Contrôle d'accès: - authuser = REQUEST.AUTHENTICATED_USER - if not authuser.has_permission(Permission.ScoImplement): - if not sem["resp_can_edit"] or str(authuser) not in sem["responsables"]: + if not current_user.has_permission(Permission.ScoImplement): + if not sem["resp_can_edit"] or (current_user.id not in sem["responsables"]): raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération") etud = sco_etud.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0] diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 25c0b4967..e7ddb9c4f 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -449,9 +449,13 @@ def stripquotes(s): def suppress_accents(s): "remove accents and suppress non ascii characters from string s" - return ( - unicodedata.normalize("NFD", s).encode("ascii", "ignore").decode(SCO_ENCODING) - ) + if isinstance(s, str): + return ( + unicodedata.normalize("NFD", s) + .encode("ascii", "ignore") + .decode(SCO_ENCODING) + ) + return s # may be int def sanitize_string(s): diff --git a/app/views/absences.py b/app/views/absences.py index f91d1dda5..2f6f201d2 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -1189,7 +1189,7 @@ def _tableBillets(context, billets, etud=None, title=""): m = " après-midi" b["abs_end_str"] = b["abs_end"].strftime("%d/%m/%Y") + m if b["etat"] == 0: - if b["justified"] == 0: + if b["justified"]: b["etat_str"] = "à traiter" else: b["etat_str"] = "à justifier" @@ -1441,7 +1441,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None): if tf[0] == 0: tab = _tableBillets(context, [billet], etud=etud) H.append(tab.html()) - if billet["justified"] == 1: + if billet["justified"]: H.append( """L'étudiant pense pouvoir justifier cette absence.
Vérifiez le justificatif avant d'enregistrer.
Pour ajouter un enseignant, choisissez un nom dans le menu
' @@ -838,7 +839,7 @@ def edit_moduleimpl_resp(context, REQUEST, moduleimpl_id): elif tf[0] == -1: return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id) else: - responsable_id = User.get_user_name_from_nomplogin(tf[2]["responsable_id"]) + responsable_id = User.get_user_id_from_nomplogin(tf[2]["responsable_id"]) if ( not responsable_id ): # presque impossible: tf verifie les valeurs (mais qui peuvent changer entre temps) diff --git a/app/views/scolar.py b/app/views/scolar.py index da00ace6e..725573ee6 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -703,6 +703,18 @@ sco_publish( Permission.ScoView, methods=["GET", "POST"], ) +# @bp.route("/partition_create", methods=["GET", "POST"]) +# @permission_required(Permission.ScoView) +# @scodoc7func(context) +# def partition_create( +# context, +# formsemestre_id, +# partition_name="", +# default=False, +# numero=None, +# redirect=1): +# return sco_groups.partition_create(context, formsemestre_id, + sco_publish("/etud_info_html", sco_page_etud.etud_info_html, Permission.ScoView) diff --git a/scotests/test_deleteBilletAbsence.py b/scotests/test_deleteBilletAbsence.py index db605ae05..c9350cb30 100644 --- a/scotests/test_deleteBilletAbsence.py +++ b/scotests/test_deleteBilletAbsence.py @@ -43,22 +43,29 @@ mi = G.create_moduleimpl( # --- Création d'un étudiant etud = G.create_etud(code_nip=None) G.inscrit_etudiant(sem, etud) -etudid=etud["etudid"] +etudid = etud["etudid"] # --- Création d'une absence -sco_abs_views.doSignaleAbsence(context.Absences, datedebut="22/01/2021", datefin="22/01/2021", demijournee=2, etudid=etudid, REQUEST=REQUEST) +sco_abs_views.doSignaleAbsence( + context.Absences, + datedebut="22/01/2021", + datefin="22/01/2021", + demijournee=2, + etudid=etudid, + REQUEST=REQUEST, +) # --- Création d'un billet b1 = context.Absences.AddBilletAbsence( - begin="2021-01-22 00:00", - end="2021-01-22 23:59", - etudid=etudid, - description = "abs du 22", - justified=False, - code_nip=etuds[0]["code_nip"], - code_ine=etuds[0]["code_ine"], - REQUEST=REQUEST, - ) + begin="2021-01-22 00:00", + end="2021-01-22 23:59", + etudid=etudid, + description="abs du 22", + justified=False, + code_nip=etuds[0]["code_nip"], + code_ine=etuds[0]["code_ine"], + REQUEST=REQUEST, +) # --- Suppression d'un billet _ = context.Absences.deleteBilletAbsence(load_li_bi[1]["billet_id"], REQUEST=REQUEST) diff --git a/tests/unit/test_sco_basic.py b/tests/unit/test_sco_basic.py index 8e0c405be..9817d3ce2 100644 --- a/tests/unit/test_sco_basic.py +++ b/tests/unit/test_sco_basic.py @@ -132,7 +132,7 @@ def run_sco_basic(verbose=False): assert etat["evalcomplete"] # Modifie l'évaluation 2 pour "prise en compte immédiate" - e2["publish_incomplete"] = "1" + e2["publish_incomplete"] = True sco_evaluations.do_evaluation_edit(e2) etat = sco_evaluations.do_evaluation_etat(e2["evaluation_id"]) assert etat["evalcomplete"] == False