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")
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")
def __repr__(self):

View File

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

View File

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

View File

@ -223,7 +223,7 @@ div.head_message {
color: green;
}
.message_curtom {
.message_custom {
position: fixed;
bottom: 100%;
left: 50%;
@ -237,6 +237,18 @@ div.head_message {
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 {
font-weight: bold;
@ -2318,11 +2330,12 @@ span.notes_module_list_buts {
div.formation_parcs {
display: inline-flex;
margin-left: 8px;
margin-right: 8px;
column-gap: 8px;
}
div.formation_parcs>div {
font-size: 100%;
margin-left: 8px;
color: white;
background-color: #09c;
opacity: 0.7;

View File

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

View File

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

View File

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

View File

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

View File

@ -58,7 +58,13 @@
</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() %}
<a class="stdlink" href="{{ url_for('notes.ue_edit',
scodoc_dept=g.scodoc_dept, ue_id=ue.id)
@ -80,13 +86,8 @@
<a class="stdlink" href="{{
url_for('notes.parcour_formation', scodoc_dept=g.scodoc_dept,
formation_id=formation.id )
}}">modifier</a>
}}">modifier associations</a>
{% endif %}
<div class="formation_parcs">
{% for parc in ue.parcours %}
<div>{{ parc.code }}</div>
{% endfor %}
</div>
</div>
{% endif %}

View File

@ -1,6 +1,6 @@
# Tests unitaires
# 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.
#