forked from ScoDoc/ScoDoc
Merge branch 'master' of https://scodoc.org/git/viennet/ScoDoc into dev93
This commit is contained in:
commit
0709b53bbe
@ -12,12 +12,12 @@ from app.models import FormSemestreInscription, FormSemestre, Identite
|
||||
from app.scodoc import sco_bulletins
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc import notesdb as ndb
|
||||
|
||||
|
||||
@bp.route("/etudiants/courant", methods=["GET"])
|
||||
@bp.route("/etudiants/courant", defaults={"long": False})
|
||||
@bp.route("/etudiants/courant/long", defaults={"long": True})
|
||||
@token_permission_required(Permission.APIView)
|
||||
def etudiants_courant():
|
||||
def etudiants_courant(long=False):
|
||||
"""
|
||||
Retourne la liste des étudiants courant
|
||||
|
||||
@ -55,8 +55,10 @@ def etudiants_courant():
|
||||
FormSemestre.date_debut <= app.db.func.now(),
|
||||
FormSemestre.date_fin >= app.db.func.now(),
|
||||
)
|
||||
|
||||
data = [etu.to_dict_bul(include_urls=False) for etu in etuds]
|
||||
if long:
|
||||
data = [etud.to_dict_bul(include_urls=False) for etud in etuds]
|
||||
else:
|
||||
data = [etud.to_dict_short() for etud in etuds]
|
||||
|
||||
return jsonify(data)
|
||||
|
||||
|
@ -141,7 +141,18 @@ class Identite(db.Model):
|
||||
"Le mail associé à la première adrese de l'étudiant, ou None"
|
||||
return getattr(self.adresses[0], field) if self.adresses.count() > 0 else None
|
||||
|
||||
def to_dict_scodoc7(self):
|
||||
def to_dict_short(self) -> dict:
|
||||
"""Les champs essentiels"""
|
||||
return {
|
||||
"id": self.id,
|
||||
"nip": self.code_nip,
|
||||
"nom": self.nom,
|
||||
"nom_usuel": self.nom_usuel,
|
||||
"prenom": self.prenom,
|
||||
"civilite": self.civilite,
|
||||
}
|
||||
|
||||
def to_dict_scodoc7(self) -> dict:
|
||||
"""Représentation dictionnaire,
|
||||
compatible ScoDoc7 mais sans infos admission
|
||||
"""
|
||||
|
@ -210,10 +210,17 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
) # la plus RECENTE en tête
|
||||
|
||||
#
|
||||
caneditevals = sco_permissions_check.can_edit_notes(
|
||||
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
||||
sem_locked = not sem["etat"]
|
||||
can_edit_evals = (
|
||||
sco_permissions_check.can_edit_notes(
|
||||
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
||||
)
|
||||
and not sem_locked
|
||||
)
|
||||
can_edit_notes = (
|
||||
sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
||||
and not sem_locked
|
||||
)
|
||||
caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
||||
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
||||
#
|
||||
module_resp = User.query.get(M["responsable_id"])
|
||||
@ -264,7 +271,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
H.append("""Semestre: </td><td>%s""" % sem["semestre_id"])
|
||||
else:
|
||||
H.append("""</td><td>""")
|
||||
if not sem["etat"]:
|
||||
if sem_locked:
|
||||
H.append(scu.icontag("lock32_img", title="verrouillé"))
|
||||
H.append("""</td><td class="fichetitre2">""")
|
||||
if modimpl.module.is_apc():
|
||||
@ -385,13 +392,15 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
|
||||
# -------- Tableau des evaluations
|
||||
top_table_links = ""
|
||||
if sem["etat"]: # non verrouillé
|
||||
top_table_links = (
|
||||
"""<a class="stdlink" href="evaluation_create?moduleimpl_id=%(moduleimpl_id)s">Créer nouvelle évaluation</a>
|
||||
<a class="stdlink" style="margin-left:2em;" href="module_evaluation_renumber?moduleimpl_id=%(moduleimpl_id)s&redirect=1">Trier par date</a>
|
||||
"""
|
||||
% M
|
||||
)
|
||||
if can_edit_evals:
|
||||
top_table_links = f"""<a class="stdlink" href="{
|
||||
url_for("notes.evaluation_create", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'])
|
||||
}">Créer nouvelle évaluation</a>
|
||||
<a class="stdlink" style="margin-left:2em;" href="{
|
||||
url_for("notes.module_evaluation_renumber", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'],
|
||||
redirect=1)
|
||||
}">Trier par date</a>
|
||||
"""
|
||||
if mod_evals:
|
||||
H.append(
|
||||
'<div class="moduleimpl_evaluations_top_links">'
|
||||
@ -451,14 +460,14 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
)
|
||||
# Fleches:
|
||||
H.append('<span class="eval_arrows_chld">')
|
||||
if eval_index != (len(mod_evals) - 1) and caneditevals:
|
||||
if eval_index != (len(mod_evals) - 1) and can_edit_evals:
|
||||
H.append(
|
||||
'<a href="module_evaluation_move?evaluation_id=%s&after=0" class="aud">%s</a>'
|
||||
% (eval["evaluation_id"], arrow_up)
|
||||
)
|
||||
else:
|
||||
H.append(arrow_none)
|
||||
if (eval_index > 0) and caneditevals:
|
||||
if (eval_index > 0) and can_edit_evals:
|
||||
H.append(
|
||||
'<a href="module_evaluation_move?evaluation_id=%s&after=1" class="aud">%s</a>'
|
||||
% (eval["evaluation_id"], arrow_down)
|
||||
@ -487,7 +496,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
etat_descr = "il manque des notes"
|
||||
else:
|
||||
etat_txt = ""
|
||||
if caneditevals and etat_txt:
|
||||
if can_edit_evals and etat_txt:
|
||||
etat_txt = (
|
||||
'<a href="evaluation_edit?evaluation_id=%s" title="%s">%s</a>'
|
||||
% (eval["evaluation_id"], etat_descr, etat_txt)
|
||||
@ -496,7 +505,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
H.append("""</th></tr>""")
|
||||
|
||||
H.append("""<tr class="%s"><td class="mievr">""" % tr_class)
|
||||
if caneditevals:
|
||||
if can_edit_evals:
|
||||
H.append(
|
||||
"""<a class="smallbutton" href="evaluation_edit?evaluation_id=%s">%s</a>"""
|
||||
% (
|
||||
@ -506,7 +515,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
),
|
||||
)
|
||||
)
|
||||
if caneditnotes:
|
||||
if can_edit_notes:
|
||||
H.append(
|
||||
"""<a class="smallbutton" href="saisie_notes?evaluation_id=%s">%s</a>"""
|
||||
% (
|
||||
@ -517,13 +526,13 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
)
|
||||
)
|
||||
if etat["nb_notes"] == 0:
|
||||
if caneditevals:
|
||||
if can_edit_evals:
|
||||
H.append(
|
||||
"""<a class="smallbutton" href="evaluation_delete?evaluation_id=%(evaluation_id)s">"""
|
||||
% eval
|
||||
)
|
||||
H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer"))
|
||||
if caneditevals:
|
||||
if can_edit_evals:
|
||||
H.append("""</a>""")
|
||||
elif etat["evalcomplete"]:
|
||||
H.append(
|
||||
@ -561,7 +570,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
else:
|
||||
H.append(" ")
|
||||
H.append('</td><td class="mievr_menu">')
|
||||
if caneditnotes:
|
||||
if can_edit_notes:
|
||||
H.append(
|
||||
moduleimpl_evaluation_menu(
|
||||
eval["evaluation_id"],
|
||||
@ -644,7 +653,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
H.append(""")""")
|
||||
if gr_moyenne["group_id"] in etat["gr_incomplets"]:
|
||||
H.append("""[<font color="red">""")
|
||||
if caneditnotes:
|
||||
if can_edit_notes:
|
||||
H.append(
|
||||
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">incomplet</a></font>]"""
|
||||
% (eval["evaluation_id"], gr_moyenne["group_id"])
|
||||
@ -653,25 +662,25 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
H.append("""incomplet</font>]""")
|
||||
else:
|
||||
H.append("""<span class="redboldtext"> """)
|
||||
if caneditnotes:
|
||||
if can_edit_notes:
|
||||
H.append(
|
||||
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">"""
|
||||
% (eval["evaluation_id"], gr_moyenne["group_id"])
|
||||
)
|
||||
H.append("pas de notes")
|
||||
if caneditnotes:
|
||||
if can_edit_notes:
|
||||
H.append("""</a>""")
|
||||
H.append("</span>")
|
||||
H.append("""</td></tr>""")
|
||||
first_eval = False
|
||||
|
||||
#
|
||||
if caneditevals or not sem["etat"]:
|
||||
H.append("""<tr><td colspan="8">""")
|
||||
if not sem["etat"]:
|
||||
H.append("""%s semestre verrouillé""" % scu.icontag("lock32_img"))
|
||||
else:
|
||||
H.append(top_table_links)
|
||||
|
||||
H.append("""<tr><td colspan="8">""")
|
||||
if sem_locked:
|
||||
H.append(f"""{scu.icontag("lock32_img")} semestre verrouillé""")
|
||||
elif can_edit_evals:
|
||||
H.append(top_table_links)
|
||||
|
||||
H.append(
|
||||
"""</td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user