forked from ScoDoc/ScoDoc
Merge branch 'dev93' of https://scodoc.org/git/viennet/ScoDoc
This commit is contained in:
commit
9212f72581
@ -34,7 +34,7 @@ def df_load_modimpl_inscr(formsemestre) -> pd.DataFrame:
|
||||
)
|
||||
df = df.merge(ins_df, how="left", left_index=True, right_index=True)
|
||||
# Force columns names to integers (moduleimpl ids)
|
||||
df.columns = pd.Int64Index([int(x) for x in df.columns], dtype="int")
|
||||
df.columns = pd.Index([int(x) for x in df.columns], dtype=int)
|
||||
# les colonnes de df sont en float (Nan) quand il n'y a
|
||||
# aucun inscrit au module.
|
||||
df.fillna(0, inplace=True) # les non-inscrits
|
||||
|
@ -169,9 +169,7 @@ class ModuleImplResults:
|
||||
self.en_attente = True
|
||||
|
||||
# Force columns names to integers (evaluation ids)
|
||||
evals_notes.columns = pd.Int64Index(
|
||||
[int(x) for x in evals_notes.columns], dtype="int"
|
||||
)
|
||||
evals_notes.columns = pd.Index([int(x) for x in evals_notes.columns], dtype=int)
|
||||
self.evals_notes = evals_notes
|
||||
|
||||
def _load_evaluation_notes(self, evaluation: Evaluation) -> pd.DataFrame:
|
||||
|
@ -271,7 +271,7 @@ def compute_ue_moys_apc(
|
||||
)
|
||||
# Annule les coefs des modules NaN
|
||||
modimpl_coefs_etuds_no_nan = np.where(np.isnan(sem_cube), 0.0, modimpl_coefs_etuds)
|
||||
if modimpl_coefs_etuds_no_nan.dtype == np.object: # arrive sur des tableaux vides
|
||||
if modimpl_coefs_etuds_no_nan.dtype == object: # arrive sur des tableaux vides
|
||||
modimpl_coefs_etuds_no_nan = modimpl_coefs_etuds_no_nan.astype(np.float)
|
||||
#
|
||||
# Version vectorisée
|
||||
@ -356,7 +356,7 @@ def compute_ue_moys_classic(
|
||||
modimpl_coefs_etuds_no_nan = np.where(
|
||||
np.isnan(sem_matrix), 0.0, modimpl_coefs_etuds
|
||||
)
|
||||
if modimpl_coefs_etuds_no_nan.dtype == np.object: # arrive sur des tableaux vides
|
||||
if modimpl_coefs_etuds_no_nan.dtype == object: # arrive sur des tableaux vides
|
||||
modimpl_coefs_etuds_no_nan = modimpl_coefs_etuds_no_nan.astype(np.float)
|
||||
# --------------------- Calcul des moyennes d'UE
|
||||
ue_modules = np.array(
|
||||
@ -367,7 +367,7 @@ def compute_ue_moys_classic(
|
||||
)
|
||||
# nb_ue x nb_etuds x nb_mods : coefs prenant en compte NaN et inscriptions:
|
||||
coefs = (modimpl_coefs_etuds_no_nan_stacked * ue_modules).swapaxes(1, 2)
|
||||
if coefs.dtype == np.object: # arrive sur des tableaux vides
|
||||
if coefs.dtype == object: # arrive sur des tableaux vides
|
||||
coefs = coefs.astype(np.float)
|
||||
with np.errstate(invalid="ignore"): # ignore les 0/0 (-> NaN)
|
||||
etud_moy_ue = (
|
||||
@ -462,7 +462,7 @@ def compute_mat_moys_classic(
|
||||
modimpl_coefs_etuds_no_nan = np.where(
|
||||
np.isnan(sem_matrix), 0.0, modimpl_coefs_etuds
|
||||
)
|
||||
if modimpl_coefs_etuds_no_nan.dtype == np.object: # arrive sur des tableaux vides
|
||||
if modimpl_coefs_etuds_no_nan.dtype == object: # arrive sur des tableaux vides
|
||||
modimpl_coefs_etuds_no_nan = modimpl_coefs_etuds_no_nan.astype(np.float)
|
||||
|
||||
etud_moy_mat = (modimpl_coefs_etuds_no_nan * sem_matrix_inscrits).sum(
|
||||
|
@ -272,9 +272,15 @@ def _build_etud_res(e, apo_data):
|
||||
r = {}
|
||||
for elt_code in apo_data.apo_elts:
|
||||
elt = apo_data.apo_elts[elt_code]
|
||||
try:
|
||||
# les colonnes de cet élément
|
||||
col_ids_type = [
|
||||
(ec["apoL_a01_code"], ec["Type R\xc3\xa9s."]) for ec in elt.cols
|
||||
] # les colonnes de cet élément
|
||||
]
|
||||
except KeyError as exc:
|
||||
raise ScoValueError(
|
||||
"Erreur: un élément sans 'Type R\xc3\xa9s.'. Vérifiez l'encodage de vos fichiers."
|
||||
) from exc
|
||||
r[elt_code] = {}
|
||||
for (col_id, type_res) in col_ids_type:
|
||||
r[elt_code][type_res] = e.cols[col_id]
|
||||
|
@ -32,11 +32,8 @@
|
||||
Voir sco_apogee_csv.py pour la structure du fichier Apogée.
|
||||
|
||||
Stockage: utilise sco_archive.py
|
||||
=> /opt/scodoc/var/scodoc/archives/apo_csv/<dept_id>/2016-1/2016-07-03-16-12-19/V3ASR.csv
|
||||
pour une maquette de l'année scolaire 2016, semestre 1, etape V3ASR
|
||||
|
||||
ou bien (à partir de ScoDoc 1678) :
|
||||
/opt/scodoc/var/scodoc/archives/apo_csv/<dept_id>/2016-1/2016-07-03-16-12-19/V3ASR!111.csv
|
||||
exemple:
|
||||
/opt/scodoc-data/archives/apo_csv/<dept_id>/2016-1/2016-07-03-16-12-19/V3ASR!111.csv
|
||||
pour une maquette de l'étape V3ASR version VDI 111.
|
||||
|
||||
La version VDI sera ignorée sauf si elle est indiquée dans l'étape du semestre.
|
||||
|
@ -473,6 +473,7 @@ sco_publish(
|
||||
"/edit_ue_set_code_apogee",
|
||||
sco_edit_ue.edit_ue_set_code_apogee,
|
||||
Permission.ScoChangeFormation,
|
||||
methods=["POST"],
|
||||
)
|
||||
sco_publish(
|
||||
"/formsemestre_edit_uecoefs",
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.2.7"
|
||||
SCOVERSION = "9.2.8"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
@ -204,7 +204,7 @@ class ScoFake(object):
|
||||
abbrev=None,
|
||||
ects=None,
|
||||
code_apogee=None,
|
||||
module_type=None,
|
||||
module_type=scu.ModuleType.STANDARD,
|
||||
) -> int:
|
||||
oid = sco_edit_module.do_module_create(locals())
|
||||
oids = sco_edit_module.module_list(args={"module_id": oid})
|
||||
|
@ -2,20 +2,15 @@
|
||||
Test calcul moyennes UE
|
||||
"""
|
||||
import numpy as np
|
||||
from numpy.lib.nanfunctions import _nanquantile_1d
|
||||
import pandas as pd
|
||||
from tests.unit import setup
|
||||
|
||||
from tests.unit import sco_fake_gen
|
||||
from app import db
|
||||
from app import models
|
||||
from app.comp import moy_mod
|
||||
from app.comp import moy_ue
|
||||
from app.comp import inscr_mod
|
||||
from app.models import FormSemestre, Evaluation, ModuleImplInscription
|
||||
from app.models.etudiants import Identite
|
||||
from app.scodoc import sco_codes_parcours, sco_saisie_notes
|
||||
from app.scodoc.sco_utils import NOTES_ATTENTE, NOTES_NEUTRALISE
|
||||
from app.scodoc import sco_saisie_notes
|
||||
from app.scodoc.sco_codes_parcours import UE_SPORT
|
||||
from app.scodoc.sco_utils import NOTES_NEUTRALISE
|
||||
from app.scodoc import sco_exceptions
|
||||
|
||||
|
||||
@ -69,9 +64,20 @@ def test_ue_moy(test_client):
|
||||
_ = sco_saisie_notes.notes_add(G.default_user, evaluation2.id, [(etudid, n2)])
|
||||
# Recalcul des moyennes
|
||||
sem_cube, _, _ = moy_ue.notes_sem_load_cube(formsemestre)
|
||||
# Masque de tous les modules _sauf_ les bonus (sport)
|
||||
modimpl_mask = [
|
||||
modimpl.module.ue.type != UE_SPORT
|
||||
for modimpl in formsemestre.modimpls_sorted
|
||||
]
|
||||
etuds = formsemestre.etuds.all()
|
||||
etud_moy_ue = moy_ue.compute_ue_moys_apc(
|
||||
sem_cube, etuds, modimpls, ues, modimpl_inscr_df, modimpl_coefs_df
|
||||
sem_cube,
|
||||
etuds,
|
||||
modimpls,
|
||||
ues,
|
||||
modimpl_inscr_df,
|
||||
modimpl_coefs_df,
|
||||
modimpl_mask,
|
||||
)
|
||||
return etud_moy_ue
|
||||
|
||||
@ -113,8 +119,11 @@ def test_ue_moy(test_client):
|
||||
# Recalcule les notes:
|
||||
sem_cube, _, _ = moy_ue.notes_sem_load_cube(formsemestre)
|
||||
etuds = formsemestre.etuds.all()
|
||||
modimpl_mask = [
|
||||
modimpl.module.ue.type != UE_SPORT for modimpl in formsemestre.modimpls_sorted
|
||||
]
|
||||
etud_moy_ue = moy_ue.compute_ue_moys_apc(
|
||||
sem_cube, etuds, modimpls, ues, modimpl_inscr_df, modimpl_coefs_df
|
||||
sem_cube, etuds, modimpls, ues, modimpl_inscr_df, modimpl_coefs_df, modimpl_mask
|
||||
)
|
||||
assert etud_moy_ue[ue1.id][etudid] == n1
|
||||
assert etud_moy_ue[ue2.id][etudid] == n1
|
||||
|
Loading…
Reference in New Issue
Block a user