diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py index 21b5859922..a28728578f 100644 --- a/app/scodoc/sco_etud.py +++ b/app/scodoc/sco_etud.py @@ -219,26 +219,27 @@ _identiteEditor = ndb.EditableTable( "identite", "etudid", ( - "etudid", - "nom", - "nom_usuel", - "prenom", - "prenom_etat_civil", - "cas_id", + "admission_id", + "boursier", "cas_allow_login", "cas_allow_scodoc_login", - "civilite", # 'M", "F", or "X" + "cas_id", "civilite_etat_civil", - "date_naissance", - "lieu_naissance", - "dept_naissance", - "nationalite", - "statut", - "boursier", - "foto", - "photo_filename", + "civilite", # 'M", "F", or "X" "code_ine", "code_nip", + "date_naissance", + "dept_naissance", + "etudid", + "foto", + "lieu_naissance", + "nationalite", + "nom_usuel", + "nom", + "photo_filename", + "prenom_etat_civil", + "prenom", + "statut", ), filter_dept=True, sortkey="nom", @@ -300,7 +301,7 @@ def check_nom_prenom_homonyms( prenom = prenom.lower().strip() # Don't allow some special cars (eg used in sql regexps) if scu.FORBIDDEN_CHARS_EXP.search(nom) or scu.FORBIDDEN_CHARS_EXP.search(prenom): - return False, 0 + return False, [] # Liste homonymes (dans tous les départements): query = Identite.query.filter( Identite.nom.ilike(nom + "%"), Identite.prenom.ilike(prenom + "%") @@ -351,7 +352,7 @@ def _check_duplicate_code(cnx, args, code_name, disable_notify=False, edit=True) parameters = {} if not disable_notify: err_page = f"""
Le {code_name} {args[code_name]} est déjà utilisé: un seul étudiant peut avoir +
Le {code_name} {args[code_name]} est déjà utilisé: un seul étudiant peut avoir ce code. Vérifier votre valeur ou supprimer l'autre étudiant avec cette valeur.
(recherche menée dans le{ss} département{ss}: + f"""
(recherche menée dans le{ss} département{ss}: {", ".join(accessible_depts)})
diff --git a/sco_version.py b/sco_version.py index 7c6b9fb4ba..9f9457694c 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.6.47" +SCOVERSION = "9.6.48" SCONAME = "ScoDoc" diff --git a/tests/ressources/misc/ImportEtudiants.xlsx b/tests/ressources/misc/ImportEtudiants.xlsx index 142cab00be..41deb06a51 100644 Binary files a/tests/ressources/misc/ImportEtudiants.xlsx and b/tests/ressources/misc/ImportEtudiants.xlsx differ diff --git a/tests/unit/test_etudiants.py b/tests/unit/test_etudiants.py index 15739a1879..2884980a52 100644 --- a/tests/unit/test_etudiants.py +++ b/tests/unit/test_etudiants.py @@ -3,7 +3,7 @@ """Test modèle étudiant (identite) -Utiliser comme: +Utiliser comme: pytest tests/unit/test_etudiants.py """ @@ -16,7 +16,7 @@ import app from app import db from app.models import Admission, Adresse, Departement, FormSemestre, Identite from app.scodoc import sco_etud -from app.scodoc import sco_import_etuds +from app.scodoc import sco_find_etud, sco_import_etuds from config import TestConfig from tests.unit import setup, dict_include @@ -267,7 +267,7 @@ def test_import_etuds_xlsx(test_client): "civilite_etat_civil": "F", "civilite": "X", "code_ine": "ine10", - "code_nip": "nip10", + "code_nip": "1000010", "date_naissance": "", "dept_acronym": "TEST_", "dept_naissance": "", @@ -302,7 +302,7 @@ def test_import_etuds_xlsx(test_client): "civilite_etat_civil": "F", "civilite": "X", "code_ine": "ine10", - "code_nip": "nip10", + "code_nip": "1000010", "date_naissance": "", "dept_acronym": "TEST_", "dept_naissance": "", @@ -367,3 +367,13 @@ def test_import_etuds_xlsx(test_client): "telephonemobilestr": "", }, ) + # Test de search_etud_in_dept + etuds = sco_find_etud.search_etuds_infos_from_exp("NOM10") + assert len(etuds) == 1 + assert etuds[0]["code_ine"] == "ine10" + etuds = sco_find_etud.search_etuds_infos_from_exp("NOM") + assert len(etuds) > 1 + assert all(e["nom"].startswith("NOM") for e in etuds) + etuds = sco_find_etud.search_etuds_infos_from_exp("1000010") + assert len(etuds) == 1 + assert etuds[0]["code_ine"] == "ine10"