forked from ScoDoc/ScoDoc
Améliore page inscriptions UEs BUT: indique parcours.
This commit is contained in:
parent
5442143d9d
commit
5103f162a7
@ -99,6 +99,15 @@ class Partition(db.Model):
|
||||
}
|
||||
return d
|
||||
|
||||
def get_etud_group(self, etudid: int) -> "GroupDescr":
|
||||
"Le groupe de l'étudiant dans cette partition, ou None si pas présent"
|
||||
return (
|
||||
GroupDescr.query.filter_by(partition_id=self.id)
|
||||
.join(group_membership)
|
||||
.filter_by(etudid=etudid)
|
||||
.first()
|
||||
)
|
||||
|
||||
|
||||
class GroupDescr(db.Model):
|
||||
"""Description d'un groupe d'une partition"""
|
||||
|
@ -36,7 +36,13 @@ from flask_login import current_user
|
||||
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import FormSemestre, Identite, ScolarFormSemestreValidation, UniteEns
|
||||
from app.models import (
|
||||
FormSemestre,
|
||||
Identite,
|
||||
Partition,
|
||||
ScolarFormSemestreValidation,
|
||||
UniteEns,
|
||||
)
|
||||
|
||||
from app import log
|
||||
from app.tables import list_etuds
|
||||
@ -517,11 +523,23 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) ->
|
||||
(UniteEns.query.get(ue_id) for ue_id in ue_ids),
|
||||
key=lambda u: (u.numero or 0, u.acronyme),
|
||||
)
|
||||
H.append("""<table><tr><th></th>""")
|
||||
H.append(
|
||||
"""<table id="but_ue_inscriptions" class="stripe compact">
|
||||
<thead>
|
||||
<tr><th>Nom</th><th>Parcours</th>
|
||||
"""
|
||||
)
|
||||
for ue in ues:
|
||||
H.append(f"""<th title="{ue.titre or ''}">{ue.acronyme}</th>""")
|
||||
H.append("""</tr>""")
|
||||
|
||||
H.append(
|
||||
"""</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
"""
|
||||
)
|
||||
partition_parcours: Partition = Partition.query.filter_by(
|
||||
formsemestre=res.formsemestre, partition_name=scu.PARTITION_PARCOURS
|
||||
).first()
|
||||
etuds = list_etuds.etuds_sorted_from_ids(table_inscr.keys())
|
||||
for etud in etuds:
|
||||
ues_etud = table_inscr[etud.id]
|
||||
@ -534,6 +552,11 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) ->
|
||||
)}"
|
||||
>{etud.nomprenom}</a></td>"""
|
||||
)
|
||||
# Parcours:
|
||||
group = partition_parcours.get_etud_group(etud.id)
|
||||
parcours_name = group.group_name if group else ""
|
||||
H.append(f"""<td class="parcours">{parcours_name}</td>""")
|
||||
# UEs:
|
||||
for ue in ues:
|
||||
td_class = ""
|
||||
est_inscr = ues_etud.get(ue.id) # None si pas concerné
|
||||
@ -568,24 +591,26 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) ->
|
||||
content = f"""<input type="checkbox"
|
||||
{'checked' if est_inscr else ''}
|
||||
{'disabled' if read_only else ''}
|
||||
title="{etud.nomprenom} {'inscrit' if est_inscr else 'non inscrit'} à l'UE {ue.acronyme}. {expl_validation}",
|
||||
title="{etud.nomprenom} {'inscrit' if est_inscr else 'non inscrit'} à l'UE {ue.acronyme}. {expl_validation}"
|
||||
onchange="change_ue_inscr(this);"
|
||||
data-url_inscr={
|
||||
data-url_inscr="{
|
||||
url_for("notes.etud_inscrit_ue",
|
||||
scodoc_dept=g.scodoc_dept, etudid=etud.id,
|
||||
formsemestre_id=res.formsemestre.id, ue_id=ue.id)
|
||||
}
|
||||
data-url_desinscr={
|
||||
}"
|
||||
data-url_desinscr="{
|
||||
url_for("notes.etud_desinscrit_ue",
|
||||
scodoc_dept=g.scodoc_dept, etudid=etud.id,
|
||||
formsemestre_id=res.formsemestre.id, ue_id=ue.id)
|
||||
}
|
||||
}"
|
||||
/>
|
||||
"""
|
||||
|
||||
H.append(f"""<td{td_class}>{content}</td>""")
|
||||
H.append(
|
||||
"""</table>
|
||||
"""
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<div class="help">
|
||||
L'inscription ou désinscription aux UEs du BUT n'affecte pas les inscriptions aux modules
|
||||
|
@ -2066,6 +2066,17 @@ form.list_but_ue_inscriptions td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
table#but_ue_inscriptions {
|
||||
margin-left: 16px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
div#but_ue_inscriptions_filter {
|
||||
margin-left: 16px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
/* Formulaire edition des partitions */
|
||||
form#editpart table {
|
||||
border: 1px solid gray;
|
||||
|
@ -15,3 +15,23 @@ function change_ue_inscr(elt) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$("table#but_ue_inscriptions").DataTable(
|
||||
{
|
||||
paging: false,
|
||||
searching: true,
|
||||
info: false,
|
||||
autoWidth: false,
|
||||
fixedHeader: {
|
||||
header: true,
|
||||
footer: false
|
||||
},
|
||||
orderCellsTop: true, // cellules ligne 1 pour tri
|
||||
aaSorting: [], // Prevent initial sorting
|
||||
"oLanguage": {
|
||||
"sSearch": "Chercher :"
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user