API: assiduite : ajout user_name et corrige user_id. Fixes #753
This commit is contained in:
parent
46134dc06d
commit
4f07bd677c
@ -70,16 +70,11 @@ class Assiduite(db.Model):
|
|||||||
def to_dict(self, format_api=True) -> dict:
|
def to_dict(self, format_api=True) -> dict:
|
||||||
"""Retourne la représentation json de l'assiduité"""
|
"""Retourne la représentation json de l'assiduité"""
|
||||||
etat = self.etat
|
etat = self.etat
|
||||||
username = self.user_id
|
user: User = None
|
||||||
if format_api:
|
if format_api:
|
||||||
etat = EtatAssiduite.inverse().get(self.etat).name
|
etat = EtatAssiduite.inverse().get(self.etat).name
|
||||||
if self.user_id is not None:
|
if self.user_id is not None:
|
||||||
user: User = db.session.get(User, self.user_id)
|
user = db.session.get(User, self.user_id)
|
||||||
|
|
||||||
if user is None:
|
|
||||||
username = "Non renseigné"
|
|
||||||
else:
|
|
||||||
username = user.get_prenomnom()
|
|
||||||
data = {
|
data = {
|
||||||
"assiduite_id": self.id,
|
"assiduite_id": self.id,
|
||||||
"etudid": self.etudid,
|
"etudid": self.etudid,
|
||||||
@ -90,7 +85,8 @@ class Assiduite(db.Model):
|
|||||||
"etat": etat,
|
"etat": etat,
|
||||||
"desc": self.description,
|
"desc": self.description,
|
||||||
"entry_date": self.entry_date,
|
"entry_date": self.entry_date,
|
||||||
"user_id": username,
|
"user_id": None if user is None else user.id, # l'uid
|
||||||
|
"user_name": None if user is None else user.user_name, # le login
|
||||||
"est_just": self.est_just,
|
"est_just": self.est_just,
|
||||||
"external_data": self.external_data,
|
"external_data": self.external_data,
|
||||||
}
|
}
|
||||||
|
@ -884,7 +884,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
|
|||||||
jour = datetime.date.today().isoformat(),
|
jour = datetime.date.today().isoformat(),
|
||||||
group_ids=group.id,
|
group_ids=group.id,
|
||||||
)}">
|
)}">
|
||||||
<button>Visualiser l'assiduité</button></a>
|
<button>Visualiser</button></a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a class="btn" href="{
|
<a class="btn" href="{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.6.36"
|
SCOVERSION = "9.6.37"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user