forked from ScoDoc/ScoDoc
Methode .modimpls_parcours listant les modimpls d'un parcours
This commit is contained in:
parent
6030d12aca
commit
06be6d0ac5
@ -6,6 +6,7 @@ import datetime
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
import flask_sqlalchemy
|
import flask_sqlalchemy
|
||||||
|
from sqlalchemy.sql import text
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app import log
|
from app import log
|
||||||
@ -14,6 +15,7 @@ from app.models import SHORT_STR_LEN
|
|||||||
from app.models import CODE_STR_LEN
|
from app.models import CODE_STR_LEN
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
from app.models.but_refcomp import ApcParcours
|
||||||
from app.models.but_refcomp import parcours_formsemestre
|
from app.models.but_refcomp import parcours_formsemestre
|
||||||
from app.models.etudiants import Identite
|
from app.models.etudiants import Identite
|
||||||
from app.models.modules import Module
|
from app.models.modules import Module
|
||||||
@ -233,6 +235,28 @@ class FormSemestre(db.Model):
|
|||||||
)
|
)
|
||||||
return modimpls
|
return modimpls
|
||||||
|
|
||||||
|
def modimpls_parcours(self, parcours: ApcParcours) -> list[ModuleImpl]:
|
||||||
|
"""Liste des modimpls du semestre (sans les bonus (?)) dans le parcours donné.
|
||||||
|
- triée par type/numéro/code ??
|
||||||
|
"""
|
||||||
|
cursor = db.session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT modimpl.id
|
||||||
|
FROM notes_moduleimpl modimpl, notes_modules mod,
|
||||||
|
parcours_modules pm, parcours_formsemestre pf
|
||||||
|
WHERE modimpl.formsemestre_id = :formsemestre_id
|
||||||
|
AND modimpl.module_id = mod.id
|
||||||
|
AND pm.module_id = mod.id
|
||||||
|
AND pm.parcours_id = pf.parcours_id
|
||||||
|
AND pf.parcours_id = :parcours_id
|
||||||
|
AND pf.formsemestre_id = :formsemestre_id
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{"formsemestre_id": self.id, "parcours_id": parcours.id},
|
||||||
|
)
|
||||||
|
return [ModuleImpl.query.get(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"""
|
"""Vrai si user peut modifier ce semestre"""
|
||||||
if not user.has_permission(Permission.ScoImplement): # pas chef
|
if not user.has_permission(Permission.ScoImplement): # pas chef
|
||||||
|
Loading…
Reference in New Issue
Block a user