forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
from flask_json import as_json
|
from flask_json import as_json
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.api import api_bp as bp, API_CLIENT_ERROR
|
from app.api import api_bp as bp, API_CLIENT_ERROR
|
||||||
from app.scodoc.sco_utils import json_error
|
from app.scodoc.sco_utils import json_error
|
||||||
from app.decorators import scodoc, permission_required
|
from app.decorators import scodoc, permission_required
|
||||||
@ -51,7 +52,7 @@ def absences(etudid: int = None):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
etud = Identite.query.get(etudid)
|
etud = db.session.get(Identite, etudid)
|
||||||
if etud is None:
|
if etud is None:
|
||||||
return json_error(404, message="etudiant inexistant")
|
return json_error(404, message="etudiant inexistant")
|
||||||
# Absences de l'étudiant
|
# Absences de l'étudiant
|
||||||
@ -96,7 +97,7 @@ def absences_just(etudid: int = None):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
etud = Identite.query.get(etudid)
|
etud = db.session.get(Identite, etudid)
|
||||||
if etud is None:
|
if etud is None:
|
||||||
return json_error(404, message="etudiant inexistant")
|
return json_error(404, message="etudiant inexistant")
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ from app.scodoc.sco_utils import json_error
|
|||||||
def decisions_jury(formsemestre_id: int):
|
def decisions_jury(formsemestre_id: int):
|
||||||
"""Décisions du jury des étudiants du formsemestre."""
|
"""Décisions du jury des étudiants du formsemestre."""
|
||||||
# APC, pair:
|
# APC, pair:
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
if formsemestre.formation.is_apc():
|
if formsemestre.formation.is_apc():
|
||||||
app.set_sco_dept(formsemestre.departement.acronym)
|
app.set_sco_dept(formsemestre.departement.acronym)
|
||||||
rows = jury_but_results.get_jury_but_results(formsemestre)
|
rows = jury_but_results.get_jury_but_results(formsemestre)
|
||||||
|
@ -35,7 +35,7 @@ def user_info(uid: int):
|
|||||||
"""
|
"""
|
||||||
Info sur un compte utilisateur scodoc
|
Info sur un compte utilisateur scodoc
|
||||||
"""
|
"""
|
||||||
user: User = User.query.get(uid)
|
user: User = db.session.get(User, uid)
|
||||||
if user is None:
|
if user is None:
|
||||||
return json_error(404, "user not found")
|
return json_error(404, "user not found")
|
||||||
if g.scodoc_dept:
|
if g.scodoc_dept:
|
||||||
|
@ -9,7 +9,7 @@ from flask import current_app, g, redirect, request, url_for
|
|||||||
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
|
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
|
||||||
import flask_login
|
import flask_login
|
||||||
|
|
||||||
from app import login
|
from app import db, login
|
||||||
from app.auth.models import User
|
from app.auth.models import User
|
||||||
from app.models.config import ScoDocSiteConfig
|
from app.models.config import ScoDocSiteConfig
|
||||||
from app.scodoc.sco_utils import json_error
|
from app.scodoc.sco_utils import json_error
|
||||||
@ -39,7 +39,7 @@ def basic_auth_error(status):
|
|||||||
@login.user_loader
|
@login.user_loader
|
||||||
def load_user(uid: str) -> User:
|
def load_user(uid: str) -> User:
|
||||||
"flask-login: accès à un utilisateur"
|
"flask-login: accès à un utilisateur"
|
||||||
return User.query.get(int(uid))
|
return db.session.get(User, int(uid))
|
||||||
|
|
||||||
|
|
||||||
@token_auth.verify_token
|
@token_auth.verify_token
|
||||||
|
@ -225,7 +225,7 @@ class User(UserMixin, db.Model):
|
|||||||
return None
|
return None
|
||||||
except (TypeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
return None
|
return None
|
||||||
return User.query.get(user_id)
|
return db.session.get(User, user_id)
|
||||||
|
|
||||||
def to_dict(self, include_email=True):
|
def to_dict(self, include_email=True):
|
||||||
"""l'utilisateur comme un dict, avec des champs supplémentaires"""
|
"""l'utilisateur comme un dict, avec des champs supplémentaires"""
|
||||||
@ -376,7 +376,9 @@ class User(UserMixin, db.Model):
|
|||||||
"""
|
"""
|
||||||
if not isinstance(role, Role):
|
if not isinstance(role, Role):
|
||||||
raise ScoValueError("add_role: rôle invalide")
|
raise ScoValueError("add_role: rôle invalide")
|
||||||
self.user_roles.append(UserRole(user=self, role=role, dept=dept))
|
user_role = UserRole(user=self, role=role, dept=dept)
|
||||||
|
db.session.add(user_role)
|
||||||
|
self.user_roles.append(user_role)
|
||||||
|
|
||||||
def add_roles(self, roles: "list[Role]", dept: str):
|
def add_roles(self, roles: "list[Role]", dept: str):
|
||||||
"""Add roles to this user.
|
"""Add roles to this user.
|
||||||
|
@ -12,6 +12,7 @@ import datetime
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from flask import g, has_request_context, url_for
|
from flask import g, has_request_context, url_for
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.comp.res_but import ResultatsSemestreBUT
|
from app.comp.res_but import ResultatsSemestreBUT
|
||||||
from app.models import Evaluation, FormSemestre, Identite
|
from app.models import Evaluation, FormSemestre, Identite
|
||||||
from app.models.groups import GroupDescr
|
from app.models.groups import GroupDescr
|
||||||
@ -158,7 +159,7 @@ class BulletinBUT:
|
|||||||
[etud.id]
|
[etud.id]
|
||||||
].iterrows():
|
].iterrows():
|
||||||
if codes_cursus.code_ue_validant(ue_capitalisee.code):
|
if codes_cursus.code_ue_validant(ue_capitalisee.code):
|
||||||
ue = UniteEns.query.get(ue_capitalisee.ue_id) # XXX cacher ?
|
ue = db.session.get(UniteEns, ue_capitalisee.ue_id) # XXX cacher ?
|
||||||
# déjà capitalisé ? montre la meilleure
|
# déjà capitalisé ? montre la meilleure
|
||||||
if ue.acronyme in d:
|
if ue.acronyme in d:
|
||||||
moy_cap = d[ue.acronyme]["moyenne_num"] or 0.0
|
moy_cap = d[ue.acronyme]["moyenne_num"] or 0.0
|
||||||
|
@ -15,12 +15,10 @@ Classe raccordant avec ScoDoc 7:
|
|||||||
"""
|
"""
|
||||||
import collections
|
import collections
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app import log
|
|
||||||
from app.comp.res_but import ResultatsSemestreBUT
|
from app.comp.res_but import ResultatsSemestreBUT
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
|
|
||||||
@ -252,7 +250,9 @@ class FormSemestreCursusBUT:
|
|||||||
parcour = None
|
parcour = None
|
||||||
else:
|
else:
|
||||||
if parcour_id not in self.parcours_by_id:
|
if parcour_id not in self.parcours_by_id:
|
||||||
self.parcours_by_id[parcour_id] = ApcParcours.query.get(parcour_id)
|
self.parcours_by_id[parcour_id] = db.session.get(
|
||||||
|
ApcParcours, parcour_id
|
||||||
|
)
|
||||||
parcour = self.parcours_by_id[parcour_id]
|
parcour = self.parcours_by_id[parcour_id]
|
||||||
|
|
||||||
return self.get_niveaux_parcours_by_annee(parcour)
|
return self.get_niveaux_parcours_by_annee(parcour)
|
||||||
|
@ -134,7 +134,7 @@ class ModuleImplResults:
|
|||||||
manque des notes) ssi il y a des étudiants inscrits au semestre et au module
|
manque des notes) ssi il y a des étudiants inscrits au semestre et au module
|
||||||
qui ont des notes ATT.
|
qui ont des notes ATT.
|
||||||
"""
|
"""
|
||||||
moduleimpl = ModuleImpl.query.get(self.moduleimpl_id)
|
moduleimpl = db.session.get(ModuleImpl, self.moduleimpl_id)
|
||||||
self.etudids = self._etudids()
|
self.etudids = self._etudids()
|
||||||
|
|
||||||
# --- Calcul nombre d'inscrits pour déterminer les évaluations "completes":
|
# --- Calcul nombre d'inscrits pour déterminer les évaluations "completes":
|
||||||
@ -225,8 +225,8 @@ class ModuleImplResults:
|
|||||||
"""
|
"""
|
||||||
return [
|
return [
|
||||||
inscr.etudid
|
inscr.etudid
|
||||||
for inscr in ModuleImpl.query.get(
|
for inscr in db.session.get(
|
||||||
self.moduleimpl_id
|
ModuleImpl, self.moduleimpl_id
|
||||||
).formsemestre.inscriptions
|
).formsemestre.inscriptions
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ class ModuleImplResultsAPC(ModuleImplResults):
|
|||||||
ou NaN si les évaluations (dans lesquelles l'étudiant a des notes)
|
ou NaN si les évaluations (dans lesquelles l'étudiant a des notes)
|
||||||
ne donnent pas de coef vers cette UE.
|
ne donnent pas de coef vers cette UE.
|
||||||
"""
|
"""
|
||||||
modimpl = ModuleImpl.query.get(self.moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, self.moduleimpl_id)
|
||||||
nb_etuds, nb_evals = self.evals_notes.shape
|
nb_etuds, nb_evals = self.evals_notes.shape
|
||||||
nb_ues = evals_poids_df.shape[1]
|
nb_ues = evals_poids_df.shape[1]
|
||||||
if evals_poids_df.shape[0] != nb_evals:
|
if evals_poids_df.shape[0] != nb_evals:
|
||||||
@ -419,7 +419,7 @@ def load_evaluations_poids(moduleimpl_id: int) -> tuple[pd.DataFrame, list]:
|
|||||||
|
|
||||||
Résultat: (evals_poids, liste de UEs du semestre sauf le sport)
|
Résultat: (evals_poids, liste de UEs du semestre sauf le sport)
|
||||||
"""
|
"""
|
||||||
modimpl: ModuleImpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl: ModuleImpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
evaluations = Evaluation.query.filter_by(moduleimpl_id=moduleimpl_id).all()
|
evaluations = Evaluation.query.filter_by(moduleimpl_id=moduleimpl_id).all()
|
||||||
ues = modimpl.formsemestre.get_ues(with_sport=False)
|
ues = modimpl.formsemestre.get_ues(with_sport=False)
|
||||||
ue_ids = [ue.id for ue in ues]
|
ue_ids = [ue.id for ue in ues]
|
||||||
@ -498,7 +498,7 @@ class ModuleImplResultsClassic(ModuleImplResults):
|
|||||||
ou NaN si les évaluations (dans lesquelles l'étudiant a des notes)
|
ou NaN si les évaluations (dans lesquelles l'étudiant a des notes)
|
||||||
ne donnent pas de coef.
|
ne donnent pas de coef.
|
||||||
"""
|
"""
|
||||||
modimpl = ModuleImpl.query.get(self.moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, self.moduleimpl_id)
|
||||||
nb_etuds, nb_evals = self.evals_notes.shape
|
nb_etuds, nb_evals = self.evals_notes.shape
|
||||||
if nb_etuds == 0:
|
if nb_etuds == 0:
|
||||||
return pd.Series()
|
return pd.Series()
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from flask import flash, g, Markup, url_for
|
from flask import flash, g, url_for
|
||||||
|
from markupsafe import Markup
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.models.formations import Formation
|
from app.models.formations import Formation
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +81,7 @@ def compute_sem_moys_apc_using_ects(
|
|||||||
moy_gen = (etud_moy_ue_df * ects).sum(axis=1) / ects.sum(axis=1)
|
moy_gen = (etud_moy_ue_df * ects).sum(axis=1) / ects.sum(axis=1)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
if None in ects:
|
if None in ects:
|
||||||
formation = Formation.query.get(formation_id)
|
formation = db.session.get(Formation, formation_id)
|
||||||
flash(
|
flash(
|
||||||
Markup(
|
Markup(
|
||||||
f"""Calcul moyenne générale impossible: ECTS des UE manquants !<br>
|
f"""Calcul moyenne générale impossible: ECTS des UE manquants !<br>
|
||||||
@ -92,7 +95,7 @@ def compute_sem_moys_apc_using_ects(
|
|||||||
return moy_gen
|
return moy_gen
|
||||||
|
|
||||||
|
|
||||||
def comp_ranks_series(notes: pd.Series) -> (pd.Series, pd.Series):
|
def comp_ranks_series(notes: pd.Series) -> tuple[pd.Series, pd.Series]:
|
||||||
"""Calcul rangs à partir d'une séries ("vecteur") de notes (index etudid, valeur
|
"""Calcul rangs à partir d'une séries ("vecteur") de notes (index etudid, valeur
|
||||||
numérique) en tenant compte des ex-aequos.
|
numérique) en tenant compte des ex-aequos.
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from app import db, log
|
|||||||
from app.comp import moy_ue, moy_sem, inscr_mod
|
from app.comp import moy_ue, moy_sem, inscr_mod
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.comp.bonus_spo import BonusSport
|
from app.comp.bonus_spo import BonusSport
|
||||||
from app.models import Formation, FormSemestreInscription, ScoDocSiteConfig
|
from app.models import FormSemestreInscription, ScoDocSiteConfig
|
||||||
from app.models.moduleimpls import ModuleImpl
|
from app.models.moduleimpls import ModuleImpl
|
||||||
from app.models.but_refcomp import ApcParcours, ApcNiveau
|
from app.models.but_refcomp import ApcParcours, ApcNiveau
|
||||||
from app.models.ues import DispenseUE, UniteEns
|
from app.models.ues import DispenseUE, UniteEns
|
||||||
@ -291,7 +291,7 @@ class ResultatsSemestreBUT(NotesTableCompat):
|
|||||||
if parcour_id is None:
|
if parcour_id is None:
|
||||||
ues_ids = {ue.id for ue in self.ues if ue.type != UE_SPORT}
|
ues_ids = {ue.id for ue in self.ues if ue.type != UE_SPORT}
|
||||||
else:
|
else:
|
||||||
parcour: ApcParcours = ApcParcours.query.get(parcour_id)
|
parcour: ApcParcours = db.session.get(ApcParcours, parcour_id)
|
||||||
annee = (self.formsemestre.semestre_id + 1) // 2
|
annee = (self.formsemestre.semestre_id + 1) // 2
|
||||||
niveaux = ApcNiveau.niveaux_annee_de_parcours(parcour, annee, ref_comp)
|
niveaux = ApcNiveau.niveaux_annee_de_parcours(parcour, annee, ref_comp)
|
||||||
# Les UEs du formsemestre associées à ces niveaux:
|
# Les UEs du formsemestre associées à ces niveaux:
|
||||||
|
@ -17,6 +17,7 @@ import pandas as pd
|
|||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_cache import ResultatsCache
|
from app.comp.res_cache import ResultatsCache
|
||||||
from app.comp.jury import ValidationsSemestre
|
from app.comp.jury import ValidationsSemestre
|
||||||
@ -31,6 +32,7 @@ from app.scodoc.codes_cursus import UE_SPORT
|
|||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
|
|
||||||
|
|
||||||
# Il faut bien distinguer
|
# Il faut bien distinguer
|
||||||
# - ce qui est caché de façon persistente (via redis):
|
# - ce qui est caché de façon persistente (via redis):
|
||||||
# ce sont les attributs listés dans `_cached_attrs`
|
# ce sont les attributs listés dans `_cached_attrs`
|
||||||
@ -137,7 +139,7 @@ class ResultatsSemestre(ResultatsCache):
|
|||||||
def etud_ues(self, etudid: int) -> Generator[UniteEns]:
|
def etud_ues(self, etudid: int) -> Generator[UniteEns]:
|
||||||
"""Liste des UE auxquelles l'étudiant est inscrit
|
"""Liste des UE auxquelles l'étudiant est inscrit
|
||||||
(sans bonus, en BUT prend en compte le parcours de l'étudiant)."""
|
(sans bonus, en BUT prend en compte le parcours de l'étudiant)."""
|
||||||
return (UniteEns.query.get(ue_id) for ue_id in self.etud_ues_ids(etudid))
|
return (db.session.get(UniteEns, ue_id) for ue_id in self.etud_ues_ids(etudid))
|
||||||
|
|
||||||
def etud_ects_tot_sem(self, etudid: int) -> float:
|
def etud_ects_tot_sem(self, etudid: int) -> float:
|
||||||
"""Le total des ECTS associées à ce semestre (que l'étudiant peut ou non valider)"""
|
"""Le total des ECTS associées à ce semestre (que l'étudiant peut ou non valider)"""
|
||||||
@ -351,7 +353,7 @@ class ResultatsSemestre(ResultatsCache):
|
|||||||
"""L'état de l'UE pour cet étudiant.
|
"""L'état de l'UE pour cet étudiant.
|
||||||
Result: dict, ou None si l'UE n'est pas dans ce semestre.
|
Result: dict, ou None si l'UE n'est pas dans ce semestre.
|
||||||
"""
|
"""
|
||||||
ue: UniteEns = UniteEns.query.get(ue_id)
|
ue: UniteEns = db.session.get(UniteEns, ue_id)
|
||||||
ue_dict = ue.to_dict()
|
ue_dict = ue.to_dict()
|
||||||
|
|
||||||
if ue.type == UE_SPORT:
|
if ue.type == UE_SPORT:
|
||||||
@ -401,7 +403,7 @@ class ResultatsSemestre(ResultatsCache):
|
|||||||
if (not coef_ue) and is_capitalized: # étudiant non inscrit dans l'UE courante
|
if (not coef_ue) and is_capitalized: # étudiant non inscrit dans l'UE courante
|
||||||
if self.is_apc:
|
if self.is_apc:
|
||||||
# Coefs de l'UE capitalisée en formation APC: donné par ses ECTS
|
# Coefs de l'UE capitalisée en formation APC: donné par ses ECTS
|
||||||
ue_capitalized = UniteEns.query.get(ue_cap["ue_id"])
|
ue_capitalized = db.session.get(UniteEns, ue_cap["ue_id"])
|
||||||
coef_ue = ue_capitalized.ects
|
coef_ue = ue_capitalized.ects
|
||||||
if coef_ue is None:
|
if coef_ue is None:
|
||||||
orig_sem = FormSemestre.get_formsemestre(ue_cap["formsemestre_id"])
|
orig_sem = FormSemestre.get_formsemestre(ue_cap["formsemestre_id"])
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from flask import flash, g, Markup, url_for
|
from flask import flash, g, url_for
|
||||||
|
from markupsafe import Markup
|
||||||
|
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.comp import moy_sem
|
from app.comp import moy_sem
|
||||||
from app.comp.aux_stats import StatsMoyenne
|
from app.comp.aux_stats import StatsMoyenne
|
||||||
from app.comp.res_common import ResultatsSemestre
|
from app.comp.res_common import ResultatsSemestre
|
||||||
@ -393,7 +394,7 @@ class NotesTableCompat(ResultatsSemestre):
|
|||||||
de ce module.
|
de ce module.
|
||||||
Évaluation "complete" ssi toutes notes saisies ou en attente.
|
Évaluation "complete" ssi toutes notes saisies ou en attente.
|
||||||
"""
|
"""
|
||||||
modimpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
modimpl_results = self.modimpls_results.get(moduleimpl_id)
|
modimpl_results = self.modimpls_results.get(moduleimpl_id)
|
||||||
if not modimpl_results:
|
if not modimpl_results:
|
||||||
return [] # safeguard
|
return [] # safeguard
|
||||||
|
@ -36,7 +36,6 @@ from sqlalchemy import text
|
|||||||
from wtforms import (
|
from wtforms import (
|
||||||
BooleanField,
|
BooleanField,
|
||||||
DateField,
|
DateField,
|
||||||
DecimalField,
|
|
||||||
FieldList,
|
FieldList,
|
||||||
FormField,
|
FormField,
|
||||||
HiddenField,
|
HiddenField,
|
||||||
@ -56,6 +55,9 @@ from wtforms.validators import (
|
|||||||
)
|
)
|
||||||
from wtforms.widgets import ListWidget, CheckboxInput
|
from wtforms.widgets import ListWidget, CheckboxInput
|
||||||
|
|
||||||
|
from app import db
|
||||||
|
from app.auth.models import User
|
||||||
|
from app.entreprises import SIRET_PROVISOIRE_START
|
||||||
from app.entreprises.models import (
|
from app.entreprises.models import (
|
||||||
Entreprise,
|
Entreprise,
|
||||||
EntrepriseCorrespondant,
|
EntrepriseCorrespondant,
|
||||||
@ -63,9 +65,6 @@ from app.entreprises.models import (
|
|||||||
EntrepriseSite,
|
EntrepriseSite,
|
||||||
EntrepriseTaxeApprentissage,
|
EntrepriseTaxeApprentissage,
|
||||||
)
|
)
|
||||||
from app import db
|
|
||||||
from app.auth.models import User
|
|
||||||
from app.entreprises import SIRET_PROVISOIRE_START
|
|
||||||
from app.models import Identite, Departement
|
from app.models import Identite, Departement
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
|
|
||||||
@ -651,7 +650,7 @@ class StageApprentissageCreationForm(FlaskForm):
|
|||||||
def validate_etudid(self, field):
|
def validate_etudid(self, field):
|
||||||
"L'etudid doit avoit été placé par le JS"
|
"L'etudid doit avoit été placé par le JS"
|
||||||
etudid = int(field.data) if field.data else None
|
etudid = int(field.data) if field.data else None
|
||||||
etudiant = Identite.query.get(etudid) if etudid is not None else None
|
etudiant = db.session.get(Identite, etudid) if etudid is not None else None
|
||||||
if etudiant is None:
|
if etudiant is None:
|
||||||
raise ValidationError("Étudiant introuvable (sélectionnez dans la liste)")
|
raise ValidationError("Étudiant introuvable (sélectionnez dans la liste)")
|
||||||
|
|
||||||
|
@ -190,8 +190,10 @@ class Evaluation(db.Model):
|
|||||||
"""
|
"""
|
||||||
L = []
|
L = []
|
||||||
for ue_id, poids in ue_poids_dict.items():
|
for ue_id, poids in ue_poids_dict.items():
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
L.append(EvaluationUEPoids(evaluation=self, ue=ue, poids=poids))
|
ue_poids = EvaluationUEPoids(evaluation=self, ue=ue, poids=poids)
|
||||||
|
L.append(ue_poids)
|
||||||
|
db.session.add(ue_poids)
|
||||||
self.ue_poids = L # backref # pylint:disable=attribute-defined-outside-init
|
self.ue_poids = L # backref # pylint:disable=attribute-defined-outside-init
|
||||||
self.moduleimpl.invalidate_evaluations_poids() # inval cache
|
self.moduleimpl.invalidate_evaluations_poids() # inval cache
|
||||||
|
|
||||||
@ -338,7 +340,7 @@ def check_evaluation_args(args):
|
|||||||
jour = args.get("jour", None)
|
jour = args.get("jour", None)
|
||||||
args["jour"] = jour
|
args["jour"] = jour
|
||||||
if jour:
|
if jour:
|
||||||
modimpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
formsemestre = modimpl.formsemestre
|
formsemestre = modimpl.formsemestre
|
||||||
y, m, d = [int(x) for x in ndb.DateDMYtoISO(jour).split("-")]
|
y, m, d = [int(x) for x in ndb.DateDMYtoISO(jour).split("-")]
|
||||||
jour = datetime.date(y, m, d)
|
jour = datetime.date(y, m, d)
|
||||||
|
@ -187,14 +187,14 @@ class ScolarNews(db.Model):
|
|||||||
elif self.type == self.NEWS_NOTE:
|
elif self.type == self.NEWS_NOTE:
|
||||||
moduleimpl_id = self.object
|
moduleimpl_id = self.object
|
||||||
if moduleimpl_id:
|
if moduleimpl_id:
|
||||||
modimpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
if modimpl is None:
|
if modimpl is None:
|
||||||
return None # module does not exists anymore
|
return None # module does not exists anymore
|
||||||
formsemestre_id = modimpl.formsemestre_id
|
formsemestre_id = modimpl.formsemestre_id
|
||||||
|
|
||||||
if not formsemestre_id:
|
if not formsemestre_id:
|
||||||
return None
|
return None
|
||||||
formsemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
return formsemestre
|
return formsemestre
|
||||||
|
|
||||||
def notify_by_mail(self):
|
def notify_by_mail(self):
|
||||||
|
@ -382,7 +382,7 @@ class FormSemestre(db.Model):
|
|||||||
),
|
),
|
||||||
{"formsemestre_id": self.id, "parcours_id": parcours.id},
|
{"formsemestre_id": self.id, "parcours_id": parcours.id},
|
||||||
)
|
)
|
||||||
return [ModuleImpl.query.get(modimpl_id) for modimpl_id in cursor]
|
return [db.session.get(ModuleImpl, modimpl_id) for modimpl_id in cursor]
|
||||||
|
|
||||||
def can_be_edited_by(self, user):
|
def can_be_edited_by(self, user):
|
||||||
"""Vrai si user peut modifier ce semestre (est chef ou l'un des responsables)"""
|
"""Vrai si user peut modifier ce semestre (est chef ou l'un des responsables)"""
|
||||||
|
@ -149,7 +149,7 @@ class Partition(db.Model):
|
|||||||
if group.id == existing_group_id:
|
if group.id == existing_group_id:
|
||||||
return False
|
return False
|
||||||
# Fait le changement avec l'ORM sinon risque élevé de blocage
|
# Fait le changement avec l'ORM sinon risque élevé de blocage
|
||||||
existing_group = GroupDescr.query.get(existing_group_id)
|
existing_group = db.session.get(GroupDescr, existing_group_id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
group.etuds.append(etud)
|
group.etuds.append(etud)
|
||||||
existing_group.etuds.remove(etud)
|
existing_group.etuds.remove(etud)
|
||||||
|
@ -198,7 +198,7 @@ class Module(db.Model):
|
|||||||
else:
|
else:
|
||||||
# crée nouveau coef:
|
# crée nouveau coef:
|
||||||
if coef != 0.0:
|
if coef != 0.0:
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
ue_coef = ModuleUECoef(module=self, ue=ue, coef=coef)
|
ue_coef = ModuleUECoef(module=self, ue=ue, coef=coef)
|
||||||
db.session.add(ue_coef)
|
db.session.add(ue_coef)
|
||||||
self.ue_coefs.append(ue_coef)
|
self.ue_coefs.append(ue_coef)
|
||||||
@ -232,7 +232,7 @@ class Module(db.Model):
|
|||||||
"delete_ue_coef: locked formation, ignoring request"
|
"delete_ue_coef: locked formation, ignoring request"
|
||||||
)
|
)
|
||||||
raise ScoValueError("Formation verrouillée")
|
raise ScoValueError("Formation verrouillée")
|
||||||
ue_coef = ModuleUECoef.query.get((self.id, ue.id))
|
ue_coef = db.session.get(ModuleUECoef, (self.id, ue.id))
|
||||||
if ue_coef:
|
if ue_coef:
|
||||||
db.session.delete(ue_coef)
|
db.session.delete(ue_coef)
|
||||||
self.formation.invalidate_module_coefs()
|
self.formation.invalidate_module_coefs()
|
||||||
|
@ -57,7 +57,7 @@ class NotesNotes(db.Model):
|
|||||||
from app.models.evaluations import Evaluation
|
from app.models.evaluations import Evaluation
|
||||||
|
|
||||||
return f"""<{self.__class__.__name__} {self.id} etudid={self.etudid} v={self.value} {self.date.isoformat()
|
return f"""<{self.__class__.__name__} {self.id} etudid={self.etudid} v={self.value} {self.date.isoformat()
|
||||||
} {Evaluation.query.get(self.evaluation_id) if self.evaluation_id else "X" }>"""
|
} {db.session.get(Evaluation, self.evaluation_id) if self.evaluation_id else "X" }>"""
|
||||||
|
|
||||||
|
|
||||||
class NotesNotesLog(db.Model):
|
class NotesNotesLog(db.Model):
|
||||||
|
@ -36,7 +36,7 @@ Created on Fri Sep 9 09:15:05 2016
|
|||||||
@author: barasc
|
@author: barasc
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.models import FormSemestre
|
from app.models import FormSemestre
|
||||||
@ -487,7 +487,7 @@ def comp_coeff_pond(coeffs, ponderations):
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def get_moduleimpl(modimpl_id) -> dict:
|
def get_moduleimpl(modimpl_id) -> dict:
|
||||||
"""Renvoie l'objet modimpl dont l'id est modimpl_id"""
|
"""Renvoie l'objet modimpl dont l'id est modimpl_id"""
|
||||||
modimpl = ModuleImpl.query.get(modimpl_id)
|
modimpl = db.session.get(ModuleImpl, modimpl_id)
|
||||||
if modimpl:
|
if modimpl:
|
||||||
return modimpl
|
return modimpl
|
||||||
if SemestreTag.DEBUG:
|
if SemestreTag.DEBUG:
|
||||||
|
@ -38,7 +38,7 @@ from flask import flash, render_template, url_for
|
|||||||
from flask_json import json_response
|
from flask_json import json_response
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app import email
|
from app import db, email
|
||||||
from app import log
|
from app import log
|
||||||
from app.scodoc.sco_utils import json_error
|
from app.scodoc.sco_utils import json_error
|
||||||
from app.but import bulletin_but
|
from app.but import bulletin_but
|
||||||
@ -354,7 +354,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
"modules_capitalized"
|
"modules_capitalized"
|
||||||
] = [] # modules de l'UE capitalisée (liste vide si pas capitalisée)
|
] = [] # modules de l'UE capitalisée (liste vide si pas capitalisée)
|
||||||
if ue_status["is_capitalized"] and ue_status["formsemestre_id"] is not None:
|
if ue_status["is_capitalized"] and ue_status["formsemestre_id"] is not None:
|
||||||
sem_origin = FormSemestre.query.get(ue_status["formsemestre_id"])
|
sem_origin = db.session.get(FormSemestre, ue_status["formsemestre_id"])
|
||||||
u[
|
u[
|
||||||
"ue_descr_txt"
|
"ue_descr_txt"
|
||||||
] = f'capitalisée le {ndb.DateISOtoDMY(ue_status["event_date"])}'
|
] = f'capitalisée le {ndb.DateISOtoDMY(ue_status["event_date"])}'
|
||||||
@ -369,7 +369,9 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
)
|
)
|
||||||
if ue_status["moy"] != "NA":
|
if ue_status["moy"] != "NA":
|
||||||
# détail des modules de l'UE capitalisée
|
# détail des modules de l'UE capitalisée
|
||||||
formsemestre_cap = FormSemestre.query.get(ue_status["formsemestre_id"])
|
formsemestre_cap = db.session.get(
|
||||||
|
FormSemestre, ue_status["formsemestre_id"]
|
||||||
|
)
|
||||||
nt_cap: NotesTableCompat = res_sem.load_formsemestre_results(
|
nt_cap: NotesTableCompat = res_sem.load_formsemestre_results(
|
||||||
formsemestre_cap
|
formsemestre_cap
|
||||||
)
|
)
|
||||||
@ -749,7 +751,7 @@ def etud_descr_situation_semestre(
|
|||||||
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
|
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
|
||||||
parcour_id = res.etuds_parcour_id[etudid]
|
parcour_id = res.etuds_parcour_id[etudid]
|
||||||
parcour: ApcParcours = (
|
parcour: ApcParcours = (
|
||||||
ApcParcours.query.get(parcour_id) if parcour_id is not None else None
|
db.session.get(ApcParcours, parcour_id) if parcour_id is not None else None
|
||||||
)
|
)
|
||||||
if parcour:
|
if parcour:
|
||||||
infos["parcours_titre"] = parcour.libelle or ""
|
infos["parcours_titre"] = parcour.libelle or ""
|
||||||
@ -928,7 +930,7 @@ def formsemestre_bulletinetud(
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
format = format or "html"
|
format = format or "html"
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
if not formsemestre:
|
if not formsemestre:
|
||||||
raise ScoValueError(f"semestre {formsemestre_id} inconnu !")
|
raise ScoValueError(f"semestre {formsemestre_id} inconnu !")
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import json
|
|||||||
|
|
||||||
from flask import abort
|
from flask import abort
|
||||||
|
|
||||||
from app import ScoDocJSONEncoder
|
from app import db, ScoDocJSONEncoder
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.models import but_validations
|
from app.models import but_validations
|
||||||
@ -245,7 +245,7 @@ def formsemestre_bulletinetud_published_dict(
|
|||||||
u["module"] = []
|
u["module"] = []
|
||||||
# Structure UE/Matière/Module
|
# Structure UE/Matière/Module
|
||||||
# Recodé en 2022
|
# Recodé en 2022
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
u["matiere"] = [
|
u["matiere"] = [
|
||||||
{
|
{
|
||||||
"matiere_id": mat.id,
|
"matiere_id": mat.id,
|
||||||
|
@ -54,7 +54,7 @@ import traceback
|
|||||||
from flask import g
|
from flask import g
|
||||||
|
|
||||||
import app
|
import app
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.scodoc.sco_exceptions import ScoException
|
from app.scodoc.sco_exceptions import ScoException
|
||||||
@ -266,7 +266,7 @@ def invalidate_formsemestre( # was inval_cache(formsemestre_id=None, pdfonly=Fa
|
|||||||
# appel via API ou tests sans dept:
|
# appel via API ou tests sans dept:
|
||||||
formsemestre = None
|
formsemestre = None
|
||||||
if formsemestre_id:
|
if formsemestre_id:
|
||||||
formsemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
if formsemestre is None:
|
if formsemestre is None:
|
||||||
raise ScoException("invalidate_formsemestre: departement must be set")
|
raise ScoException("invalidate_formsemestre: departement must be set")
|
||||||
app.set_sco_dept(formsemestre.departement.acronym, open_cnx=False)
|
app.set_sco_dept(formsemestre.departement.acronym, open_cnx=False)
|
||||||
|
@ -103,7 +103,7 @@ def do_formation_delete(formation_id):
|
|||||||
"""delete a formation (and all its UE, matieres, modules)
|
"""delete a formation (and all its UE, matieres, modules)
|
||||||
Warning: delete all ues, will ask if there are validations !
|
Warning: delete all ues, will ask if there are validations !
|
||||||
"""
|
"""
|
||||||
formation: Formation = Formation.query.get(formation_id)
|
formation: Formation = db.session.get(Formation, formation_id)
|
||||||
if formation is None:
|
if formation is None:
|
||||||
return
|
return
|
||||||
acronyme = formation.acronyme
|
acronyme = formation.acronyme
|
||||||
|
@ -30,14 +30,13 @@
|
|||||||
"""
|
"""
|
||||||
import flask
|
import flask
|
||||||
from flask import g, url_for, request
|
from flask import g, url_for, request
|
||||||
from app.models.events import ScolarNews
|
|
||||||
from app.models.formations import Matiere
|
from app import db, log
|
||||||
from app.models.ues import UniteEns
|
from app.models import Formation, Matiere, UniteEns, ScolarNews
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app import log
|
|
||||||
from app.models import Formation
|
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
from app.scodoc.sco_exceptions import (
|
from app.scodoc.sco_exceptions import (
|
||||||
ScoValueError,
|
ScoValueError,
|
||||||
@ -74,7 +73,7 @@ def do_matiere_edit(*args, **kw):
|
|||||||
# edit
|
# edit
|
||||||
_matiereEditor.edit(cnx, *args, **kw)
|
_matiereEditor.edit(cnx, *args, **kw)
|
||||||
formation_id = sco_edit_ue.ue_list({"ue_id": mat["ue_id"]})[0]["formation_id"]
|
formation_id = sco_edit_ue.ue_list({"ue_id": mat["ue_id"]})[0]["formation_id"]
|
||||||
Formation.query.get(formation_id).invalidate_cached_sems()
|
db.session.get(Formation, formation_id).invalidate_cached_sems()
|
||||||
|
|
||||||
|
|
||||||
def do_matiere_create(args):
|
def do_matiere_create(args):
|
||||||
@ -89,7 +88,7 @@ def do_matiere_create(args):
|
|||||||
r = _matiereEditor.create(cnx, args)
|
r = _matiereEditor.create(cnx, args)
|
||||||
|
|
||||||
# news
|
# news
|
||||||
formation = Formation.query.get(ue["formation_id"])
|
formation = db.session.get(Formation, ue["formation_id"])
|
||||||
ScolarNews.add(
|
ScolarNews.add(
|
||||||
typ=ScolarNews.NEWS_FORM,
|
typ=ScolarNews.NEWS_FORM,
|
||||||
obj=ue["formation_id"],
|
obj=ue["formation_id"],
|
||||||
@ -201,7 +200,7 @@ def do_matiere_delete(oid):
|
|||||||
_matiereEditor.delete(cnx, oid)
|
_matiereEditor.delete(cnx, oid)
|
||||||
|
|
||||||
# news
|
# news
|
||||||
formation = Formation.query.get(ue["formation_id"])
|
formation = db.session.get(Formation, ue["formation_id"])
|
||||||
ScolarNews.add(
|
ScolarNews.add(
|
||||||
typ=ScolarNews.NEWS_FORM,
|
typ=ScolarNews.NEWS_FORM,
|
||||||
obj=ue["formation_id"],
|
obj=ue["formation_id"],
|
||||||
|
@ -98,10 +98,10 @@ def module_list(*args, **kw):
|
|||||||
|
|
||||||
def do_module_create(args) -> int:
|
def do_module_create(args) -> int:
|
||||||
"Create a module. Returns id of new object."
|
"Create a module. Returns id of new object."
|
||||||
formation = Formation.query.get(args["formation_id"])
|
formation = db.session.get(Formation, args["formation_id"])
|
||||||
# refuse de créer un module APC avec semestres incohérents:
|
# refuse de créer un module APC avec semestres incohérents:
|
||||||
if formation.is_apc():
|
if formation.is_apc():
|
||||||
ue = UniteEns.query.get(args["ue_id"])
|
ue = db.session.get(UniteEns, args["ue_id"])
|
||||||
if int(args.get("semestre_id", 0)) != ue.semestre_idx:
|
if int(args.get("semestre_id", 0)) != ue.semestre_idx:
|
||||||
raise ScoValueError("Formation incompatible: contacter le support ScoDoc")
|
raise ScoValueError("Formation incompatible: contacter le support ScoDoc")
|
||||||
# create
|
# create
|
||||||
@ -248,7 +248,7 @@ def do_module_edit(vals: dict) -> None:
|
|||||||
# edit
|
# edit
|
||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
_moduleEditor.edit(cnx, vals)
|
_moduleEditor.edit(cnx, vals)
|
||||||
Formation.query.get(mod["formation_id"]).invalidate_cached_sems()
|
db.session.get(Formation, mod["formation_id"]).invalidate_cached_sems()
|
||||||
|
|
||||||
|
|
||||||
def check_module_code_unicity(code, field, formation_id, module_id=None):
|
def check_module_code_unicity(code, field, formation_id, module_id=None):
|
||||||
@ -805,7 +805,7 @@ def module_edit(
|
|||||||
if create:
|
if create:
|
||||||
if not matiere_id:
|
if not matiere_id:
|
||||||
# formulaire avec choix UE de rattachement
|
# formulaire avec choix UE de rattachement
|
||||||
ue = UniteEns.query.get(tf[2]["ue_id"])
|
ue = db.session.get(UniteEns, tf[2]["ue_id"])
|
||||||
if ue is None:
|
if ue is None:
|
||||||
raise ValueError("UE invalide")
|
raise ValueError("UE invalide")
|
||||||
matiere = ue.matieres.first()
|
matiere = ue.matieres.first()
|
||||||
@ -819,7 +819,7 @@ def module_edit(
|
|||||||
|
|
||||||
tf[2]["semestre_id"] = ue.semestre_idx
|
tf[2]["semestre_id"] = ue.semestre_idx
|
||||||
module_id = do_module_create(tf[2])
|
module_id = do_module_create(tf[2])
|
||||||
module = Module.query.get(module_id)
|
module = db.session.get(Module, module_id)
|
||||||
else: # EDITION MODULE
|
else: # EDITION MODULE
|
||||||
# l'UE de rattachement peut changer
|
# l'UE de rattachement peut changer
|
||||||
tf[2]["ue_id"], tf[2]["matiere_id"] = tf[2]["ue_matiere_id"].split("!")
|
tf[2]["ue_id"], tf[2]["matiere_id"] = tf[2]["ue_matiere_id"].split("!")
|
||||||
@ -837,7 +837,7 @@ def module_edit(
|
|||||||
)
|
)
|
||||||
# En APC, force le semestre égal à celui de l'UE
|
# En APC, force le semestre égal à celui de l'UE
|
||||||
if is_apc:
|
if is_apc:
|
||||||
selected_ue = UniteEns.query.get(tf[2]["ue_id"])
|
selected_ue = db.session.get(UniteEns, tf[2]["ue_id"])
|
||||||
if selected_ue is None:
|
if selected_ue is None:
|
||||||
raise ValueError("UE invalide")
|
raise ValueError("UE invalide")
|
||||||
tf[2]["semestre_id"] = selected_ue.semestre_idx
|
tf[2]["semestre_id"] = selected_ue.semestre_idx
|
||||||
@ -853,13 +853,13 @@ def module_edit(
|
|||||||
module.parcours = formation.referentiel_competence.parcours.all()
|
module.parcours = formation.referentiel_competence.parcours.all()
|
||||||
else:
|
else:
|
||||||
module.parcours = [
|
module.parcours = [
|
||||||
ApcParcours.query.get(int(parcour_id_str))
|
db.session.get(ApcParcours, int(parcour_id_str))
|
||||||
for parcour_id_str in tf[2]["parcours"]
|
for parcour_id_str in tf[2]["parcours"]
|
||||||
]
|
]
|
||||||
# Modifie les AC
|
# Modifie les AC
|
||||||
if "app_critiques" in tf[2]:
|
if "app_critiques" in tf[2]:
|
||||||
module.app_critiques = [
|
module.app_critiques = [
|
||||||
ApcAppCritique.query.get(int(ac_id_str))
|
db.session.get(ApcAppCritique, int(ac_id_str))
|
||||||
for ac_id_str in tf[2]["app_critiques"]
|
for ac_id_str in tf[2]["app_critiques"]
|
||||||
]
|
]
|
||||||
db.session.add(module)
|
db.session.add(module)
|
||||||
|
@ -36,8 +36,7 @@ from flask import flash, render_template, url_for
|
|||||||
from flask import g, request
|
from flask import g, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app import db
|
from app import db, log
|
||||||
from app import log
|
|
||||||
from app.but import apc_edit_ue
|
from app.but import apc_edit_ue
|
||||||
from app.models import APO_CODE_STR_LEN, SHORT_STR_LEN
|
from app.models import APO_CODE_STR_LEN, SHORT_STR_LEN
|
||||||
from app.models import (
|
from app.models import (
|
||||||
@ -137,10 +136,10 @@ def do_ue_create(args):
|
|||||||
ue_id = _ueEditor.create(cnx, args)
|
ue_id = _ueEditor.create(cnx, args)
|
||||||
log(f"do_ue_create: created {ue_id} with {args}")
|
log(f"do_ue_create: created {ue_id} with {args}")
|
||||||
|
|
||||||
formation: Formation = Formation.query.get(args["formation_id"])
|
formation: Formation = db.session.get(Formation, args["formation_id"])
|
||||||
formation.invalidate_module_coefs()
|
formation.invalidate_module_coefs()
|
||||||
# news
|
# news
|
||||||
formation = Formation.query.get(args["formation_id"])
|
formation = db.session.get(Formation, args["formation_id"])
|
||||||
ScolarNews.add(
|
ScolarNews.add(
|
||||||
typ=ScolarNews.NEWS_FORM,
|
typ=ScolarNews.NEWS_FORM,
|
||||||
obj=args["formation_id"],
|
obj=args["formation_id"],
|
||||||
@ -284,7 +283,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
|||||||
}
|
}
|
||||||
submitlabel = "Créer cette UE"
|
submitlabel = "Créer cette UE"
|
||||||
can_change_semestre_id = True
|
can_change_semestre_id = True
|
||||||
formation = Formation.query.get(formation_id)
|
formation = db.session.get(Formation, formation_id)
|
||||||
if not formation:
|
if not formation:
|
||||||
raise ScoValueError(f"Formation inexistante ! (id={formation_id})")
|
raise ScoValueError(f"Formation inexistante ! (id={formation_id})")
|
||||||
cursus = formation.get_cursus()
|
cursus = formation.get_cursus()
|
||||||
@ -543,7 +542,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
|||||||
"semestre_id": tf[2]["semestre_idx"],
|
"semestre_id": tf[2]["semestre_idx"],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
flash(f"UE créée (code {ue.ue_code})")
|
flash(f"UE créée (code {ue.ue_code})")
|
||||||
else:
|
else:
|
||||||
if not tf[2]["numero"]:
|
if not tf[2]["numero"]:
|
||||||
@ -597,7 +596,7 @@ def next_ue_numero(formation_id, semestre_id=None):
|
|||||||
"""Numero d'une nouvelle UE dans cette formation.
|
"""Numero d'une nouvelle UE dans cette formation.
|
||||||
Si le semestre est specifie, cherche les UE ayant des modules de ce semestre
|
Si le semestre est specifie, cherche les UE ayant des modules de ce semestre
|
||||||
"""
|
"""
|
||||||
formation = Formation.query.get(formation_id)
|
formation = db.session.get(Formation, formation_id)
|
||||||
ues = ue_list(args={"formation_id": formation_id})
|
ues = ue_list(args={"formation_id": formation_id})
|
||||||
if not ues:
|
if not ues:
|
||||||
return 0
|
return 0
|
||||||
@ -661,7 +660,7 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list
|
|||||||
"""
|
"""
|
||||||
from app.scodoc import sco_formsemestre_validation
|
from app.scodoc import sco_formsemestre_validation
|
||||||
|
|
||||||
formation: Formation = Formation.query.get(formation_id)
|
formation: Formation = db.session.get(Formation, formation_id)
|
||||||
if not formation:
|
if not formation:
|
||||||
raise ScoValueError("invalid formation_id")
|
raise ScoValueError("invalid formation_id")
|
||||||
parcours = formation.get_cursus()
|
parcours = formation.get_cursus()
|
||||||
@ -1462,7 +1461,7 @@ def do_ue_edit(args, bypass_lock=False, dont_invalidate_cache=False):
|
|||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
_ueEditor.edit(cnx, args)
|
_ueEditor.edit(cnx, args)
|
||||||
|
|
||||||
formation = Formation.query.get(ue["formation_id"])
|
formation = db.session.get(Formation, ue["formation_id"])
|
||||||
if not dont_invalidate_cache:
|
if not dont_invalidate_cache:
|
||||||
# Invalide les semestres utilisant cette formation
|
# Invalide les semestres utilisant cette formation
|
||||||
# ainsi que les poids et coefs
|
# ainsi que les poids et coefs
|
||||||
|
@ -262,7 +262,7 @@ def identite_list(cnx, *a, **kw):
|
|||||||
|
|
||||||
def identite_edit_nocheck(cnx, args):
|
def identite_edit_nocheck(cnx, args):
|
||||||
"""Modifie les champs mentionnes dans args, sans verification ni notification."""
|
"""Modifie les champs mentionnes dans args, sans verification ni notification."""
|
||||||
etud = Identite.query.get(args["etudid"])
|
etud = db.session.get(Identite, args["etudid"])
|
||||||
etud.from_dict(args)
|
etud.from_dict(args)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ def do_evaluation_create(
|
|||||||
)
|
)
|
||||||
args = locals()
|
args = locals()
|
||||||
log("do_evaluation_create: args=" + str(args))
|
log("do_evaluation_create: args=" + str(args))
|
||||||
modimpl: ModuleImpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl: ModuleImpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
if modimpl is None:
|
if modimpl is None:
|
||||||
raise ValueError("module not found")
|
raise ValueError("module not found")
|
||||||
check_evaluation_args(args)
|
check_evaluation_args(args)
|
||||||
|
@ -37,11 +37,8 @@ from flask_login import current_user
|
|||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app import log
|
from app.models import Evaluation, FormSemestre, ModuleImpl
|
||||||
from app import models
|
|
||||||
from app.models.evaluations import Evaluation
|
|
||||||
from app.models.formsemestre import FormSemestre
|
|
||||||
from app.models.moduleimpls import ModuleImpl
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.sco_utils import ModuleType
|
from app.scodoc.sco_utils import ModuleType
|
||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
@ -62,7 +59,7 @@ def evaluation_create_form(
|
|||||||
):
|
):
|
||||||
"Formulaire création/édition d'une évaluation (pas de ses notes)"
|
"Formulaire création/édition d'une évaluation (pas de ses notes)"
|
||||||
if evaluation_id is not None:
|
if evaluation_id is not None:
|
||||||
evaluation: Evaluation = models.Evaluation.query.get(evaluation_id)
|
evaluation: Evaluation = db.session.get(Evaluation, evaluation_id)
|
||||||
if evaluation is None:
|
if evaluation is None:
|
||||||
raise ScoValueError("Cette évaluation n'existe pas ou plus !")
|
raise ScoValueError("Cette évaluation n'existe pas ou plus !")
|
||||||
moduleimpl_id = evaluation.moduleimpl_id
|
moduleimpl_id = evaluation.moduleimpl_id
|
||||||
@ -363,7 +360,7 @@ def evaluation_create_form(
|
|||||||
evaluation_id = sco_evaluation_db.do_evaluation_create(**tf[2])
|
evaluation_id = sco_evaluation_db.do_evaluation_create(**tf[2])
|
||||||
if is_apc:
|
if is_apc:
|
||||||
# Set poids
|
# Set poids
|
||||||
evaluation = models.Evaluation.query.get(evaluation_id)
|
evaluation = db.session.get(Evaluation, evaluation_id)
|
||||||
for ue in sem_ues:
|
for ue in sem_ues:
|
||||||
evaluation.set_ue_poids(ue, tf[2][f"poids_{ue.id}"])
|
evaluation.set_ue_poids(ue, tf[2][f"poids_{ue.id}"])
|
||||||
db.session.add(evaluation)
|
db.session.add(evaluation)
|
||||||
|
@ -12,6 +12,7 @@ Sur une idée de Pascal Bouron, de Lyon.
|
|||||||
import time
|
import time
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.models import Evaluation, FormSemestre
|
from app.models import Evaluation, FormSemestre
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
@ -113,7 +114,7 @@ def evaluations_recap_table(formsemestre: FormSemestre) -> list[dict]:
|
|||||||
rows.append(row)
|
rows.append(row)
|
||||||
line_idx += 1
|
line_idx += 1
|
||||||
for evaluation_id in modimpl_results.evals_notes:
|
for evaluation_id in modimpl_results.evals_notes:
|
||||||
e = Evaluation.query.get(evaluation_id)
|
e = db.session.get(Evaluation, evaluation_id)
|
||||||
eval_etat = modimpl_results.evaluations_etat[evaluation_id]
|
eval_etat = modimpl_results.evaluations_etat[evaluation_id]
|
||||||
row = {
|
row = {
|
||||||
"type": "",
|
"type": "",
|
||||||
|
@ -35,8 +35,7 @@ from flask import send_file, url_for
|
|||||||
from flask import g, request
|
from flask import g, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app.models import Formation, FormSemestre, UniteEns, Module
|
from app.models import Formation, FormSemestre, Matiere, Module, UniteEns
|
||||||
from app.models.formations import Matiere
|
|
||||||
|
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
@ -178,7 +177,7 @@ def export_recap_formations_annee_scolaire(annee_scolaire):
|
|||||||
)
|
)
|
||||||
formation_ids = {formsemestre.formation.id for formsemestre in formsemestres}
|
formation_ids = {formsemestre.formation.id for formsemestre in formsemestres}
|
||||||
for formation_id in formation_ids:
|
for formation_id in formation_ids:
|
||||||
formation = Formation.query.get(formation_id)
|
formation = db.session.get(Formation, formation_id)
|
||||||
xls = formation_table_recap(formation_id, format="xlsx").data
|
xls = formation_table_recap(formation_id, format="xlsx").data
|
||||||
filename = (
|
filename = (
|
||||||
scu.sanitize_filename(formation.get_titre_version()) + scu.XLSX_SUFFIX
|
scu.sanitize_filename(formation.get_titre_version()) + scu.XLSX_SUFFIX
|
||||||
|
@ -206,14 +206,14 @@ def do_formsemestres_associate_new_version(
|
|||||||
) = sco_formations.formation_create_new_version(formation_id, redirect=False)
|
) = sco_formations.formation_create_new_version(formation_id, redirect=False)
|
||||||
# Log new ues:
|
# Log new ues:
|
||||||
for ue_id in ues_old2new:
|
for ue_id in ues_old2new:
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
new_ue = UniteEns.query.get(ues_old2new[ue_id])
|
new_ue = db.session.get(UniteEns, ues_old2new[ue_id])
|
||||||
assert ue.semestre_idx == new_ue.semestre_idx
|
assert ue.semestre_idx == new_ue.semestre_idx
|
||||||
log(f"{ue} -> {new_ue}")
|
log(f"{ue} -> {new_ue}")
|
||||||
# Log new modules
|
# Log new modules
|
||||||
for module_id in modules_old2new:
|
for module_id in modules_old2new:
|
||||||
mod = Module.query.get(module_id)
|
mod = db.session.get(Module, module_id)
|
||||||
new_mod = Module.query.get(modules_old2new[module_id])
|
new_mod = db.session.get(Module, modules_old2new[module_id])
|
||||||
assert mod.semestre_id == new_mod.semestre_id
|
assert mod.semestre_id == new_mod.semestre_id
|
||||||
log(f"{mod} -> {new_mod}")
|
log(f"{mod} -> {new_mod}")
|
||||||
# re-associate
|
# re-associate
|
||||||
|
@ -163,7 +163,7 @@ def formation_export_dict(
|
|||||||
if tags:
|
if tags:
|
||||||
mod["tags"] = [{"name": x} for x in tags]
|
mod["tags"] = [{"name": x} for x in tags]
|
||||||
#
|
#
|
||||||
module: Module = Module.query.get(module_id)
|
module: Module = db.session.get(Module, module_id)
|
||||||
if module.is_apc():
|
if module.is_apc():
|
||||||
# Exporte les coefficients
|
# Exporte les coefficients
|
||||||
if ue_reference_style == "id":
|
if ue_reference_style == "id":
|
||||||
@ -359,7 +359,7 @@ def formation_import_xml(doc: str, import_tags=True, use_local_refcomp=False):
|
|||||||
referentiel_competence_id, ue_info[1]
|
referentiel_competence_id, ue_info[1]
|
||||||
)
|
)
|
||||||
ue_id = sco_edit_ue.do_ue_create(ue_info[1])
|
ue_id = sco_edit_ue.do_ue_create(ue_info[1])
|
||||||
ue: UniteEns = UniteEns.query.get(ue_id)
|
ue: UniteEns = db.session.get(UniteEns, ue_id)
|
||||||
assert ue
|
assert ue
|
||||||
if xml_ue_id:
|
if xml_ue_id:
|
||||||
ues_old2new[xml_ue_id] = ue_id
|
ues_old2new[xml_ue_id] = ue_id
|
||||||
@ -424,7 +424,7 @@ def formation_import_xml(doc: str, import_tags=True, use_local_refcomp=False):
|
|||||||
if xml_module_id:
|
if xml_module_id:
|
||||||
modules_old2new[int(xml_module_id)] = mod_id
|
modules_old2new[int(xml_module_id)] = mod_id
|
||||||
if len(mod_info) > 2:
|
if len(mod_info) > 2:
|
||||||
module: Module = Module.query.get(mod_id)
|
module: Module = db.session.get(Module, mod_id)
|
||||||
tag_names = []
|
tag_names = []
|
||||||
ue_coef_dict = {}
|
ue_coef_dict = {}
|
||||||
for child in mod_info[2]:
|
for child in mod_info[2]:
|
||||||
|
@ -950,7 +950,7 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N
|
|||||||
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
||||||
if "parcours" in tf[2]:
|
if "parcours" in tf[2]:
|
||||||
formsemestre.parcours = [
|
formsemestre.parcours = [
|
||||||
ApcParcours.query.get(int(parcour_id_str))
|
db.session.get(ApcParcours, int(parcour_id_str))
|
||||||
for parcour_id_str in tf[2]["parcours"]
|
for parcour_id_str in tf[2]["parcours"]
|
||||||
]
|
]
|
||||||
db.session.add(formsemestre)
|
db.session.add(formsemestre)
|
||||||
@ -1044,7 +1044,7 @@ def formsemestre_delete_moduleimpls(formsemestre_id, module_ids_to_del):
|
|||||||
ok = True
|
ok = True
|
||||||
msg = []
|
msg = []
|
||||||
for module_id in module_ids_to_del:
|
for module_id in module_ids_to_del:
|
||||||
module = Module.query.get(module_id)
|
module = db.session.get(Module, module_id)
|
||||||
if module is None:
|
if module is None:
|
||||||
continue # ignore invalid ids
|
continue # ignore invalid ids
|
||||||
modimpls = ModuleImpl.query.filter_by(
|
modimpls = ModuleImpl.query.filter_by(
|
||||||
@ -1224,7 +1224,7 @@ def do_formsemestre_clone(
|
|||||||
args["etat"] = 1 # non verrouillé
|
args["etat"] = 1 # non verrouillé
|
||||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(args)
|
formsemestre_id = sco_formsemestre.do_formsemestre_create(args)
|
||||||
log(f"created formsemestre {formsemestre_id}")
|
log(f"created formsemestre {formsemestre_id}")
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
# 2- create moduleimpls
|
# 2- create moduleimpls
|
||||||
mods_orig = sco_moduleimpl.moduleimpl_list(formsemestre_id=orig_formsemestre_id)
|
mods_orig = sco_moduleimpl.moduleimpl_list(formsemestre_id=orig_formsemestre_id)
|
||||||
for mod_orig in mods_orig:
|
for mod_orig in mods_orig:
|
||||||
|
@ -36,14 +36,20 @@ from flask import request
|
|||||||
from flask import flash, redirect, render_template, url_for
|
from flask import flash, redirect, render_template, url_for
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.but.cursus_but import formsemestre_warning_apc_setup
|
from app.but.cursus_but import formsemestre_warning_apc_setup
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_common import ResultatsSemestre
|
from app.comp.res_common import ResultatsSemestre
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.models import Evaluation, Formation, Module, ModuleImpl, NotesNotes
|
from app.models import (
|
||||||
from app.models.etudiants import Identite
|
Evaluation,
|
||||||
from app.models.formsemestre import FormSemestre
|
Formation,
|
||||||
|
FormSemestre,
|
||||||
|
Identite,
|
||||||
|
Module,
|
||||||
|
ModuleImpl,
|
||||||
|
NotesNotes,
|
||||||
|
)
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.sco_utils import ModuleType
|
from app.scodoc.sco_utils import ModuleType
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
@ -753,7 +759,7 @@ def formsemestre_description_table(
|
|||||||
e["publish_incomplete_str"] = "Non"
|
e["publish_incomplete_str"] = "Non"
|
||||||
e["_publish_incomplete_str_td_attrs"] = 'style="color: red;"'
|
e["_publish_incomplete_str_td_attrs"] = 'style="color: red;"'
|
||||||
# Poids vers UEs (en APC)
|
# Poids vers UEs (en APC)
|
||||||
evaluation: Evaluation = Evaluation.query.get(e["evaluation_id"])
|
evaluation: Evaluation = db.session.get(Evaluation, e["evaluation_id"])
|
||||||
for ue_id, poids in evaluation.get_ue_poids_dict().items():
|
for ue_id, poids in evaluation.get_ue_poids_dict().items():
|
||||||
e[f"ue_{ue_id}"] = poids or ""
|
e[f"ue_{ue_id}"] = poids or ""
|
||||||
e[f"_ue_{ue_id}_class"] = "poids"
|
e[f"_ue_{ue_id}_class"] = "poids"
|
||||||
@ -974,7 +980,7 @@ def html_expr_diagnostic(diagnostics):
|
|||||||
|
|
||||||
def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None):
|
def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None):
|
||||||
"""En-tête HTML des pages "semestre" """
|
"""En-tête HTML des pages "semestre" """
|
||||||
sem: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
sem: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
if not sem:
|
if not sem:
|
||||||
raise ScoValueError("Semestre inexistant (il a peut être été supprimé ?)")
|
raise ScoValueError("Semestre inexistant (il a peut être été supprimé ?)")
|
||||||
formation: Formation = sem.formation
|
formation: Formation = sem.formation
|
||||||
@ -1225,7 +1231,7 @@ def formsemestre_tableau_modules(
|
|||||||
H = []
|
H = []
|
||||||
prev_ue_id = None
|
prev_ue_id = None
|
||||||
for modimpl in modimpls:
|
for modimpl in modimpls:
|
||||||
mod: Module = Module.query.get(modimpl["module_id"])
|
mod: Module = db.session.get(Module, modimpl["module_id"])
|
||||||
moduleimpl_status_url = url_for(
|
moduleimpl_status_url = url_for(
|
||||||
"notes.moduleimpl_status",
|
"notes.moduleimpl_status",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
@ -69,6 +69,7 @@ from app.scodoc import sco_preferences
|
|||||||
from app.scodoc import sco_pv_dict
|
from app.scodoc import sco_pv_dict
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------
|
||||||
def formsemestre_validation_etud_form(
|
def formsemestre_validation_etud_form(
|
||||||
formsemestre_id=None, # required
|
formsemestre_id=None, # required
|
||||||
@ -575,7 +576,7 @@ def formsemestre_recap_parcours_table(
|
|||||||
else:
|
else:
|
||||||
ass = ""
|
ass = ""
|
||||||
|
|
||||||
formsemestre = FormSemestre.query.get(sem["formsemestre_id"])
|
formsemestre = db.session.get(FormSemestre, sem["formsemestre_id"])
|
||||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||||
if is_cur:
|
if is_cur:
|
||||||
type_sem = "*" # now unused
|
type_sem = "*" # now unused
|
||||||
|
@ -450,7 +450,7 @@ def get_etud_formsemestre_groups(
|
|||||||
),
|
),
|
||||||
{"etudid": etud.id, "formsemestre_id": formsemestre.id},
|
{"etudid": etud.id, "formsemestre_id": formsemestre.id},
|
||||||
)
|
)
|
||||||
return [GroupDescr.query.get(group_id) for group_id in cursor]
|
return [db.session.get(GroupDescr, group_id) for group_id in cursor]
|
||||||
|
|
||||||
|
|
||||||
# Ancienne fonction:
|
# Ancienne fonction:
|
||||||
@ -714,7 +714,7 @@ def setGroups(
|
|||||||
response.headers["Content-Type"] = scu.XML_MIMETYPE
|
response.headers["Content-Type"] = scu.XML_MIMETYPE
|
||||||
return response
|
return response
|
||||||
|
|
||||||
partition: Partition = Partition.query.get(partition_id)
|
partition: Partition = db.session.get(Partition, partition_id)
|
||||||
if not partition.groups_editable and (groupsToCreate or groupsToDelete):
|
if not partition.groups_editable and (groupsToCreate or groupsToDelete):
|
||||||
msg = "setGroups: partition non editable"
|
msg = "setGroups: partition non editable"
|
||||||
log(msg)
|
log(msg)
|
||||||
@ -1484,7 +1484,7 @@ def _get_prev_moy(etudid, formsemestre_id):
|
|||||||
etud = info[0]
|
etud = info[0]
|
||||||
Se = sco_cursus.get_situation_etud_cursus(etud, formsemestre_id)
|
Se = sco_cursus.get_situation_etud_cursus(etud, formsemestre_id)
|
||||||
if Se.prev:
|
if Se.prev:
|
||||||
prev_sem = FormSemestre.query.get(Se.prev["formsemestre_id"])
|
prev_sem = db.session.get(FormSemestre, Se.prev["formsemestre_id"])
|
||||||
nt: NotesTableCompat = res_sem.load_formsemestre_results(prev_sem)
|
nt: NotesTableCompat = res_sem.load_formsemestre_results(prev_sem)
|
||||||
return nt.get_etud_moy_gen(etudid)
|
return nt.get_etud_moy_gen(etudid)
|
||||||
else:
|
else:
|
||||||
@ -1521,7 +1521,7 @@ def create_etapes_partition(formsemestre_id, partition_name="apo_etapes"):
|
|||||||
pid = partition_create(
|
pid = partition_create(
|
||||||
formsemestre_id, partition_name=partition_name, redirect=False
|
formsemestre_id, partition_name=partition_name, redirect=False
|
||||||
)
|
)
|
||||||
partition: Partition = Partition.query.get(pid)
|
partition: Partition = db.session.get(Partition, pid)
|
||||||
groups = partition.groups
|
groups = partition.groups
|
||||||
groups_by_names = {g["group_name"]: g for g in groups}
|
groups_by_names = {g["group_name"]: g for g in groups}
|
||||||
for etape in etapes:
|
for etape in etapes:
|
||||||
|
@ -36,16 +36,12 @@ import time
|
|||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
from app import db, log
|
||||||
import app.scodoc.notesdb as ndb
|
|
||||||
from app import log
|
|
||||||
from app.models import ScolarNews, GroupDescr
|
from app.models import ScolarNews, GroupDescr
|
||||||
from app.models.etudiants import input_civilite
|
from app.models.etudiants import input_civilite
|
||||||
from app.scodoc.sco_excel import COLORS
|
|
||||||
from app.scodoc.sco_formsemestre_inscriptions import (
|
|
||||||
do_formsemestre_inscription_with_modules,
|
|
||||||
)
|
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
|
from app.scodoc.sco_excel import COLORS
|
||||||
from app.scodoc.sco_exceptions import (
|
from app.scodoc.sco_exceptions import (
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
ScoFormatError,
|
ScoFormatError,
|
||||||
@ -55,7 +51,6 @@ from app.scodoc.sco_exceptions import (
|
|||||||
ScoLockedFormError,
|
ScoLockedFormError,
|
||||||
ScoGenError,
|
ScoGenError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_etud
|
from app.scodoc import sco_etud
|
||||||
@ -63,6 +58,11 @@ from app.scodoc import sco_groups
|
|||||||
from app.scodoc import sco_excel
|
from app.scodoc import sco_excel
|
||||||
from app.scodoc import sco_groups_view
|
from app.scodoc import sco_groups_view
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
|
import app.scodoc.notesdb as ndb
|
||||||
|
from app.scodoc.sco_formsemestre_inscriptions import (
|
||||||
|
do_formsemestre_inscription_with_modules,
|
||||||
|
)
|
||||||
|
import app.scodoc.sco_utils as scu
|
||||||
|
|
||||||
# format description (in tools/)
|
# format description (in tools/)
|
||||||
FORMAT_FILE = "format_import_etudiants.txt"
|
FORMAT_FILE = "format_import_etudiants.txt"
|
||||||
@ -719,7 +719,7 @@ def scolars_import_admission(datafile, formsemestre_id=None, type_admission=None
|
|||||||
)
|
)
|
||||||
|
|
||||||
for group_id in group_ids:
|
for group_id in group_ids:
|
||||||
group = GroupDescr.query.get(group_id)
|
group = db.session.get(GroupDescr, group_id)
|
||||||
if group.partition.groups_editable:
|
if group.partition.groups_editable:
|
||||||
sco_groups.change_etud_group_in_partition(
|
sco_groups.change_etud_group_in_partition(
|
||||||
args["etudid"], group
|
args["etudid"], group
|
||||||
|
@ -35,7 +35,7 @@ from flask import url_for, g, request
|
|||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.models import Formation, FormSemestre, GroupDescr
|
from app.models import Formation, FormSemestre, GroupDescr
|
||||||
from app.scodoc.gen_tables import GenTable
|
from app.scodoc.gen_tables import GenTable
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
@ -177,7 +177,7 @@ def do_inscrit(sem, etudids, inscrit_groupes=False):
|
|||||||
En option: inscrit aux mêmes groupes que dans le semestre origine
|
En option: inscrit aux mêmes groupes que dans le semestre origine
|
||||||
"""
|
"""
|
||||||
# TODO à ré-écrire pour utiliser le smodèle, notamment GroupDescr
|
# TODO à ré-écrire pour utiliser le smodèle, notamment GroupDescr
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(sem["formsemestre_id"])
|
formsemestre: FormSemestre = db.session.get(FormSemestre, sem["formsemestre_id"])
|
||||||
formsemestre.setup_parcours_groups()
|
formsemestre.setup_parcours_groups()
|
||||||
log(f"do_inscrit (inscrit_groupes={inscrit_groupes}): {etudids}")
|
log(f"do_inscrit (inscrit_groupes={inscrit_groupes}): {etudids}")
|
||||||
for etudid in etudids:
|
for etudid in etudids:
|
||||||
@ -220,7 +220,9 @@ def do_inscrit(sem, etudids, inscrit_groupes=False):
|
|||||||
|
|
||||||
# Inscrit aux groupes
|
# Inscrit aux groupes
|
||||||
for partition_group in partition_groups:
|
for partition_group in partition_groups:
|
||||||
group: GroupDescr = GroupDescr.query.get(partition_group["group_id"])
|
group: GroupDescr = db.session.get(
|
||||||
|
GroupDescr, partition_group["group_id"]
|
||||||
|
)
|
||||||
sco_groups.change_etud_group_in_partition(etudid, group)
|
sco_groups.change_etud_group_in_partition(etudid, group)
|
||||||
|
|
||||||
|
|
||||||
@ -433,7 +435,7 @@ def _build_page(
|
|||||||
inscrit_groupes=False,
|
inscrit_groupes=False,
|
||||||
ignore_jury=False,
|
ignore_jury=False,
|
||||||
):
|
):
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(sem["formsemestre_id"])
|
formsemestre: FormSemestre = db.session.get(FormSemestre, sem["formsemestre_id"])
|
||||||
inscrit_groupes = int(inscrit_groupes)
|
inscrit_groupes = int(inscrit_groupes)
|
||||||
ignore_jury = int(ignore_jury)
|
ignore_jury = int(ignore_jury)
|
||||||
if inscrit_groupes:
|
if inscrit_groupes:
|
||||||
|
@ -33,7 +33,7 @@ import numpy as np
|
|||||||
import flask
|
import flask
|
||||||
from flask import url_for, g, request
|
from flask import url_for, g, request
|
||||||
|
|
||||||
from app import log
|
from app import db, log
|
||||||
from app import models
|
from app import models
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp import moy_mod
|
from app.comp import moy_mod
|
||||||
@ -79,7 +79,7 @@ def do_evaluation_listenotes(
|
|||||||
return "<p>Aucune évaluation !</p>", "ScoDoc"
|
return "<p>Aucune évaluation !</p>", "ScoDoc"
|
||||||
|
|
||||||
E = evals[0] # il y a au moins une evaluation
|
E = evals[0] # il y a au moins une evaluation
|
||||||
modimpl = ModuleImpl.query.get(E["moduleimpl_id"])
|
modimpl = db.session.get(ModuleImpl, E["moduleimpl_id"])
|
||||||
# description de l'evaluation
|
# description de l'evaluation
|
||||||
if mode == "eval":
|
if mode == "eval":
|
||||||
H = [sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)]
|
H = [sco_evaluations.evaluation_describe(evaluation_id=evaluation_id)]
|
||||||
@ -624,7 +624,7 @@ def _make_table_notes(
|
|||||||
]
|
]
|
||||||
commentkeys = list(key_mgr.items()) # [ (comment, key), ... ]
|
commentkeys = list(key_mgr.items()) # [ (comment, key), ... ]
|
||||||
commentkeys.sort(key=lambda x: int(x[1]))
|
commentkeys.sort(key=lambda x: int(x[1]))
|
||||||
for (comment, key) in commentkeys:
|
for comment, key in commentkeys:
|
||||||
C.append(
|
C.append(
|
||||||
'<span class="colcomment">(%s)</span> <em>%s</em><br>' % (key, comment)
|
'<span class="colcomment">(%s)</span> <em>%s</em><br>' % (key, comment)
|
||||||
)
|
)
|
||||||
@ -673,7 +673,7 @@ def _add_eval_columns(
|
|||||||
sum_notes = 0
|
sum_notes = 0
|
||||||
notes = [] # liste des notes numeriques, pour calcul histogramme uniquement
|
notes = [] # liste des notes numeriques, pour calcul histogramme uniquement
|
||||||
evaluation_id = e["evaluation_id"]
|
evaluation_id = e["evaluation_id"]
|
||||||
e_o = Evaluation.query.get(evaluation_id) # XXX en attendant ré-écriture
|
e_o = db.session.get(Evaluation, evaluation_id) # XXX en attendant ré-écriture
|
||||||
inscrits = e_o.moduleimpl.formsemestre.etudids_actifs # set d'etudids
|
inscrits = e_o.moduleimpl.formsemestre.etudids_actifs # set d'etudids
|
||||||
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
|
|
||||||
|
@ -31,15 +31,16 @@
|
|||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
|
from app import db
|
||||||
|
|
||||||
|
from app.models import Formation
|
||||||
|
from app.scodoc import scolog
|
||||||
|
from app.scodoc import sco_formsemestre
|
||||||
|
from app.scodoc import sco_cache
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, AccessDenied
|
from app.scodoc.sco_exceptions import ScoValueError, AccessDenied
|
||||||
from app import log
|
|
||||||
from app import models
|
|
||||||
from app.scodoc import scolog
|
|
||||||
from app.scodoc import sco_formsemestre
|
|
||||||
from app.scodoc import sco_cache
|
|
||||||
|
|
||||||
# --- Gestion des "Implémentations de Modules"
|
# --- Gestion des "Implémentations de Modules"
|
||||||
# Un "moduleimpl" correspond a la mise en oeuvre d'un module
|
# Un "moduleimpl" correspond a la mise en oeuvre d'un module
|
||||||
@ -170,7 +171,7 @@ def moduleimpl_withmodule_list(
|
|||||||
mi["matiere"] = matieres[matiere_id]
|
mi["matiere"] = matieres[matiere_id]
|
||||||
|
|
||||||
mod = modimpls[0]["module"]
|
mod = modimpls[0]["module"]
|
||||||
formation = models.Formation.query.get(mod["formation_id"])
|
formation = db.session.get(Formation, mod["formation_id"])
|
||||||
|
|
||||||
if formation.is_apc():
|
if formation.is_apc():
|
||||||
# tri par numero_module
|
# tri par numero_module
|
||||||
|
@ -34,6 +34,7 @@ import flask
|
|||||||
from flask import url_for, g, request
|
from flask import url_for, g, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
|
from app import db, log
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.models import (
|
from app.models import (
|
||||||
@ -43,9 +44,6 @@ from app.models import (
|
|||||||
ScolarFormSemestreValidation,
|
ScolarFormSemestreValidation,
|
||||||
UniteEns,
|
UniteEns,
|
||||||
)
|
)
|
||||||
|
|
||||||
from app import log
|
|
||||||
from app.tables import list_etuds
|
|
||||||
from app.scodoc.scolog import logdb
|
from app.scodoc.scolog import logdb
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import htmlutils
|
from app.scodoc import htmlutils
|
||||||
@ -62,6 +60,7 @@ import app.scodoc.notesdb as ndb
|
|||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
from app.tables import list_etuds
|
||||||
|
|
||||||
|
|
||||||
def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
||||||
@ -520,7 +519,7 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) ->
|
|||||||
else set()
|
else set()
|
||||||
)
|
)
|
||||||
ues = sorted(
|
ues = sorted(
|
||||||
(UniteEns.query.get(ue_id) for ue_id in ue_ids),
|
(db.session.get(UniteEns, ue_id) for ue_id in ue_ids),
|
||||||
key=lambda u: (u.numero or 0, u.acronyme),
|
key=lambda u: (u.numero or 0, u.acronyme),
|
||||||
)
|
)
|
||||||
H.append(
|
H.append(
|
||||||
@ -690,7 +689,7 @@ def _fmt_etud_set(etudids, max_list_size=7) -> str:
|
|||||||
return f"{len(etudids)} étudiants"
|
return f"{len(etudids)} étudiants"
|
||||||
etuds = []
|
etuds = []
|
||||||
for etudid in etudids:
|
for etudid in etudids:
|
||||||
etud = Identite.query.get(etudid)
|
etud = db.session.get(Identite, etudid)
|
||||||
if etud:
|
if etud:
|
||||||
etuds.append(etud)
|
etuds.append(etud)
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
)
|
)
|
||||||
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
||||||
#
|
#
|
||||||
module_resp = User.query.get(modimpl.responsable_id)
|
module_resp = db.session.get(User, modimpl.responsable_id)
|
||||||
mod_type_name = scu.MODULE_TYPE_NAMES[module.module_type]
|
mod_type_name = scu.MODULE_TYPE_NAMES[module.module_type]
|
||||||
H = [
|
H = [
|
||||||
html_sco_header.sco_header(
|
html_sco_header.sco_header(
|
||||||
@ -529,7 +529,7 @@ def _ligne_evaluation(
|
|||||||
) -> str:
|
) -> str:
|
||||||
"""Ligne <tr> décrivant une évaluation dans le tableau de bord moduleimpl."""
|
"""Ligne <tr> décrivant une évaluation dans le tableau de bord moduleimpl."""
|
||||||
H = []
|
H = []
|
||||||
# evaluation: Evaluation = Evaluation.query.get(eval_dict["evaluation_id"])
|
# evaluation: Evaluation = db.session.get(Evaluation, eval_dict["evaluation_id"])
|
||||||
etat = sco_evaluations.do_evaluation_etat(
|
etat = sco_evaluations.do_evaluation_etat(
|
||||||
evaluation.id,
|
evaluation.id,
|
||||||
partition_id=partition_id,
|
partition_id=partition_id,
|
||||||
@ -838,7 +838,7 @@ def _evaluation_poids_html(evaluation: Evaluation, max_poids: float = 0.0) -> st
|
|||||||
"></div>
|
"></div>
|
||||||
</div>"""
|
</div>"""
|
||||||
for ue, poids in (
|
for ue, poids in (
|
||||||
(UniteEns.query.get(ue_id), poids)
|
(db.session.get(UniteEns, ue_id), poids)
|
||||||
for ue_id, poids in ue_poids.items()
|
for ue_id, poids in ue_poids.items()
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -33,9 +33,7 @@
|
|||||||
from flask import abort, url_for, g, render_template, request
|
from flask import abort, url_for, g, render_template, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
from app import db, log
|
||||||
import app.scodoc.notesdb as ndb
|
|
||||||
from app import log
|
|
||||||
from app.but import cursus_but
|
from app.but import cursus_but
|
||||||
from app.models.etudiants import Identite, make_etud_args
|
from app.models.etudiants import Identite, make_etud_args
|
||||||
from app.models.formsemestre import FormSemestre
|
from app.models.formsemestre import FormSemestre
|
||||||
@ -57,6 +55,8 @@ from app.scodoc.sco_bulletins import etud_descr_situation_semestre
|
|||||||
from app.scodoc.sco_exceptions import ScoValueError
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_formsemestre_validation import formsemestre_recap_parcours_table
|
from app.scodoc.sco_formsemestre_validation import formsemestre_recap_parcours_table
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
import app.scodoc.sco_utils as scu
|
||||||
|
import app.scodoc.notesdb as ndb
|
||||||
|
|
||||||
|
|
||||||
def _menu_scolarite(
|
def _menu_scolarite(
|
||||||
@ -258,7 +258,9 @@ def ficheEtud(etudid=None):
|
|||||||
info["last_formsemestre_id"] = ""
|
info["last_formsemestre_id"] = ""
|
||||||
sem_info = {}
|
sem_info = {}
|
||||||
for sem in info["sems"]:
|
for sem in info["sems"]:
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(sem["formsemestre_id"])
|
formsemestre: FormSemestre = db.session.get(
|
||||||
|
FormSemestre, sem["formsemestre_id"]
|
||||||
|
)
|
||||||
if sem["ins"]["etat"] != scu.INSCRIT:
|
if sem["ins"]["etat"] != scu.INSCRIT:
|
||||||
descr, _ = etud_descr_situation_semestre(
|
descr, _ = etud_descr_situation_semestre(
|
||||||
etudid,
|
etudid,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
from flask import g
|
from flask import g
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.auth.models import User
|
from app.auth.models import User
|
||||||
from app.models import FormSemestre
|
from app.models import FormSemestre
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -131,7 +132,10 @@ def check_access_diretud(formsemestre_id, required_permission=Permission.ScoImpl
|
|||||||
"<h2>Opération non autorisée pour %s</h2>" % current_user,
|
"<h2>Opération non autorisée pour %s</h2>" % current_user,
|
||||||
"<p>Responsable de ce semestre : <b>%s</b></p>"
|
"<p>Responsable de ce semestre : <b>%s</b></p>"
|
||||||
% ", ".join(
|
% ", ".join(
|
||||||
[User.query.get(i).get_prenomnom() for i in sem["responsables"]]
|
[
|
||||||
|
db.session.get(User, i).get_prenomnom()
|
||||||
|
for i in sem["responsables"]
|
||||||
|
]
|
||||||
),
|
),
|
||||||
footer,
|
footer,
|
||||||
]
|
]
|
||||||
|
@ -113,9 +113,9 @@ get_base_preferences(formsemestre_id)
|
|||||||
import flask
|
import flask
|
||||||
from flask import current_app, flash, g, request, url_for
|
from flask import current_app, flash, g, request, url_for
|
||||||
|
|
||||||
|
from app import db, log
|
||||||
from app.models import Departement
|
from app.models import Departement
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app import log
|
|
||||||
from app.scodoc.sco_exceptions import ScoValueError, ScoException
|
from app.scodoc.sco_exceptions import ScoValueError, ScoException
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -272,7 +272,7 @@ class BasePreferences(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, dept_id: int):
|
def __init__(self, dept_id: int):
|
||||||
dept = Departement.query.get(dept_id)
|
dept = db.session.get(Departement, dept_id)
|
||||||
if not dept:
|
if not dept:
|
||||||
raise ScoValueError(f"BasePreferences: Invalid departement: {dept_id}")
|
raise ScoValueError(f"BasePreferences: Invalid departement: {dept_id}")
|
||||||
self.dept_id = dept.id
|
self.dept_id = dept.id
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"""
|
"""
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
from app import log
|
from app import db
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.models import (
|
from app.models import (
|
||||||
@ -253,7 +253,7 @@ def _comp_ects_by_ue_code(nt, decisions_ue):
|
|||||||
ects_by_ue_code = {}
|
ects_by_ue_code = {}
|
||||||
for ue_id in decisions_ue:
|
for ue_id in decisions_ue:
|
||||||
d = decisions_ue[ue_id]
|
d = decisions_ue[ue_id]
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
ects_by_ue_code[ue.ue_code] = d["ects"]
|
ects_by_ue_code[ue.ue_code] = d["ects"]
|
||||||
|
|
||||||
return ects_by_ue_code
|
return ects_by_ue_code
|
||||||
|
@ -42,6 +42,7 @@ from reportlab.platypus import PageBreak, Table, Image
|
|||||||
from reportlab.platypus.doctemplate import BaseDocTemplate
|
from reportlab.platypus.doctemplate import BaseDocTemplate
|
||||||
from reportlab.lib import styles
|
from reportlab.lib import styles
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.models import FormSemestre, Identite
|
from app.models import FormSemestre, Identite
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -70,7 +71,7 @@ def pdf_lettres_individuelles(
|
|||||||
if not dpv:
|
if not dpv:
|
||||||
return ""
|
return ""
|
||||||
#
|
#
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
prefs = sco_preferences.SemPreferences(formsemestre_id)
|
prefs = sco_preferences.SemPreferences(formsemestre_id)
|
||||||
params = {
|
params = {
|
||||||
"date_jury": date_jury,
|
"date_jury": date_jury,
|
||||||
|
@ -33,11 +33,9 @@ from collections import defaultdict
|
|||||||
|
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.but import jury_but
|
from app.but import jury_but
|
||||||
from app.comp import res_sem
|
|
||||||
from app.comp.res_compat import NotesTableCompat
|
|
||||||
from app.models import FormSemestre
|
from app.models import FormSemestre
|
||||||
from app.models.etudiants import Identite
|
|
||||||
from app.models.formsemestre import FormSemestreInscription
|
from app.models.formsemestre import FormSemestreInscription
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -170,7 +168,7 @@ def but_indicateurs_by_bac(formsemestre: FormSemestre) -> dict[str:dict]:
|
|||||||
if deca and deca.formsemestre_impair
|
if deca and deca.formsemestre_impair
|
||||||
}
|
}
|
||||||
for formsemestre_id_precedent in formsemestre_id_precedents:
|
for formsemestre_id_precedent in formsemestre_id_precedents:
|
||||||
formsemestre_impair = FormSemestre.query.get(formsemestre_id_precedent)
|
formsemestre_impair = db.session.get(FormSemestre, formsemestre_id_precedent)
|
||||||
suffix = (
|
suffix = (
|
||||||
f"S{formsemestre_impair.semestre_id}"
|
f"S{formsemestre_impair.semestre_id}"
|
||||||
if len(formsemestre_id_precedents) == 1
|
if len(formsemestre_id_precedents) == 1
|
||||||
|
@ -36,7 +36,7 @@ import flask
|
|||||||
from flask import g, url_for, request
|
from flask import g, url_for, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.auth.models import User
|
from app.auth.models import User
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
@ -878,7 +878,7 @@ def saisie_notes_tableur(evaluation_id, group_ids=()):
|
|||||||
|
|
||||||
def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
||||||
"""Document Excel pour saisie notes dans l'évaluation et les groupes indiqués"""
|
"""Document Excel pour saisie notes dans l'évaluation et les groupes indiqués"""
|
||||||
evaluation: Evaluation = Evaluation.query.get(evaluation_id)
|
evaluation: Evaluation = db.session.get(Evaluation, evaluation_id)
|
||||||
if not evaluation:
|
if not evaluation:
|
||||||
raise ScoValueError("invalid evaluation_id")
|
raise ScoValueError("invalid evaluation_id")
|
||||||
modimpl = evaluation.moduleimpl
|
modimpl = evaluation.moduleimpl
|
||||||
@ -958,7 +958,7 @@ def saisie_notes(evaluation_id: int, group_ids: list = None):
|
|||||||
if not isinstance(evaluation_id, int):
|
if not isinstance(evaluation_id, int):
|
||||||
raise ScoInvalidParamError()
|
raise ScoInvalidParamError()
|
||||||
group_ids = [int(group_id) for group_id in (group_ids or [])]
|
group_ids = [int(group_id) for group_id in (group_ids or [])]
|
||||||
evaluation: Evaluation = Evaluation.query.get(evaluation_id)
|
evaluation: Evaluation = db.session.get(Evaluation, evaluation_id)
|
||||||
if evaluation is None:
|
if evaluation is None:
|
||||||
raise ScoValueError("évaluation inexistante")
|
raise ScoValueError("évaluation inexistante")
|
||||||
modimpl = evaluation.moduleimpl
|
modimpl = evaluation.moduleimpl
|
||||||
|
@ -42,7 +42,7 @@ sem_set_list()
|
|||||||
import flask
|
import flask
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
|
||||||
from app import log
|
from app import db, log
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
from app.models import FormSemestre
|
from app.models import FormSemestre
|
||||||
@ -127,7 +127,7 @@ class SemSet(dict):
|
|||||||
self.sems = []
|
self.sems = []
|
||||||
self.formsemestres = []
|
self.formsemestres = []
|
||||||
for formsemestre_id in self.formsemestre_ids:
|
for formsemestre_id in self.formsemestre_ids:
|
||||||
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre: FormSemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
self.formsemestres.append(formsemestre)
|
self.formsemestres.append(formsemestre)
|
||||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||||
self.sems.append(sem)
|
self.sems.append(sem)
|
||||||
|
@ -58,9 +58,8 @@ from flask import flash, g, request, url_for
|
|||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from app.models.formsemestre import FormSemestre
|
from app.models.formsemestre import FormSemestre
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
|
||||||
import app.scodoc.sco_utils as scu
|
from app import db, log
|
||||||
from app import log
|
|
||||||
from app.models import UniteEns
|
from app.models import UniteEns
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
from app.scodoc import codes_cursus
|
from app.scodoc import codes_cursus
|
||||||
@ -74,6 +73,8 @@ from app.scodoc import sco_etud
|
|||||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||||
|
import app.scodoc.notesdb as ndb
|
||||||
|
import app.scodoc.sco_utils as scu
|
||||||
|
|
||||||
|
|
||||||
def external_ue_create(
|
def external_ue_create(
|
||||||
@ -114,7 +115,7 @@ def external_ue_create(
|
|||||||
"is_external": True,
|
"is_external": True,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
ue = UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
flash(f"UE créée (code {ue.ue_code})")
|
flash(f"UE créée (code {ue.ue_code})")
|
||||||
matiere_id = sco_edit_matiere.do_matiere_create(
|
matiere_id = sco_edit_matiere.do_matiere_create(
|
||||||
{"ue_id": ue_id, "titre": titre or acronyme, "numero": 1}
|
{"ue_id": ue_id, "titre": titre or acronyme, "numero": 1}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.auth.models import User
|
from app.auth.models import User
|
||||||
from app.comp.res_common import ResultatsSemestre
|
from app.comp.res_common import ResultatsSemestre
|
||||||
from app.models import Identite, FormSemestre, UniteEns
|
from app.models import Identite, FormSemestre, UniteEns
|
||||||
@ -802,7 +803,7 @@ class RowRecap(tb.Row):
|
|||||||
|
|
||||||
nom_resp = table.cache_nomcomplet.get(modimpl.responsable_id)
|
nom_resp = table.cache_nomcomplet.get(modimpl.responsable_id)
|
||||||
if nom_resp is None:
|
if nom_resp is None:
|
||||||
user = User.query.get(modimpl.responsable_id)
|
user = db.session.get(User, modimpl.responsable_id)
|
||||||
nom_resp = user.get_nomcomplet() if user else ""
|
nom_resp = user.get_nomcomplet() if user else ""
|
||||||
table.cache_nomcomplet[modimpl.responsable_id] = nom_resp
|
table.cache_nomcomplet[modimpl.responsable_id] = nom_resp
|
||||||
table.foot_title_row.cells[col_id].target_attrs[
|
table.foot_title_row.cells[col_id].target_attrs[
|
||||||
|
@ -472,7 +472,7 @@ def ue_infos(ue_id):
|
|||||||
@scodoc7func
|
@scodoc7func
|
||||||
def ue_set_internal(ue_id):
|
def ue_set_internal(ue_id):
|
||||||
""""""
|
""""""
|
||||||
ue = models.UniteEns.query.get(ue_id)
|
ue = db.session.get(UniteEns, ue_id)
|
||||||
if not ue:
|
if not ue:
|
||||||
raise ScoValueError("invalid ue_id")
|
raise ScoValueError("invalid ue_id")
|
||||||
ue.is_external = False
|
ue.is_external = False
|
||||||
@ -927,7 +927,7 @@ def edit_enseignants_form(moduleimpl_id):
|
|||||||
% uid2display.get(M["responsable_id"], M["responsable_id"])
|
% uid2display.get(M["responsable_id"], M["responsable_id"])
|
||||||
]
|
]
|
||||||
for ens in M["ens"]:
|
for ens in M["ens"]:
|
||||||
u = User.query.get(ens["ens_id"])
|
u = db.session.get(User, ens["ens_id"])
|
||||||
if u:
|
if u:
|
||||||
nom = u.get_nomcomplet()
|
nom = u.get_nomcomplet()
|
||||||
else:
|
else:
|
||||||
@ -1823,7 +1823,7 @@ def evaluation_edit(evaluation_id):
|
|||||||
@scodoc7func
|
@scodoc7func
|
||||||
def evaluation_create(moduleimpl_id):
|
def evaluation_create(moduleimpl_id):
|
||||||
"form create evaluation"
|
"form create evaluation"
|
||||||
modimpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
if modimpl is None:
|
if modimpl is None:
|
||||||
raise ScoValueError("Ce module n'existe pas ou plus !")
|
raise ScoValueError("Ce module n'existe pas ou plus !")
|
||||||
return sco_evaluation_edit.evaluation_create_form(
|
return sco_evaluation_edit.evaluation_create_form(
|
||||||
|
@ -164,10 +164,10 @@ def set_module_ue_coef():
|
|||||||
coef = float(request.form["coef"].replace(",", "."))
|
coef = float(request.form["coef"].replace(",", "."))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return scu.json_error(404, "invalid coef")
|
return scu.json_error(404, "invalid coef")
|
||||||
module: Module = models.Module.query.get(module_id)
|
module: Module = db.session.get(Module, module_id)
|
||||||
if module is None:
|
if module is None:
|
||||||
return scu.json_error(404, f"module not found ({module_id})")
|
return scu.json_error(404, f"module not found ({module_id})")
|
||||||
ue = models.UniteEns.query.get(ue_id)
|
ue = db.session.get(models.UniteEns, ue_id)
|
||||||
if not ue:
|
if not ue:
|
||||||
return scu.json_error(404, f"UE not found ({ue_id})")
|
return scu.json_error(404, f"UE not found ({ue_id})")
|
||||||
module.set_ue_coef(ue, coef)
|
module.set_ue_coef(ue, coef)
|
||||||
|
@ -7,17 +7,15 @@ from pathlib import Path
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from flask import flash, url_for
|
from flask import flash, url_for
|
||||||
from flask import Markup
|
|
||||||
from flask import current_app, g, request
|
from flask import current_app, g, request
|
||||||
from flask.templating import render_template
|
from flask.templating import render_template
|
||||||
from flask_json import as_json
|
from flask_json import as_json
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
from markupsafe import Markup
|
||||||
from werkzeug.utils import redirect
|
from werkzeug.utils import redirect
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
from app import db
|
from app import db, log
|
||||||
from app import log
|
|
||||||
|
|
||||||
from app.decorators import scodoc, permission_required
|
from app.decorators import scodoc, permission_required
|
||||||
from app.models import Formation
|
from app.models import Formation
|
||||||
from app.models.but_refcomp import ApcReferentielCompetences
|
from app.models.but_refcomp import ApcReferentielCompetences
|
||||||
@ -148,7 +146,8 @@ def refcomp_assoc_formation(formation_id: int):
|
|||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
referentiel_competence_id = form.referentiel_competence.data
|
referentiel_competence_id = form.referentiel_competence.data
|
||||||
assert (
|
assert (
|
||||||
ApcReferentielCompetences.query.get(referentiel_competence_id) is not None
|
db.session.get(ApcReferentielCompetences, referentiel_competence_id)
|
||||||
|
is not None
|
||||||
)
|
)
|
||||||
formation.referentiel_competence_id = referentiel_competence_id
|
formation.referentiel_competence_id = referentiel_competence_id
|
||||||
db.session.add(formation)
|
db.session.add(formation)
|
||||||
|
@ -248,7 +248,7 @@ def get_etud_dept():
|
|||||||
for etud in etuds:
|
for etud in etuds:
|
||||||
inscriptions = FormSemestreInscription.query.filter_by(etudid=etud.id).all()
|
inscriptions = FormSemestreInscription.query.filter_by(etudid=etud.id).all()
|
||||||
for ins in inscriptions:
|
for ins in inscriptions:
|
||||||
date_fin = FormSemestre.query.get(ins.formsemestre_id).date_fin
|
date_fin = db.session.get(FormSemestre, ins.formsemestre_id).date_fin
|
||||||
if (last_date is None) or date_fin > last_date:
|
if (last_date is None) or date_fin > last_date:
|
||||||
last_date = date_fin
|
last_date = date_fin
|
||||||
last_etud = etud
|
last_etud = etud
|
||||||
|
@ -1744,7 +1744,7 @@ def _etudident_create_or_edit_form(edit):
|
|||||||
etudid = etud["etudid"]
|
etudid = etud["etudid"]
|
||||||
else:
|
else:
|
||||||
# modif d'un etudiant
|
# modif d'un etudiant
|
||||||
etud_o = Identite.query.get(tf[2]["etudid"])
|
etud_o = db.session.get(Identite, tf[2]["etudid"])
|
||||||
etud_o.from_dict(tf[2])
|
etud_o.from_dict(tf[2])
|
||||||
db.session.add(etud_o)
|
db.session.add(etud_o)
|
||||||
admission = etud_o.admission.first()
|
admission = etud_o.admission.first()
|
||||||
|
@ -525,7 +525,7 @@ def photos_import_files(formsemestre_id: int, xlsfile: str, zipfile: str):
|
|||||||
from app.scodoc import sco_trombino, sco_photos
|
from app.scodoc import sco_trombino, sco_photos
|
||||||
from app.auth.models import get_super_admin
|
from app.auth.models import get_super_admin
|
||||||
|
|
||||||
formsemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
if not formsemestre:
|
if not formsemestre:
|
||||||
sys.stderr.write("photos-import-files: formsemestre_id invalide\n")
|
sys.stderr.write("photos-import-files: formsemestre_id invalide\n")
|
||||||
return 2
|
return 2
|
||||||
|
@ -224,7 +224,7 @@ class ScoFake(object):
|
|||||||
code_apogee=None,
|
code_apogee=None,
|
||||||
module_type=scu.ModuleType.STANDARD,
|
module_type=scu.ModuleType.STANDARD,
|
||||||
) -> int:
|
) -> int:
|
||||||
matiere = Matiere.query.get(matiere_id)
|
matiere = db.session.get(Matiere, matiere_id)
|
||||||
ue_id = matiere.ue.id
|
ue_id = matiere.ue.id
|
||||||
formation_id = matiere.ue.formation.id
|
formation_id = matiere.ue.formation.id
|
||||||
oid = sco_edit_module.do_module_create(locals())
|
oid = sco_edit_module.do_module_create(locals())
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Quelques fonctions d'initialisation pour tests unitaires
|
Quelques fonctions d'initialisation pour tests unitaires
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from app import models
|
from app import db, models
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import codes_cursus
|
from app.scodoc import codes_cursus
|
||||||
@ -101,11 +101,11 @@ def build_modules_with_evaluations(
|
|||||||
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = build_formation_test(
|
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = build_formation_test(
|
||||||
nb_mods=nb_mods
|
nb_mods=nb_mods
|
||||||
)
|
)
|
||||||
ue1 = models.UniteEns.query.get(ue1_id)
|
ue1 = db.session.get(models.UniteEns, ue1_id)
|
||||||
ue2 = models.UniteEns.query.get(ue2_id)
|
ue2 = db.session.get(models.UniteEns, ue2_id)
|
||||||
ue3 = models.UniteEns.query.get(ue3_id)
|
ue3 = db.session.get(models.UniteEns, ue3_id)
|
||||||
for module_id in module_ids:
|
for module_id in module_ids:
|
||||||
mod = models.Module.query.get(module_id)
|
mod = db.session.get(models.Module, module_id)
|
||||||
# Coef du module vers les UE
|
# Coef du module vers les UE
|
||||||
c1, c2, c3 = ue_coefs
|
c1, c2, c3 = ue_coefs
|
||||||
coefs_mod = {ue1.id: c1, ue2.id: c2, ue3.id: c3}
|
coefs_mod = {ue1.id: c1, ue2.id: c2, ue3.id: c3}
|
||||||
@ -124,7 +124,7 @@ def build_modules_with_evaluations(
|
|||||||
module_id=module_id,
|
module_id=module_id,
|
||||||
formsemestre_id=formsemestre_id,
|
formsemestre_id=formsemestre_id,
|
||||||
)
|
)
|
||||||
modimpl = models.ModuleImpl.query.get(moduleimpl_id)
|
modimpl = db.session.get(models.ModuleImpl, moduleimpl_id)
|
||||||
assert modimpl.formsemestre.formation.get_cursus().APC_SAE # BUT
|
assert modimpl.formsemestre.formation.get_cursus().APC_SAE # BUT
|
||||||
# Check ModuleImpl
|
# Check ModuleImpl
|
||||||
ues = modimpl.formsemestre.get_ues()
|
ues = modimpl.formsemestre.get_ues()
|
||||||
|
@ -9,6 +9,7 @@ Créer et justifier des absences en utilisant le parametre demijournee
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from tests.unit import sco_fake_gen
|
from tests.unit import sco_fake_gen
|
||||||
|
from app import db
|
||||||
from app.models import Module
|
from app.models import Module
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
from app.scodoc import sco_abs_views
|
from app.scodoc import sco_abs_views
|
||||||
@ -258,7 +259,7 @@ def test_abs_basic(test_client):
|
|||||||
assert len(load_liste_abs) == 2
|
assert len(load_liste_abs) == 2
|
||||||
assert load_liste_abs2[0]["ampm"] == 1
|
assert load_liste_abs2[0]["ampm"] == 1
|
||||||
assert load_liste_abs2[0]["datedmy"] == "22/01/2021"
|
assert load_liste_abs2[0]["datedmy"] == "22/01/2021"
|
||||||
mod = Module.query.get(module_id)
|
mod = db.session.get(Module, module_id)
|
||||||
assert load_liste_abs2[0]["exams"] == mod.code
|
assert load_liste_abs2[0]["exams"] == mod.code
|
||||||
# absjust_only -> seulement les abs justifiés
|
# absjust_only -> seulement les abs justifiés
|
||||||
|
|
||||||
|
@ -4,15 +4,12 @@ et calcul moyennes modules
|
|||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from app.models.modules import Module
|
|
||||||
from app.models.moduleimpls import ModuleImpl
|
|
||||||
|
|
||||||
from tests.unit import setup
|
from tests.unit import setup
|
||||||
from app import db
|
from app import db
|
||||||
from app import models
|
from app.models import Evaluation, EvaluationUEPoids, Module, ModuleImpl, UniteEns
|
||||||
from app.comp import moy_mod
|
from app.comp import moy_mod
|
||||||
from app.comp import moy_ue
|
from app.comp import moy_ue
|
||||||
from app.models import Evaluation
|
|
||||||
from app.scodoc import sco_saisie_notes
|
from app.scodoc import sco_saisie_notes
|
||||||
from app.scodoc.sco_utils import (
|
from app.scodoc.sco_utils import (
|
||||||
NOTES_ATTENTE,
|
NOTES_ATTENTE,
|
||||||
@ -57,18 +54,16 @@ def test_evaluation_poids(test_client):
|
|||||||
# ue1_id=1684
|
# ue1_id=1684
|
||||||
# formation_id=199
|
# formation_id=199
|
||||||
#
|
#
|
||||||
e1 = models.Evaluation.query.get(evaluation_id)
|
e1 = db.session.get(Evaluation, evaluation_id)
|
||||||
ue1 = models.UniteEns.query.get(ue1_id)
|
ue1 = db.session.get(UniteEns, ue1_id)
|
||||||
assert e1.ue_poids == []
|
assert e1.ue_poids == []
|
||||||
p1 = 3.14
|
p1 = 3.14
|
||||||
e1.set_ue_poids(ue1, p1)
|
e1.set_ue_poids(ue1, p1)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
assert e1.get_ue_poids_dict()[ue1_id] == p1
|
assert e1.get_ue_poids_dict()[ue1_id] == p1
|
||||||
ues = models.UniteEns.query.filter_by(
|
ues = UniteEns.query.filter_by(formation_id=formation_id, semestre_idx=2).all()
|
||||||
formation_id=formation_id, semestre_idx=2
|
|
||||||
).all()
|
|
||||||
poids = [1.0, 2.0, 3.0]
|
poids = [1.0, 2.0, 3.0]
|
||||||
for (ue, p) in zip(ues, poids):
|
for ue, p in zip(ues, poids):
|
||||||
e1.set_ue_poids(ue, p)
|
e1.set_ue_poids(ue, p)
|
||||||
assert len(e1.ue_poids) == len(ues)
|
assert len(e1.ue_poids) == len(ues)
|
||||||
assert e1.get_ue_poids_dict()[ues[1].id] == poids[1]
|
assert e1.get_ue_poids_dict()[ues[1].id] == poids[1]
|
||||||
@ -85,15 +80,15 @@ def test_evaluation_poids(test_client):
|
|||||||
# Delete eval
|
# Delete eval
|
||||||
db.session.delete(e1)
|
db.session.delete(e1)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
assert len(models.EvaluationUEPoids.query.all()) == 0
|
assert len(EvaluationUEPoids.query.all()) == 0
|
||||||
|
|
||||||
|
|
||||||
def test_modules_coefs(test_client):
|
def test_modules_coefs(test_client):
|
||||||
"""Coefs vers les UE (BUT)"""
|
"""Coefs vers les UE (BUT)"""
|
||||||
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = setup.build_formation_test()
|
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = setup.build_formation_test()
|
||||||
ue1 = models.UniteEns.query.get(ue1_id)
|
ue1 = db.session.get(UniteEns, ue1_id)
|
||||||
ue2 = models.UniteEns.query.get(ue2_id)
|
ue2 = db.session.get(UniteEns, ue2_id)
|
||||||
mod = models.Module.query.get(module_ids[0])
|
mod = db.session.get(Module, module_ids[0])
|
||||||
coef = 2.5
|
coef = 2.5
|
||||||
mod.set_ue_coef(ue1, coef)
|
mod.set_ue_coef(ue1, coef)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
@ -127,7 +122,7 @@ def test_module_conformity(test_client):
|
|||||||
nb_mods = 1 # 1 seul module
|
nb_mods = 1 # 1 seul module
|
||||||
nb_evals = 1 # 1 seule evaluation pour l'instant
|
nb_evals = 1 # 1 seule evaluation pour l'instant
|
||||||
p1, p2, p3 = 1.0, 2.0, 0.0 # poids de l'éval vers les UE 1, 2 et 3
|
p1, p2, p3 = 1.0, 2.0, 0.0 # poids de l'éval vers les UE 1, 2 et 3
|
||||||
evaluation = models.Evaluation.query.get(evaluation_ids[0])
|
evaluation = db.session.get(Evaluation, evaluation_ids[0])
|
||||||
evaluation.set_ue_poids_dict({ue1.id: p1, ue2.id: p2, ue3.id: p3})
|
evaluation.set_ue_poids_dict({ue1.id: p1, ue2.id: p2, ue3.id: p3})
|
||||||
assert evaluation.get_ue_poids_dict() == {ue1.id: p1, ue2.id: p2, ue3.id: p3}
|
assert evaluation.get_ue_poids_dict() == {ue1.id: p1, ue2.id: p2, ue3.id: p3}
|
||||||
# On n'est pas conforme car p3 est nul alors que c3 est non nul
|
# On n'est pas conforme car p3 est nul alors que c3 est non nul
|
||||||
@ -219,7 +214,7 @@ def test_module_moy(test_client):
|
|||||||
etud = G.create_etud(nom="test")
|
etud = G.create_etud(nom="test")
|
||||||
G.inscrit_etudiant(formsemestre_id, etud)
|
G.inscrit_etudiant(formsemestre_id, etud)
|
||||||
etudid = etud["etudid"]
|
etudid = etud["etudid"]
|
||||||
evaluation1 = models.Evaluation.query.get(evaluation1_ids[0])
|
evaluation1 = db.session.get(Evaluation, evaluation1_ids[0])
|
||||||
# Crée une deuxième évaluation dans le même moduleimpl:
|
# Crée une deuxième évaluation dans le même moduleimpl:
|
||||||
evaluation2_id = G.create_evaluation(
|
evaluation2_id = G.create_evaluation(
|
||||||
moduleimpl_id=evaluation1.moduleimpl_id,
|
moduleimpl_id=evaluation1.moduleimpl_id,
|
||||||
@ -227,7 +222,7 @@ def test_module_moy(test_client):
|
|||||||
description="evaluation 2",
|
description="evaluation 2",
|
||||||
coefficient=coef_e2,
|
coefficient=coef_e2,
|
||||||
)["evaluation_id"]
|
)["evaluation_id"]
|
||||||
evaluation2 = models.Evaluation.query.get(evaluation2_id)
|
evaluation2 = db.session.get(Evaluation, evaluation2_id)
|
||||||
# Coefficients de l'eval 1
|
# Coefficients de l'eval 1
|
||||||
evaluation1.coefficient = coef_e1
|
evaluation1.coefficient = coef_e1
|
||||||
# Poids des évaluations:
|
# Poids des évaluations:
|
||||||
@ -237,10 +232,11 @@ def test_module_moy(test_client):
|
|||||||
evaluation2.set_ue_poids_dict({ue1.id: e2p1, ue2.id: e2p2, ue3.id: e2p3})
|
evaluation2.set_ue_poids_dict({ue1.id: e2p1, ue2.id: e2p2, ue3.id: e2p3})
|
||||||
# Vérifications
|
# Vérifications
|
||||||
moduleimpl_id = evaluation1.moduleimpl_id
|
moduleimpl_id = evaluation1.moduleimpl_id
|
||||||
nb_evals = models.Evaluation.query.filter_by(moduleimpl_id=moduleimpl_id).count()
|
nb_evals = Evaluation.query.filter_by(moduleimpl_id=moduleimpl_id).count()
|
||||||
assert nb_evals == 2
|
assert nb_evals == 2
|
||||||
nb_ues = 3
|
nb_ues = 3
|
||||||
modimpl = ModuleImpl.query.get(moduleimpl_id)
|
modimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
|
|
||||||
# --- Change les notes et recalcule les moyennes du module
|
# --- Change les notes et recalcule les moyennes du module
|
||||||
# (rappel: on a deux évaluations: evaluation1, evaluation2, et un seul étudiant)
|
# (rappel: on a deux évaluations: evaluation1, evaluation2, et un seul étudiant)
|
||||||
def change_notes(n1, n2):
|
def change_notes(n1, n2):
|
||||||
|
@ -30,8 +30,8 @@ def test_ue_moy(test_client):
|
|||||||
) = setup.build_modules_with_evaluations(ue_coefs=ue_coefs, nb_mods=nb_mods)
|
) = setup.build_modules_with_evaluations(ue_coefs=ue_coefs, nb_mods=nb_mods)
|
||||||
assert len(evaluation_ids) == nb_mods
|
assert len(evaluation_ids) == nb_mods
|
||||||
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
||||||
evaluation1 = Evaluation.query.get(evaluation_ids[0])
|
evaluation1 = db.session.get(Evaluation, evaluation_ids[0])
|
||||||
evaluation2 = Evaluation.query.get(evaluation_ids[1])
|
evaluation2 = db.session.get(Evaluation, evaluation_ids[1])
|
||||||
etud = G.create_etud(nom="test")
|
etud = G.create_etud(nom="test")
|
||||||
G.inscrit_etudiant(formsemestre_id, etud)
|
G.inscrit_etudiant(formsemestre_id, etud)
|
||||||
etudid = etud["etudid"]
|
etudid = etud["etudid"]
|
||||||
|
@ -47,6 +47,7 @@ import os
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from app import db
|
||||||
from app.models import Formation, ModuleImpl
|
from app.models import Formation, ModuleImpl
|
||||||
from app.scodoc import sco_edit_formation, sco_formsemestre
|
from app.scodoc import sco_edit_formation, sco_formsemestre
|
||||||
from app.scodoc import sco_edit_matiere
|
from app.scodoc import sco_edit_matiere
|
||||||
@ -72,7 +73,7 @@ def test_formations(test_client):
|
|||||||
acronyme="F1", titre="Formation 1", titre_officiel="Titre officiel 1"
|
acronyme="F1", titre="Formation 1", titre_officiel="Titre officiel 1"
|
||||||
)
|
)
|
||||||
# --- Objet Formation
|
# --- Objet Formation
|
||||||
formation = Formation.query.get(formation_id)
|
formation = db.session.get(Formation, formation_id)
|
||||||
assert isinstance(formation, Formation)
|
assert isinstance(formation, Formation)
|
||||||
assert formation.acronyme == "F1"
|
assert formation.acronyme == "F1"
|
||||||
assert formation.titre == "Formation 1"
|
assert formation.titre == "Formation 1"
|
||||||
@ -128,7 +129,7 @@ def test_formations(test_client):
|
|||||||
)
|
)
|
||||||
|
|
||||||
formation_id2 = G.create_formation(acronyme="", titre="Formation test")
|
formation_id2 = G.create_formation(acronyme="", titre="Formation test")
|
||||||
assert Formation.query.get(formation_id2)
|
assert db.session.get(Formation, formation_id2)
|
||||||
ue3 = G.create_ue(formation_id=formation_id2, acronyme="TST3", titre="ue test3")
|
ue3 = G.create_ue(formation_id=formation_id2, acronyme="TST3", titre="ue test3")
|
||||||
matiere_id4 = G.create_matiere(ue_id=ue3, titre="matière test3")
|
matiere_id4 = G.create_matiere(ue_id=ue3, titre="matière test3")
|
||||||
module_id3 = G.create_module(
|
module_id3 = G.create_module(
|
||||||
@ -291,7 +292,7 @@ def test_formations(test_client):
|
|||||||
li_module = sco_edit_module.module_list()
|
li_module = sco_edit_module.module_list()
|
||||||
assert len(li_module) == 4
|
assert len(li_module) == 4
|
||||||
# Suppression impossible car utilisé dans le semestre formsemestre_idt:
|
# Suppression impossible car utilisé dans le semestre formsemestre_idt:
|
||||||
module3 = ModuleImpl.query.get(mi3).module
|
module3 = db.session.get(ModuleImpl, mi3).module
|
||||||
with pytest.raises(sco_exceptions.ScoNonEmptyFormationObject):
|
with pytest.raises(sco_exceptions.ScoNonEmptyFormationObject):
|
||||||
sco_edit_module.module_delete(module_id=module3.id)
|
sco_edit_module.module_delete(module_id=module3.id)
|
||||||
|
|
||||||
@ -328,7 +329,7 @@ def test_formations(test_client):
|
|||||||
# --- Suppression d'une formation
|
# --- Suppression d'une formation
|
||||||
|
|
||||||
sco_edit_formation.do_formation_delete(formation_id=formation_id2)
|
sco_edit_formation.do_formation_delete(formation_id=formation_id2)
|
||||||
formation = Formation.query.get(formation_id2)
|
formation = db.session.get(Formation, formation_id2)
|
||||||
assert formation is None
|
assert formation is None
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import app
|
import app
|
||||||
|
from app import db
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.res_but import ResultatsSemestreBUT
|
from app.comp.res_but import ResultatsSemestreBUT
|
||||||
from app.models import FormSemestre, ModuleImpl
|
from app.models import FormSemestre, ModuleImpl
|
||||||
@ -75,10 +75,10 @@ def test_notes_rattrapage(test_client):
|
|||||||
_, _, _ = G.create_note(evaluation_id=e_rat["id"], etudid=etud["etudid"], note=11.0)
|
_, _, _ = G.create_note(evaluation_id=e_rat["id"], etudid=etud["etudid"], note=11.0)
|
||||||
|
|
||||||
# --- Vérifications internes structures ScoDoc
|
# --- Vérifications internes structures ScoDoc
|
||||||
formsemestre = FormSemestre.query.get(formsemestre_id)
|
formsemestre = db.session.get(FormSemestre, formsemestre_id)
|
||||||
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
|
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
|
||||||
mod_res = res.modimpls_results[moduleimpl_id]
|
mod_res = res.modimpls_results[moduleimpl_id]
|
||||||
moduleimpl = ModuleImpl.query.get(moduleimpl_id)
|
moduleimpl = db.session.get(ModuleImpl, moduleimpl_id)
|
||||||
# retrouve l'éval. de rattrapage:
|
# retrouve l'éval. de rattrapage:
|
||||||
eval_rat = mod_res.get_evaluation_rattrapage(moduleimpl)
|
eval_rat = mod_res.get_evaluation_rattrapage(moduleimpl)
|
||||||
assert eval_rat.id == e_rat["id"]
|
assert eval_rat.id == e_rat["id"]
|
||||||
|
@ -42,8 +42,9 @@ def test_but_refcomp(test_client):
|
|||||||
assert ref_comp.competences.count() == 13
|
assert ref_comp.competences.count() == 13
|
||||||
assert ref_comp.competences[0].situations.count() == 3
|
assert ref_comp.competences[0].situations.count() == 3
|
||||||
assert ref_comp.competences[0].situations[0].libelle.startswith("Conception ")
|
assert ref_comp.competences[0].situations[0].libelle.startswith("Conception ")
|
||||||
|
competences = ref_comp.competences.all()
|
||||||
assert (
|
assert (
|
||||||
ref_comp.competences[-1].situations[-1].libelle
|
competences[-1].situations.all()[-1].libelle
|
||||||
== "Administration des services multimédia"
|
== "Administration des services multimédia"
|
||||||
)
|
)
|
||||||
# test cascades on delete
|
# test cascades on delete
|
||||||
@ -58,13 +59,13 @@ def test_but_assoc_ue_parcours(test_client):
|
|||||||
dept_id = models.Departement.query.first().id
|
dept_id = models.Departement.query.first().id
|
||||||
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = setup.build_formation_test()
|
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = setup.build_formation_test()
|
||||||
ref_comp: ApcReferentielCompetences = orebut_import_refcomp(REF_RT_XML, dept_id)
|
ref_comp: ApcReferentielCompetences = orebut_import_refcomp(REF_RT_XML, dept_id)
|
||||||
ue = UniteEns.query.get(ue1_id)
|
ue = db.session.get(UniteEns, ue1_id)
|
||||||
assert ue.niveau_competence is None
|
assert ue.niveau_competence is None
|
||||||
niveau = ApcNiveau.query.first()
|
niveau = ApcNiveau.query.first()
|
||||||
ue.niveau_competence = niveau
|
ue.niveau_competence = niveau
|
||||||
db.session.add(ue)
|
db.session.add(ue)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
ue = UniteEns.query.get(ue1_id)
|
ue = db.session.get(UniteEns, ue1_id)
|
||||||
assert ue.niveau_competence == niveau
|
assert ue.niveau_competence == niveau
|
||||||
assert len(niveau.ues) == 1
|
assert len(niveau.ues) == 1
|
||||||
assert niveau.ues[0] == ue
|
assert niveau.ues[0] == ue
|
||||||
@ -74,13 +75,13 @@ def test_but_assoc_refcomp(test_client):
|
|||||||
"""Association formation / référentiel de compétences"""
|
"""Association formation / référentiel de compétences"""
|
||||||
dept_id = models.Departement.query.first().id
|
dept_id = models.Departement.query.first().id
|
||||||
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = setup.build_formation_test()
|
G, formation_id, (ue1_id, ue2_id, ue3_id), module_ids = setup.build_formation_test()
|
||||||
formation: Formation = Formation.query.get(formation_id)
|
formation: Formation = db.session.get(Formation, formation_id)
|
||||||
assert formation is not None
|
assert formation is not None
|
||||||
ref_comp: ApcReferentielCompetences = orebut_import_refcomp(REF_RT_XML, dept_id)
|
ref_comp: ApcReferentielCompetences = orebut_import_refcomp(REF_RT_XML, dept_id)
|
||||||
formation.referentiel_competence_id = ref_comp.id
|
formation.referentiel_competence_id = ref_comp.id
|
||||||
db.session.add(formation)
|
db.session.add(formation)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
ue = UniteEns.query.get(ue1_id)
|
ue = db.session.get(UniteEns, ue1_id)
|
||||||
niveau = (
|
niveau = (
|
||||||
ApcNiveau.query.filter_by(annee="BUT1")
|
ApcNiveau.query.filter_by(annee="BUT1")
|
||||||
.join(ApcCompetence)
|
.join(ApcCompetence)
|
||||||
|
@ -87,7 +87,7 @@ def setup_formation(formation_infos: dict) -> Formation:
|
|||||||
|
|
||||||
# --- Création de la formation
|
# --- Création de la formation
|
||||||
formation_id, _, _ = sco_formations.formation_import_xml(doc)
|
formation_id, _, _ = sco_formations.formation_import_xml(doc)
|
||||||
formation: Formation = Formation.query.get(formation_id)
|
formation: Formation = db.session.get(Formation, formation_id)
|
||||||
assert formation
|
assert formation
|
||||||
return formation
|
return formation
|
||||||
|
|
||||||
@ -116,11 +116,11 @@ def create_formsemestre(
|
|||||||
elt_sem_apo=elt_sem_apo,
|
elt_sem_apo=elt_sem_apo,
|
||||||
elt_annee_apo=elt_annee_apo,
|
elt_annee_apo=elt_annee_apo,
|
||||||
)
|
)
|
||||||
|
db.session.add(formsemestre)
|
||||||
|
db.session.flush()
|
||||||
# set responsable (list)
|
# set responsable (list)
|
||||||
a_user = User.query.first()
|
a_user = User.query.first()
|
||||||
formsemestre.responsables = [a_user]
|
formsemestre.responsables = [a_user]
|
||||||
db.session.add(formsemestre)
|
|
||||||
db.session.flush()
|
|
||||||
formsemestre.add_etape(etape_apo)
|
formsemestre.add_etape(etape_apo)
|
||||||
# Ajoute tous les modules du semestre sans parcours OU avec l'un des parcours indiqués
|
# Ajoute tous les modules du semestre sans parcours OU avec l'un des parcours indiqués
|
||||||
sem_parcours_ids = {p.id for p in parcours}
|
sem_parcours_ids = {p.id for p in parcours}
|
||||||
|
@ -66,7 +66,7 @@ def import_formation(dept_id: int) -> Formation:
|
|||||||
doc = f.read()
|
doc = f.read()
|
||||||
# --- Création de la formation (import programme)
|
# --- Création de la formation (import programme)
|
||||||
f = sco_formations.formation_import_xml(doc)
|
f = sco_formations.formation_import_xml(doc)
|
||||||
formation = Formation.query.get(f[0])
|
formation = db.session.get(Formation, f[0])
|
||||||
# --- Association ref. comp.
|
# --- Association ref. comp.
|
||||||
with open(REFCOMP_FILENAME, encoding="utf-8") as f:
|
with open(REFCOMP_FILENAME, encoding="utf-8") as f:
|
||||||
xml_data = f.read()
|
xml_data = f.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user