forked from ScoDoc/ScoDoc
Ajoute préférence pour empêcher l'édition des poids des évaluations. Closes #389
This commit is contained in:
parent
1813e3c7ce
commit
f69ce75b1f
@ -43,13 +43,14 @@ from app.models.formsemestre import FormSemestre
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.sco_utils import ModuleType
|
||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_evaluation_db
|
||||
from app.scodoc import sco_moduleimpl
|
||||
from app.scodoc import sco_permissions_check
|
||||
from app.scodoc import sco_preferences
|
||||
|
||||
|
||||
def evaluation_create_form(
|
||||
@ -70,24 +71,25 @@ def evaluation_create_form(
|
||||
]
|
||||
mod = modimpl_o["module"]
|
||||
formsemestre_id = modimpl_o["formsemestre_id"]
|
||||
sem = FormSemestre.query.get(formsemestre_id)
|
||||
sem_ues = sem.query_ues(with_sport=False).all()
|
||||
formsemestre = FormSemestre.query.get(formsemestre_id)
|
||||
sem_ues = formsemestre.query_ues(with_sport=False).all()
|
||||
is_malus = mod["module_type"] == ModuleType.MALUS
|
||||
is_apc = mod["module_type"] in (ModuleType.RESSOURCE, ModuleType.SAE)
|
||||
|
||||
preferences = sco_preferences.SemPreferences(formsemestre.id)
|
||||
can_edit_poids = not preferences["but_disable_edit_poids_evaluations"]
|
||||
min_note_max = scu.NOTES_PRECISION # le plus petit bareme possible
|
||||
#
|
||||
if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=moduleimpl_id):
|
||||
return (
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Opération non autorisée</h2><p>"
|
||||
+ "Modification évaluation impossible pour %s"
|
||||
% current_user.get_nomplogin()
|
||||
+ "</p>"
|
||||
+ '<p><a href="moduleimpl_status?moduleimpl_id=%s">Revenir</a></p>'
|
||||
% (moduleimpl_id,)
|
||||
+ html_sco_header.sco_footer()
|
||||
)
|
||||
return f"""
|
||||
{html_sco_header.sco_header()}
|
||||
<h2>Opération non autorisée</h2>
|
||||
<p>Modification évaluation impossible pour {current_user.get_nomplogin()}</p>
|
||||
<p><a href="{url_for('notes.moduleimpl_status',
|
||||
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
|
||||
}" class="stdlink">Revenir</a>
|
||||
</p>
|
||||
{html_sco_header.sco_footer()}
|
||||
"""
|
||||
if not edit:
|
||||
# création nouvel
|
||||
if moduleimpl_id is None:
|
||||
@ -122,19 +124,16 @@ def evaluation_create_form(
|
||||
else:
|
||||
min_note_max_str = "0"
|
||||
#
|
||||
mod_descr = '<a href="moduleimpl_status?moduleimpl_id=%s">%s %s</a> %s' % (
|
||||
moduleimpl_id,
|
||||
mod["code"] or "module sans code",
|
||||
mod["titre"],
|
||||
link,
|
||||
)
|
||||
H = [
|
||||
f"""<h3>{action} en
|
||||
{scu.MODULE_TYPE_NAMES[mod["module_type"]]} {mod_descr}</h3>
|
||||
{scu.MODULE_TYPE_NAMES[mod["module_type"]]} <a href="{
|
||||
url_for("notes.moduleimpl_status",
|
||||
scodoc_dept=g.scodoc_dept, moduleimpl_id=moduleimpl_id)
|
||||
}">{mod["code"] or "module sans code"} {mod["titre"]}</a> {link}</h3>
|
||||
"""
|
||||
]
|
||||
|
||||
heures = ["%02dh%02d" % (h, m) for h in range(8, 19) for m in (0, 30)]
|
||||
heures = [f"{h:02d}h{m:02d}" for h in range(8, 19) for m in (0, 30)]
|
||||
#
|
||||
initvalues["visibulletin"] = initvalues.get("visibulletin", True)
|
||||
if initvalues["visibulletin"]:
|
||||
@ -296,14 +295,18 @@ def evaluation_create_form(
|
||||
"size": 2,
|
||||
"type": "float",
|
||||
"explanation": f"""
|
||||
<span class="eval_coef_ue" title="coef. du module dans cette UE">({"coef. mod.:" +str(coef_ue) if coef_ue else "ce module n'a pas de coef. dans cette UE"})</span>
|
||||
<span class="eval_coef_ue" title="coef. du module dans cette UE">({
|
||||
"coef. mod.:" +str(coef_ue) if coef_ue
|
||||
else "ce module n'a pas de coef. dans cette UE"
|
||||
})</span>
|
||||
<span class="eval_coef_ue_titre">{ue.titre}</span>
|
||||
""",
|
||||
"allow_null": False,
|
||||
# ok si poids nul ou coef vers l'UE nul:
|
||||
"validator": lambda val, field: (not val)
|
||||
or ue_coef_dict.get(int(field[len("poids_") :]), 0.0) != 0,
|
||||
"enabled": coef_ue != 0 or initvalues[f"poids_{ue.id}"] != 0.0,
|
||||
"enabled": (coef_ue != 0 or initvalues[f"poids_{ue.id}"] != 0.0)
|
||||
and can_edit_poids,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
@ -204,6 +204,7 @@ PREF_CATEGORIES = (
|
||||
# sur page "Paramètres"
|
||||
("general", {}),
|
||||
("misc", {"title": "Divers"}),
|
||||
("apc", {"title": "BUT et Approches par Compétences"}),
|
||||
("abs", {"title": "Suivi des absences", "related": ("bul",)}),
|
||||
("portal", {"title": "Liaison avec portail (Apogée, etc)"}),
|
||||
(
|
||||
@ -371,6 +372,7 @@ class BasePreferences(object):
|
||||
"only_global": False,
|
||||
},
|
||||
),
|
||||
# ------------------ APC / BUT
|
||||
(
|
||||
"but_moy_skip_empty_ues",
|
||||
{
|
||||
@ -380,7 +382,19 @@ class BasePreferences(object):
|
||||
Si cette option est cochée, ne prend pas en compte les UEs sans notes. <b>Attention: changer ce réglage va modifier toutes
|
||||
les moyennes du semestre !</b>. Aucun effet dans les formations non BUT.""",
|
||||
"input_type": "boolcheckbox",
|
||||
"category": "misc",
|
||||
"category": "apc",
|
||||
"labels": ["non", "oui"],
|
||||
"only_global": False,
|
||||
},
|
||||
),
|
||||
(
|
||||
"but_disable_edit_poids_evaluations",
|
||||
{
|
||||
"initvalue": 0,
|
||||
"title": "Interdire de modifier les poids des évaluations",
|
||||
"explanation": """empêche la modification des poids des évaluations""",
|
||||
"input_type": "boolcheckbox",
|
||||
"category": "apc",
|
||||
"labels": ["non", "oui"],
|
||||
"only_global": False,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user