1
0
forked from ScoDoc/ScoDoc

API: assiduite : ajout user_name et corrige user_id. Fixes #753

This commit is contained in:
Emmanuel Viennet 2023-09-27 23:02:32 +02:00
parent 46134dc06d
commit 4f07bd677c
3 changed files with 6 additions and 10 deletions

View File

@ -70,16 +70,11 @@ class Assiduite(db.Model):
def to_dict(self, format_api=True) -> dict:
"""Retourne la représentation json de l'assiduité"""
etat = self.etat
username = self.user_id
user: User = None
if format_api:
etat = EtatAssiduite.inverse().get(self.etat).name
if self.user_id is not None:
user: User = db.session.get(User, self.user_id)
if user is None:
username = "Non renseigné"
else:
username = user.get_prenomnom()
user = db.session.get(User, self.user_id)
data = {
"assiduite_id": self.id,
"etudid": self.etudid,
@ -90,7 +85,8 @@ class Assiduite(db.Model):
"etat": etat,
"desc": self.description,
"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,
"external_data": self.external_data,
}

View File

@ -884,7 +884,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
jour = datetime.date.today().isoformat(),
group_ids=group.id,
)}">
<button>Visualiser l'assiduité</button></a>
<button>Visualiser</button></a>
</div>
<div>
<a class="btn" href="{

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.6.36"
SCOVERSION = "9.6.37"
SCONAME = "ScoDoc"