forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "f04265c78e2a06bd7aecc11b41c32abc94b6ba41" and "832a25f7dcaad280e1bd3062b4aeacf166674387" have entirely different histories.
f04265c78e
...
832a25f7dc
@ -583,7 +583,7 @@ def etat_evals(formsemestre_id: int):
|
|||||||
).all()
|
).all()
|
||||||
|
|
||||||
# Si il y a plus d'une note saisie pour l'évaluation
|
# Si il y a plus d'une note saisie pour l'évaluation
|
||||||
if len(notes) >= 1:
|
if len(notes) > 1:
|
||||||
# Trie des notes en fonction de leurs dates
|
# Trie des notes en fonction de leurs dates
|
||||||
notes_sorted = sorted(notes, key=lambda note: note.date)
|
notes_sorted = sorted(notes, key=lambda note: note.date)
|
||||||
|
|
||||||
@ -592,11 +592,7 @@ def etat_evals(formsemestre_id: int):
|
|||||||
|
|
||||||
# Récupération de l'id de la note médiane
|
# Récupération de l'id de la note médiane
|
||||||
list_id_notes_sorted = [note.id for note in notes_sorted]
|
list_id_notes_sorted = [note.id for note in notes_sorted]
|
||||||
|
id_mediane = calculate_median(list_id_notes_sorted)
|
||||||
# Ici si la longueur est paire on prend, on prend le +1 car un indice ne peux pas avoir de nombre floatant
|
|
||||||
id_mediane = list_id_notes_sorted[
|
|
||||||
int((len(list_id_notes_sorted)) / 2)
|
|
||||||
]
|
|
||||||
|
|
||||||
date_mediane = ""
|
date_mediane = ""
|
||||||
for n in notes_sorted:
|
for n in notes_sorted:
|
||||||
|
@ -40,3 +40,15 @@ def get_last_instance_etud_from_etudid_or_nip_or_ine(
|
|||||||
|
|
||||||
return etud
|
return etud
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_median_list_notes(list):
|
||||||
|
"""
|
||||||
|
Retourne la mediane d'une liste de notes
|
||||||
|
list : une liste préalablement sorted de préférence
|
||||||
|
"""
|
||||||
|
list_len = len(list)
|
||||||
|
if list_len < 1:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Ici si la longueur est paire on prend, on prend le +1 car un indice ne peux pas avoir de nombre floatant
|
||||||
|
return list[int((list_len) / 2)]
|
||||||
|
@ -131,41 +131,3 @@ def test_formsemestre_programme(api_headers):
|
|||||||
assert verify_fields(modules[0], MODIMPL_FIELDS)
|
assert verify_fields(modules[0], MODIMPL_FIELDS)
|
||||||
assert verify_fields(ressource, MODIMPL_FIELDS)
|
assert verify_fields(ressource, MODIMPL_FIELDS)
|
||||||
assert verify_fields(sae, MODIMPL_FIELDS)
|
assert verify_fields(sae, MODIMPL_FIELDS)
|
||||||
|
|
||||||
|
|
||||||
# def test_formsemestre_etudiants(api_headers):
|
|
||||||
# """
|
|
||||||
# Route: /formsemestre/<int:formsemestre_id>/etudiants, /formsemestre/<int:formsemestre_id>/etudiants/demissionnaires, /formsemestre/<int:formsemestre_id>/etudiants/defaillants
|
|
||||||
# """
|
|
||||||
# r = requests.get(
|
|
||||||
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants",
|
|
||||||
# headers=api_headers,
|
|
||||||
# verify=CHECK_CERTIFICATE,
|
|
||||||
# )
|
|
||||||
# assert r.status_code == 200
|
|
||||||
#
|
|
||||||
# r = requests.get(
|
|
||||||
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires",
|
|
||||||
# headers=api_headers,
|
|
||||||
# verify=CHECK_CERTIFICATE,
|
|
||||||
# )
|
|
||||||
# assert r.status_code == 200
|
|
||||||
#
|
|
||||||
# r = requests.get(
|
|
||||||
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/defaillants",
|
|
||||||
# headers=api_headers,
|
|
||||||
# verify=CHECK_CERTIFICATE,
|
|
||||||
# )
|
|
||||||
# assert r.status_code == 200
|
|
||||||
|
|
||||||
|
|
||||||
def test_etat_evals(api_headers):
|
|
||||||
"""
|
|
||||||
Route : /formsemestre/<int:formsemestre_id>/etat_evals
|
|
||||||
"""
|
|
||||||
r = requests.get(
|
|
||||||
API_URL + "/formsemestre/1/etat_evals",
|
|
||||||
headers=api_headers,
|
|
||||||
verify=CHECK_CERTIFICATE,
|
|
||||||
)
|
|
||||||
assert r.status_code == 200
|
|
||||||
|
@ -28,7 +28,7 @@ import sys
|
|||||||
|
|
||||||
from app.auth.models import Role, User
|
from app.auth.models import Role, User
|
||||||
from app import models
|
from app import models
|
||||||
from app.models import Departement, Formation, FormSemestre, Identite, ModuleImpl
|
from app.models import Departement, Formation, FormSemestre, Identite
|
||||||
from app import db
|
from app import db
|
||||||
from app.scodoc import (
|
from app.scodoc import (
|
||||||
sco_cache,
|
sco_cache,
|
||||||
@ -38,7 +38,6 @@ from app.scodoc import (
|
|||||||
sco_groups,
|
sco_groups,
|
||||||
)
|
)
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_saisie_notes import notes_add
|
|
||||||
from tools.fakeportal.gen_nomprenoms import nomprenom
|
from tools.fakeportal.gen_nomprenoms import nomprenom
|
||||||
|
|
||||||
random.seed(12345678) # tests reproductibles
|
random.seed(12345678) # tests reproductibles
|
||||||
@ -189,29 +188,6 @@ def create_evaluations(formsemestre: FormSemestre):
|
|||||||
evaluation_id = sco_evaluation_db.do_evaluation_create(**args)
|
evaluation_id = sco_evaluation_db.do_evaluation_create(**args)
|
||||||
|
|
||||||
|
|
||||||
def saisie_note_evaluations(formsemestre: FormSemestre, user: User):
|
|
||||||
"""
|
|
||||||
Saisie les notes des evaluations d'un semestre
|
|
||||||
"""
|
|
||||||
# Récupération des id des étudiants du semestre
|
|
||||||
list_etudids = [etud.id for etud in formsemestre.etuds]
|
|
||||||
list_ues = formsemestre.query_ues()
|
|
||||||
|
|
||||||
def create_list_etudid_random_notes():
|
|
||||||
"""
|
|
||||||
Retourne une liste de tuple (etudid, note_random)
|
|
||||||
"""
|
|
||||||
return [(etudid, random.uniform(0.0, 20.0)) for etudid in list_etudids]
|
|
||||||
|
|
||||||
for ue in list_ues:
|
|
||||||
mods = ue.modules
|
|
||||||
for mod in mods:
|
|
||||||
moduleimpl = ModuleImpl.query.get_or_404(mod.id)
|
|
||||||
for evaluation in moduleimpl.evaluations:
|
|
||||||
notes = create_list_etudid_random_notes()
|
|
||||||
notes_add(user, evaluation.id, notes)
|
|
||||||
|
|
||||||
|
|
||||||
def init_test_database():
|
def init_test_database():
|
||||||
"""Appelé par la commande `flask init-test-database`
|
"""Appelé par la commande `flask init-test-database`
|
||||||
|
|
||||||
@ -225,7 +201,6 @@ def init_test_database():
|
|||||||
formsemestre = create_formsemestre(formation, user_lecteur)
|
formsemestre = create_formsemestre(formation, user_lecteur)
|
||||||
create_evaluations(formsemestre)
|
create_evaluations(formsemestre)
|
||||||
inscrit_etudiants(etuds, formsemestre)
|
inscrit_etudiants(etuds, formsemestre)
|
||||||
saisie_note_evaluations(formsemestre, user_lecteur)
|
|
||||||
# à compléter
|
# à compléter
|
||||||
# - groupes
|
# - groupes
|
||||||
# - absences
|
# - absences
|
||||||
|
Loading…
Reference in New Issue
Block a user