forked from ScoDoc/ScoDoc
Améliore édition programmes classiques
This commit is contained in:
parent
63784e341a
commit
44123c022e
@ -601,7 +601,12 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list
|
||||
_add_ue_semestre_id(ues_externes, is_apc)
|
||||
ues.sort(key=lambda u: (u["semestre_id"], u["numero"]))
|
||||
ues_externes.sort(key=lambda u: (u["semestre_id"], u["numero"]))
|
||||
has_duplicate_ue_codes = len(set([ue["ue_code"] for ue in ues])) != len(ues)
|
||||
# Codes dupliqués (pour aider l'utilisateur)
|
||||
seen = set()
|
||||
duplicated_codes = {
|
||||
ue["ue_code"] for ue in ues if ue["ue_code"] in seen or seen.add(ue["ue_code"])
|
||||
}
|
||||
ues_with_duplicated_code = [ue for ue in ues if ue["ue_code"] in duplicated_codes]
|
||||
|
||||
has_perm_change = current_user.has_permission(Permission.ScoChangeFormation)
|
||||
# editable = (not locked) and has_perm_change
|
||||
@ -664,11 +669,17 @@ du programme" (menu "Semestre") si vous avez un semestre en cours);
|
||||
if msg:
|
||||
H.append('<p class="msg">' + msg + "</p>")
|
||||
|
||||
if has_duplicate_ue_codes:
|
||||
if ues_with_duplicated_code:
|
||||
H.append(
|
||||
"""<div class="ue_warning"><span>Attention: plusieurs UE de cette
|
||||
formation ont le même code. Il faut corriger cela ci-dessous,
|
||||
sinon les calculs d'ECTS seront erronés !</span></div>"""
|
||||
f"""<div class="ue_warning"><span>Attention: plusieurs UE de cette
|
||||
formation ont le même code : <tt>{
|
||||
', '.join([
|
||||
'<a class="stdlink" href="' + url_for( "notes.ue_edit", scodoc_dept=g.scodoc_dept, ue_id=ue["ue_id"] )
|
||||
+ '">' + ue["acronyme"] + " (code " + ue["ue_code"] + ")</a>"
|
||||
for ue in ues_with_duplicated_code ])
|
||||
}</tt>.
|
||||
Il faut corriger cela, sinon les capitalisations et ECTS seront
|
||||
erronés !</span></div>"""
|
||||
)
|
||||
|
||||
# Description de la formation
|
||||
@ -930,8 +941,8 @@ def _ue_table_ues(
|
||||
|
||||
if cur_ue_semestre_id != ue["semestre_id"]:
|
||||
cur_ue_semestre_id = ue["semestre_id"]
|
||||
if iue > 0:
|
||||
H.append("</ul>")
|
||||
# if iue > 0:
|
||||
# H.append("</ul>")
|
||||
if ue["semestre_id"] == sco_codes_parcours.UE_SEM_DEFAULT:
|
||||
lab = "Pas d'indication de semestre:"
|
||||
else:
|
||||
@ -953,7 +964,6 @@ def _ue_table_ues(
|
||||
)
|
||||
else:
|
||||
H.append(arrow_none)
|
||||
iue += 1
|
||||
ue["acro_titre"] = str(ue["acronyme"])
|
||||
if ue["titre"] != ue["acronyme"]:
|
||||
ue["acro_titre"] += " " + str(ue["titre"])
|
||||
@ -1001,6 +1011,14 @@ def _ue_table_ues(
|
||||
delete_disabled_icon,
|
||||
)
|
||||
)
|
||||
if (iue >= len(ues) - 1) or ue["semestre_id"] != ues[iue + 1]["semestre_id"]:
|
||||
H.append(
|
||||
f"""</ul><ul><li><a href="{url_for('notes.ue_create', scodoc_dept=g.scodoc_dept,
|
||||
formation_id=ue['formation_id'], semestre_idx=ue['semestre_id'])
|
||||
}">Ajouter une UE dans le semestre {ue['semestre_id'] or ''}</a></li></ul>"""
|
||||
)
|
||||
iue += 1
|
||||
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
|
@ -1286,7 +1286,11 @@ def check_formation_ues(formation_id):
|
||||
for x in ue_multiples[ue["ue_id"]]
|
||||
]
|
||||
slist = ", ".join(
|
||||
["%(titreannee)s (<em>semestre %(semestre_id)s</em>)" % s for s in sems]
|
||||
[
|
||||
"""%(titreannee)s (<em>semestre <b class="fontred">%(semestre_id)s</b></em>)"""
|
||||
% s
|
||||
for s in sems
|
||||
]
|
||||
)
|
||||
H.append("<li><b>%s</b> : %s</li>" % (ue["acronyme"], slist))
|
||||
H.append("</ul></div>")
|
||||
|
@ -1707,6 +1707,9 @@ ul.notes_ue_list {
|
||||
li.notes_ue_list {
|
||||
margin-top: 9px;
|
||||
list-style-type: none;
|
||||
border: 1px solid maroon;
|
||||
border-radius: 10px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
span.ue_type_1 {
|
||||
color: green;
|
||||
@ -1749,6 +1752,7 @@ ul.notes_matiere_list {
|
||||
background-color: rgb(220,220,220);
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
border-top: 1px solid maroon;
|
||||
}
|
||||
|
||||
ul.notes_module_list {
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.1.60"
|
||||
SCOVERSION = "9.1.61"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user