forked from ScoDoc/ScoDoc
Affichage poids sur tableau bord module + fix #222
This commit is contained in:
parent
c882a96556
commit
ac5c433f5a
@ -76,11 +76,11 @@ class Evaluation(db.Model):
|
|||||||
db.session.add(copy)
|
db.session.add(copy)
|
||||||
return copy
|
return copy
|
||||||
|
|
||||||
def set_ue_poids(self, ue, poids: float):
|
def set_ue_poids(self, ue, poids: float) -> None:
|
||||||
"""Set poids évaluation vers cette UE"""
|
"""Set poids évaluation vers cette UE"""
|
||||||
self.update_ue_poids_dict({ue.id: poids})
|
self.update_ue_poids_dict({ue.id: poids})
|
||||||
|
|
||||||
def set_ue_poids_dict(self, ue_poids_dict: dict):
|
def set_ue_poids_dict(self, ue_poids_dict: dict) -> None:
|
||||||
"""set poids vers les UE (remplace existants)
|
"""set poids vers les UE (remplace existants)
|
||||||
ue_poids_dict = { ue_id : poids }
|
ue_poids_dict = { ue_id : poids }
|
||||||
"""
|
"""
|
||||||
@ -91,16 +91,23 @@ class Evaluation(db.Model):
|
|||||||
self.ue_poids = L
|
self.ue_poids = L
|
||||||
self.moduleimpl.invalidate_evaluations_poids() # inval cache
|
self.moduleimpl.invalidate_evaluations_poids() # inval cache
|
||||||
|
|
||||||
def update_ue_poids_dict(self, ue_poids_dict: dict):
|
def update_ue_poids_dict(self, ue_poids_dict: dict) -> None:
|
||||||
"""update poids vers UE (ajoute aux existants)"""
|
"""update poids vers UE (ajoute aux existants)"""
|
||||||
current = self.get_ue_poids_dict()
|
current = self.get_ue_poids_dict()
|
||||||
current.update(ue_poids_dict)
|
current.update(ue_poids_dict)
|
||||||
self.set_ue_poids_dict(current)
|
self.set_ue_poids_dict(current)
|
||||||
|
|
||||||
def get_ue_poids_dict(self):
|
def get_ue_poids_dict(self) -> dict:
|
||||||
"""returns { ue_id : poids }"""
|
"""returns { ue_id : poids }"""
|
||||||
return {p.ue.id: p.poids for p in self.ue_poids}
|
return {p.ue.id: p.poids for p in self.ue_poids}
|
||||||
|
|
||||||
|
def get_ue_poids_str(self) -> str:
|
||||||
|
"""string describing poids, for excel cells and pdfs
|
||||||
|
Note: si les poids ne sont pas initialisés (poids par défaut),
|
||||||
|
ils ne sont pas affichés.
|
||||||
|
"""
|
||||||
|
return ", ".join([f"{p.ue.acronyme}: {p.poids}" for p in self.ue_poids])
|
||||||
|
|
||||||
|
|
||||||
class EvaluationUEPoids(db.Model):
|
class EvaluationUEPoids(db.Model):
|
||||||
"""Poids des évaluations (BUT)
|
"""Poids des évaluations (BUT)
|
||||||
|
@ -32,6 +32,7 @@ import flask
|
|||||||
from flask import url_for, g, request
|
from flask import url_for, g, request
|
||||||
|
|
||||||
from app import models
|
from app import models
|
||||||
|
from app.models.evaluations import Evaluation
|
||||||
from app.models.moduleimpls import ModuleImpl
|
from app.models.moduleimpls import ModuleImpl
|
||||||
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
|
||||||
@ -395,6 +396,7 @@ def _make_table_notes(
|
|||||||
key_mgr,
|
key_mgr,
|
||||||
note_sur_20,
|
note_sur_20,
|
||||||
keep_numeric,
|
keep_numeric,
|
||||||
|
format=format,
|
||||||
)
|
)
|
||||||
columns_ids.append(e["evaluation_id"])
|
columns_ids.append(e["evaluation_id"])
|
||||||
#
|
#
|
||||||
@ -408,7 +410,7 @@ def _make_table_notes(
|
|||||||
# Si module, ajoute la (les) "moyenne(s) du module:
|
# Si module, ajoute la (les) "moyenne(s) du module:
|
||||||
if mode == "module":
|
if mode == "module":
|
||||||
if len(evals) > 1:
|
if len(evals) > 1:
|
||||||
# Moyenne de l'étudant dans le module
|
# Moyenne de l'étudiant dans le module
|
||||||
# Affichée même en APC à titre indicatif
|
# Affichée même en APC à titre indicatif
|
||||||
_add_moymod_column(
|
_add_moymod_column(
|
||||||
sem["formsemestre_id"],
|
sem["formsemestre_id"],
|
||||||
@ -637,6 +639,7 @@ def _add_eval_columns(
|
|||||||
K,
|
K,
|
||||||
note_sur_20,
|
note_sur_20,
|
||||||
keep_numeric,
|
keep_numeric,
|
||||||
|
format="html",
|
||||||
):
|
):
|
||||||
"""Add eval e"""
|
"""Add eval e"""
|
||||||
nb_notes = 0
|
nb_notes = 0
|
||||||
@ -645,6 +648,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
|
||||||
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
NotesDB = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
etudid = row["etudid"]
|
etudid = row["etudid"]
|
||||||
@ -706,9 +710,12 @@ def _add_eval_columns(
|
|||||||
|
|
||||||
row_coefs[evaluation_id] = "coef. %s" % e["coefficient"]
|
row_coefs[evaluation_id] = "coef. %s" % e["coefficient"]
|
||||||
if is_apc:
|
if is_apc:
|
||||||
|
if format == "html":
|
||||||
row_poids[evaluation_id] = _mini_table_eval_ue_poids(
|
row_poids[evaluation_id] = _mini_table_eval_ue_poids(
|
||||||
evaluation_id, evals_poids, ues
|
evaluation_id, evals_poids, ues
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
row_poids[evaluation_id] = e_o.get_ue_poids_str()
|
||||||
if note_sur_20:
|
if note_sur_20:
|
||||||
nmax = 20.0
|
nmax = 20.0
|
||||||
else:
|
else:
|
||||||
|
@ -31,9 +31,10 @@ import time
|
|||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from app.auth.models import User
|
|
||||||
|
|
||||||
|
from app.auth.models import User
|
||||||
from app.models import ModuleImpl
|
from app.models import ModuleImpl
|
||||||
|
from app.models.evaluations import Evaluation
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
@ -391,8 +392,9 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
)
|
)
|
||||||
H.append("""<table class="moduleimpl_evaluations">""")
|
H.append("""<table class="moduleimpl_evaluations">""")
|
||||||
eval_index = len(mod_evals) - 1
|
eval_index = len(mod_evals) - 1
|
||||||
first = True
|
first_eval = True
|
||||||
for eval in mod_evals:
|
for eval in mod_evals:
|
||||||
|
evaluation = Evaluation.query.get(eval["evaluation_id"]) # TODO unifier
|
||||||
etat = sco_evaluations.do_evaluation_etat(
|
etat = sco_evaluations.do_evaluation_etat(
|
||||||
eval["evaluation_id"],
|
eval["evaluation_id"],
|
||||||
partition_id=partition_id,
|
partition_id=partition_id,
|
||||||
@ -406,9 +408,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
else:
|
else:
|
||||||
tr_class = "mievr"
|
tr_class = "mievr"
|
||||||
tr_class_1 = "mievr"
|
tr_class_1 = "mievr"
|
||||||
if first:
|
if not first_eval:
|
||||||
first = False
|
|
||||||
else:
|
|
||||||
H.append("""<tr><td colspan="8"> </td></tr>""")
|
H.append("""<tr><td colspan="8"> </td></tr>""")
|
||||||
tr_class_1 += " mievr_spaced"
|
tr_class_1 += " mievr_spaced"
|
||||||
H.append("""<tr class="%s"><td class="mievr_tit" colspan="8">""" % tr_class_1)
|
H.append("""<tr class="%s"><td class="mievr_tit" colspan="8">""" % tr_class_1)
|
||||||
@ -586,19 +586,35 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
H.append("""</td></tr>""")
|
H.append("""</td></tr>""")
|
||||||
#
|
#
|
||||||
if etat["nb_notes"] == 0:
|
if etat["nb_notes"] == 0:
|
||||||
H.append("""<tr class="%s"><td colspan="8"> """ % tr_class)
|
H.append("""<tr class="%s"><td></td>""" % tr_class)
|
||||||
H.append("""</td></tr>""")
|
if modimpl.module.is_apc():
|
||||||
|
H.append(
|
||||||
|
f"""<td colspan="7" class="eval_poids">{
|
||||||
|
evaluation.get_ue_poids_str()}</td>"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
H.append('<td colspan="7"></td>')
|
||||||
|
H.append("""</tr>""")
|
||||||
else: # il y a deja des notes saisies
|
else: # il y a deja des notes saisies
|
||||||
gr_moyennes = etat["gr_moyennes"]
|
gr_moyennes = etat["gr_moyennes"]
|
||||||
|
first_group = True
|
||||||
for gr_moyenne in gr_moyennes:
|
for gr_moyenne in gr_moyennes:
|
||||||
H.append("""<tr class="%s">""" % tr_class)
|
H.append("""<tr class="%s">""" % tr_class)
|
||||||
H.append("""<td colspan="2"> </td>""")
|
H.append("""<td> </td>""")
|
||||||
|
if first_group and modimpl.module.is_apc():
|
||||||
|
H.append(
|
||||||
|
f"""<td class="eval_poids" colspan="3">{
|
||||||
|
evaluation.get_ue_poids_str()}</td>"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
H.append("""<td colspan="3"></td>""")
|
||||||
|
first_group = False
|
||||||
if gr_moyenne["group_name"] is None:
|
if gr_moyenne["group_name"] is None:
|
||||||
name = "Tous" # tous
|
name = "Tous" # tous
|
||||||
else:
|
else:
|
||||||
name = "Groupe %s" % gr_moyenne["group_name"]
|
name = "Groupe %s" % gr_moyenne["group_name"]
|
||||||
H.append(
|
H.append(
|
||||||
"""<td colspan="5" class="mievr_grtit">%s </td><td>""" % name
|
"""<td colspan="3" class="mievr_grtit">%s </td><td>""" % name
|
||||||
)
|
)
|
||||||
if gr_moyenne["gr_nb_notes"] > 0:
|
if gr_moyenne["gr_nb_notes"] > 0:
|
||||||
H.append("%(gr_moy)s" % gr_moyenne)
|
H.append("%(gr_moy)s" % gr_moyenne)
|
||||||
@ -637,6 +653,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
H.append("""</a>""")
|
H.append("""</a>""")
|
||||||
H.append("</span>")
|
H.append("</span>")
|
||||||
H.append("""</td></tr>""")
|
H.append("""</td></tr>""")
|
||||||
|
first_eval = False
|
||||||
|
|
||||||
#
|
#
|
||||||
if caneditevals or not sem["etat"]:
|
if caneditevals or not sem["etat"]:
|
||||||
|
@ -1476,6 +1476,9 @@ span.evalindex {
|
|||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.moduleimpl_evaluations td.eval_poids {
|
||||||
|
color:rgb(0, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
/* Formulaire edition des partitions */
|
/* Formulaire edition des partitions */
|
||||||
form#editpart table {
|
form#editpart table {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.1.10"
|
SCOVERSION = "9.1.11"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user