Fix petits bugs parcours BUT, cosmetic

This commit is contained in:
Emmanuel Viennet 2023-05-13 18:35:10 +02:00
parent 30929a470c
commit 94c5c51983
10 changed files with 54 additions and 23 deletions

View File

@ -51,7 +51,9 @@ class Formation(db.Model):
) )
ues = db.relationship("UniteEns", backref="formation", lazy="dynamic") ues = db.relationship("UniteEns", backref="formation", lazy="dynamic")
formsemestres = db.relationship("FormSemestre", lazy="dynamic", backref="formation") formsemestres = db.relationship("FormSemestre", lazy="dynamic", backref="formation")
ues = db.relationship("UniteEns", lazy="dynamic", backref="formation") ues = db.relationship(
"UniteEns", lazy="dynamic", backref="formation", order_by="UniteEns.numero"
)
modules = db.relationship("Module", lazy="dynamic", backref="formation") modules = db.relationship("Module", lazy="dynamic", backref="formation")
def __repr__(self): def __repr__(self):

View File

@ -276,7 +276,8 @@ class UniteEns(db.Model):
ues_meme_niveau = [ ues_meme_niveau = [
ue ue
for ue in parcour.ues for ue in parcour.ues
if ue.formation_id == self.formation_id if ue.id != self.id
and ue.formation_id == self.formation_id
and ue.niveau_competence_id == niveau.id and ue.niveau_competence_id == niveau.id
] ]
if ues_meme_niveau: if ues_meme_niveau:
@ -295,8 +296,9 @@ class UniteEns(db.Model):
2 * (self.semestre_idx % 2) - 1 2 * (self.semestre_idx % 2) - 1
) )
if ues_meme_niveau[0].semestre_idx != other_semestre_idx: if ues_meme_niveau[0].semestre_idx != other_semestre_idx:
msg = f"""Niveau "{ msg = f"""Erreur: niveau "{
niveau.libelle}" associé à une autre année du {msg_parc}""" niveau.libelle}" déjà associé à une autre UE du semestre S{
ues_meme_niveau[0].semestre_idx} du {msg_parc}"""
log( log(
f"check_niveau_unique_dans_parcours(niveau_id={niveau.id}): " f"check_niveau_unique_dans_parcours(niveau_id={niveau.id}): "
+ msg + msg

View File

@ -37,6 +37,7 @@ div.les_parcours>div.parc>a:visited {
.parcour_formation { .parcour_formation {
margin-left: 16px; margin-left: 16px;
margin-right: 16px; margin-right: 16px;
margin-bottom: 16px;
min-width: 1200px; min-width: 1200px;
max-width: 1600px; max-width: 1600px;
} }
@ -119,6 +120,7 @@ span.parc {
font-weight: bold; font-weight: bold;
/* color: rgb(92, 87, 255); */ /* color: rgb(92, 87, 255); */
color: white; color: white;
margin-right: 8px;
padding: 4px; padding: 4px;
background-color: #09c; background-color: #09c;
border-radius: 4px; border-radius: 4px;

View File

@ -223,7 +223,7 @@ div.head_message {
color: green; color: green;
} }
.message_curtom { .message_custom {
position: fixed; position: fixed;
bottom: 100%; bottom: 100%;
left: 50%; left: 50%;
@ -237,6 +237,18 @@ div.head_message {
transform: translate(-50%, 0); transform: translate(-50%, 0);
} }
div.message_error {
position: fixed;
top: 16px;
left: 50%;
transform: translateX(-50%);
z-index: 10;
padding: 20px;
border-radius: 10px 10px 10px 10px;
background: rgb(212, 0, 0);
color: #ffffff;
font-size: 24px;
}
div.passwd_warn { div.passwd_warn {
font-weight: bold; font-weight: bold;
@ -2318,11 +2330,12 @@ span.notes_module_list_buts {
div.formation_parcs { div.formation_parcs {
display: inline-flex; display: inline-flex;
margin-left: 8px; margin-left: 8px;
margin-right: 8px;
column-gap: 8px;
} }
div.formation_parcs>div { div.formation_parcs>div {
font-size: 100%; font-size: 100%;
margin-left: 8px;
color: white; color: white;
background-color: #09c; background-color: #09c;
opacity: 0.7; opacity: 0.7;

View File

@ -53,7 +53,9 @@ function set_ue_parcour(checkbox) {
}) })
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.status) { if (data.status == 404) {
sco_error_message(data.message);
} else {
sco_message(data.message); sco_message(data.message);
} }
}); });

View File

@ -67,17 +67,22 @@ $(function () {
} }
}); });
// Affiche un message transitoire // Affiche un message transitoire (duration milliseconds, 0 means infinity)
function sco_message(msg) { function sco_message(msg, className = "message_custom", duration = 0) {
var div = document.createElement("div"); var div = document.createElement("div");
div.className = "message_curtom"; div.className = className;
div.innerHTML = msg; div.innerHTML = msg;
document.querySelector("body").appendChild(div); document.querySelector("body").appendChild(div);
if (duration) {
setTimeout(() => { setTimeout(() => {
div.remove(); div.remove();
}, 3000); }, 3000);
} }
}
function sco_error_message(msg) {
sco_message(msg, className = "message_error", duration = 0);
}
function get_query_args() { function get_query_args() {

View File

@ -64,9 +64,13 @@
{% block content %} {% block content %}
<div class="container flashes"> <div class="container flashes">
{% include "flashed_messages.j2" %} {% include "flashed_messages.j2" %}
</div>
{# application content needs to be provided in the app_content block #} {# application content needs to be provided in the app_content block #}
<div class="container">
{% block app_content %}{% endblock %} {% block app_content %}{% endblock %}
</div> </div>
<script> <script>
setTimeout(function() { setTimeout(function() {
var flashes = document.getElementsByClassName("flashes")[0]; var flashes = document.getElementsByClassName("flashes")[0];

View File

@ -86,7 +86,6 @@
<div class="niveau comp-c{{color_idx}}-{{annee}}" <div class="niveau comp-c{{color_idx}}-{{annee}}"
style="--color: var(--col-c{{color_idx}}-{{annee}});"> style="--color: var(--col-c{{color_idx}}-{{annee}});">
<div class="titre_niveau n{{annee}}"> <div class="titre_niveau n{{annee}}">
{{niv['niveau'].libelle if niv['niveau'] else ''}}
<span class="parcs"> <span class="parcs">
{% if niv['niveau'].is_tronc_commun %} {% if niv['niveau'].is_tronc_commun %}
<span class="parc">TC</span> <span class="parc">TC</span>
@ -99,6 +98,7 @@
</span> </span>
{% endif %} {% endif %}
</span> </span>
{{niv['niveau'].libelle if niv['niveau'] else ''}}
</div> </div>
<div class="ue impair u{{annee}}1"> <div class="ue impair u{{annee}}1">
{{ menu_ue(niv, "impair", 2*annee-1) }} {{ menu_ue(niv, "impair", 2*annee-1) }}

View File

@ -58,7 +58,13 @@
</span> </span>
</span> </span>
{% if ue.type != codes_cursus.UE_SPORT %}
<div class="formation_parcs">
{% for parc in ue.parcours %}
<div>{{ parc.code }}</div>
{% endfor %}
</div>
{% endif %}
{% if editable and not ue.is_locked() %} {% if editable and not ue.is_locked() %}
<a class="stdlink" href="{{ url_for('notes.ue_edit', <a class="stdlink" href="{{ url_for('notes.ue_edit',
scodoc_dept=g.scodoc_dept, ue_id=ue.id) scodoc_dept=g.scodoc_dept, ue_id=ue.id)
@ -80,13 +86,8 @@
<a class="stdlink" href="{{ <a class="stdlink" href="{{
url_for('notes.parcour_formation', scodoc_dept=g.scodoc_dept, url_for('notes.parcour_formation', scodoc_dept=g.scodoc_dept,
formation_id=formation.id ) formation_id=formation.id )
}}">modifier</a> }}">modifier associations</a>
{% endif %} {% endif %}
<div class="formation_parcs">
{% for parc in ue.parcours %}
<div>{{ parc.code }}</div>
{% endfor %}
</div>
</div> </div>
{% endif %} {% endif %}

View File

@ -1,6 +1,6 @@
# Tests unitaires # Tests unitaires
# Le BUT Info a 4 parcours qui partagent certains niveaux de compétences # Le BUT Info a 4 parcours qui partagent certains niveaux de compétences
# mais à ce sniveaux sont asscoiés des UEs dont les coefficients des ressources # mais à ces niveaux sont associés des UEs dont les coefficients des ressources
# varient selon le parcours. # varient selon le parcours.
# #