diff --git a/app/models/__init__.py b/app/models/__init__.py index b4eea1636d..ed0b3bac28 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -79,7 +79,7 @@ class ScoDocModel: # virtual, by default, do nothing return args - def from_dict(self, args: dict, excluded: set[str] = None): + def from_dict(self, args: dict, excluded: set[str] | None = None): "Update object's fields given in dict. Add to session but don't commit." args_dict = self.convert_dict_fields( self.filter_model_attributes(args, excluded=excluded) diff --git a/app/models/etudiants.py b/app/models/etudiants.py index d0344166c0..a7ecf2dfe2 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -376,7 +376,7 @@ class Identite(db.Model, models.ScoDocModel): elif key == "civilite_etat_civil": value = input_civilite_etat_civil(value) elif key == "boursier": - value = bool(value) + value = scu.to_bool(value) elif key == "date_naissance": value = ndb.DateDMYtoISO(value) args_dict[key] = value diff --git a/sco_version.py b/sco_version.py index f2743e4338..1522700f64 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.6.61" +SCOVERSION = "9.6.62" SCONAME = "ScoDoc" diff --git a/tests/api/test_api_etudiants.py b/tests/api/test_api_etudiants.py index ab29e432e6..208ff1e827 100644 --- a/tests/api/test_api_etudiants.py +++ b/tests/api/test_api_etudiants.py @@ -971,10 +971,12 @@ def test_etudiant_create(api_headers): f"/etudiant/etudid/{etudid}/edit", { "civilite": "F", + "boursier": "N", }, headers=admin_header, ) assert etud["civilite"] == "F" + assert not etud["boursier"] assert etud["nom"] == args["nom"].upper() assert etud["admission"]["commentaire"] == args["admission"]["commentaire"] assert etud["admission"]["annee_bac"] == args["admission"]["annee_bac"] @@ -999,7 +1001,9 @@ def test_etudiant_create(api_headers): "admission": { "commentaire": "un nouveau commentaire", }, + "boursier": "O", # "oui", should be True }, headers=admin_header, ) assert etud["admission"]["commentaire"] == "un nouveau commentaire" + assert etud["boursier"]