1
0
forked from ScoDoc/ScoDoc

Fix: édition coefs semestres, retour au semestre sélectionné.

This commit is contained in:
Emmanuel Viennet 2021-12-10 15:51:43 +01:00
parent 2f9b2a5a2d
commit 272de740e1
3 changed files with 14 additions and 6 deletions

View File

@ -67,13 +67,19 @@ def df_load_module_coefs(formation_id: int, semestre_idx: int = None) -> pd.Data
ue_ids = [ue.id for ue in ues]
module_ids = [module.id for module in modules]
module_coefs_df = pd.DataFrame(columns=module_ids, index=ue_ids, dtype=float)
for mod_coef in (
query = (
db.session.query(ModuleUECoef)
.filter(UniteEns.formation_id == formation_id)
.filter(ModuleUECoef.ue_id == UniteEns.id)
):
)
if semestre_idx is not None:
query = query.filter(UniteEns.semestre_idx == semestre_idx)
for mod_coef in query:
module_coefs_df[mod_coef.module_id][mod_coef.ue_id] = mod_coef.coef
module_coefs_df.fillna(value=0, inplace=True)
return module_coefs_df, ues, modules

View File

@ -32,7 +32,7 @@ import flask
from flask import url_for, render_template
from flask import g, request
from flask_login import current_user
from app.models import Matiere, UniteEns
from app.models import Matiere, Module
import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu
@ -89,7 +89,7 @@ def module_list(*args, **kw):
def do_module_create(args) -> int:
"create a module"
"Create a module. Returns id of new object."
# create
from app.scodoc import sco_formations
@ -288,12 +288,14 @@ def module_create(matiere_id=None, module_type=None, semestre_id=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
else:
do_module_create(tf[2])
module_id = do_module_create(tf[2])
mod = Module.query.get(module_id)
return flask.redirect(
url_for(
"notes.ue_table",
scodoc_dept=g.scodoc_dept,
formation_id=ue.formation_id,
semestre_idx=mod.semestre_id,
)
)

View File

@ -175,7 +175,7 @@ def edit_modules_ue_coefs():
],
page_title=f"Coefs programme {formation.acronyme}",
),
f"""<h2>Formation {formation.titre} ({formation.acronyme})
f"""<h2>Formation {formation.titre} ({formation.acronyme})
[version {formation.version}] code {formation.formation_code}
{lockicon}
</h2>