forked from ScoDoc/DocScoDoc
pass unit test_abs_counts and test_abs_demijournee
This commit is contained in:
parent
5d13195070
commit
2a67e9827a
@ -594,11 +594,11 @@ class GenTable(object):
|
||||
r = {}
|
||||
for cid in self.columns_ids:
|
||||
v = row.get(cid, None)
|
||||
if v != None:
|
||||
v = str(v)
|
||||
# if v != None:
|
||||
# v = str(v)
|
||||
r[cid] = v
|
||||
d.append(r)
|
||||
return json.dumps(d)
|
||||
return json.dumps(d, cls=scu.ScoDocJSONEncoder)
|
||||
|
||||
def make_page(
|
||||
self,
|
||||
|
@ -924,18 +924,26 @@ def _TablesAbsEtud(
|
||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||
for a in absnonjust + absjust:
|
||||
cursor.execute(
|
||||
"""select eval.*
|
||||
from notes_evaluation eval, notes_moduleimpl_inscription mi, notes_moduleimpl m
|
||||
where eval.jour = %(jour)s and eval.moduleimpl_id = m.moduleimpl_id
|
||||
and mi.moduleimpl_id = m.moduleimpl_id and mi.etudid = %(etudid)s""",
|
||||
"""SELECT eval.*
|
||||
FROM notes_evaluation eval, notes_moduleimpl_inscription mi, notes_moduleimpl m
|
||||
WHERE eval.jour = %(jour)s
|
||||
and eval.moduleimpl_id = m.id
|
||||
and mi.moduleimpl_id = m.id
|
||||
and mi.etudid = %(etudid)s
|
||||
""",
|
||||
{"jour": a["jour"].strftime("%Y-%m-%d"), "etudid": etudid},
|
||||
)
|
||||
a["evals"] = cursor.dictfetchall()
|
||||
cursor.execute(
|
||||
"""SELECT mi.moduleimpl_id
|
||||
from absences abs, notes_moduleimpl_inscription mi, notes_moduleimpl m
|
||||
where abs.matin = %(matin)s and abs.jour = %(jour)s and abs.etudid=%(etudid)s and abs.moduleimpl_id=mi.moduleimpl_id and mi.moduleimpl_id=m.moduleimpl_id
|
||||
and mi.etudid = %(etudid)s""",
|
||||
FROM absences abs, notes_moduleimpl_inscription mi, notes_moduleimpl m
|
||||
WHERE abs.matin = %(matin)s
|
||||
and abs.jour = %(jour)s
|
||||
and abs.etudid = %(etudid)s
|
||||
and abs.moduleimpl_id = mi.moduleimpl_id
|
||||
and mi.moduleimpl_id = m.id
|
||||
and mi.etudid = %(etudid)s
|
||||
""",
|
||||
{
|
||||
"matin": bool(a["matin"]),
|
||||
"jour": a["jour"].strftime("%Y-%m-%d"),
|
||||
|
@ -342,7 +342,7 @@ class DisplayedGroupsInfos(object):
|
||||
|
||||
gq = []
|
||||
for group_id in group_ids:
|
||||
gq.append("group_ids=" + group_id)
|
||||
gq.append("group_ids=" + str(group_id))
|
||||
self.groups_query_args = "&".join(gq)
|
||||
self.base_url = REQUEST.URL0 + "?" + self.groups_query_args
|
||||
self.group_ids = group_ids
|
||||
@ -724,10 +724,15 @@ def groups_table(
|
||||
return tab.make_page(context, format=format, REQUEST=REQUEST)
|
||||
|
||||
elif format == "xlsappel":
|
||||
xls = sco_excel.excel_feuille_listeappel(groups_infos.formsemestre, groups_infos.groups_titles,
|
||||
groups_infos.members, partitions=groups_infos.partitions,
|
||||
with_codes=with_codes, with_paiement=with_paiement,
|
||||
server_name=REQUEST.BASE0)
|
||||
xls = sco_excel.excel_feuille_listeappel(
|
||||
groups_infos.formsemestre,
|
||||
groups_infos.groups_titles,
|
||||
groups_infos.members,
|
||||
partitions=groups_infos.partitions,
|
||||
with_codes=with_codes,
|
||||
with_paiement=with_paiement,
|
||||
server_name=REQUEST.BASE0,
|
||||
)
|
||||
filename = "liste_%s" % groups_infos.groups_filename + ".xlsx"
|
||||
return sco_excel.send_excel_file(REQUEST, xls, filename)
|
||||
elif format == "allxls":
|
||||
|
@ -1099,7 +1099,7 @@ def AddBilletAbsence(
|
||||
if begin_date > end_date:
|
||||
raise ValueError("invalid dates")
|
||||
#
|
||||
justified = int(justified)
|
||||
justified = bool(justified)
|
||||
#
|
||||
cnx = ndb.GetDBConnexion()
|
||||
billet_id = sco_abs.billet_absence_create(
|
||||
@ -1109,7 +1109,7 @@ def AddBilletAbsence(
|
||||
"abs_begin": begin,
|
||||
"abs_end": end,
|
||||
"description": description,
|
||||
"etat": 0,
|
||||
"etat": False,
|
||||
"justified": justified,
|
||||
},
|
||||
)
|
||||
|
@ -49,7 +49,6 @@ def test_abs_counts(test_client):
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
@ -51,7 +51,6 @@ def test_abs_demijournee(test_client):
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
@ -162,7 +161,6 @@ def test_abs_basic(test_client):
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
@ -274,7 +272,7 @@ def test_abs_basic(test_client):
|
||||
|
||||
assert len(load_liste_abs2) == 1
|
||||
assert len(load_liste_abs) == 2
|
||||
assert load_liste_abs2[0]["ampm"] == "1"
|
||||
assert load_liste_abs2[0]["ampm"] == 1
|
||||
assert load_liste_abs2[0]["datedmy"] == "22/01/2021"
|
||||
assert load_liste_abs2[0]["exams"] == mod["code"]
|
||||
# absjust_only -> seulement les abs justifiés
|
||||
@ -322,10 +320,10 @@ def test_abs_basic(test_client):
|
||||
|
||||
for un_etud in load_grp1_abs:
|
||||
if un_etud["etudid"] == etudid:
|
||||
assert un_etud["nbabs"] == "3"
|
||||
assert un_etud["nbjustifs_noabs"] == "2"
|
||||
assert un_etud["nbabsjust"] == "2"
|
||||
assert un_etud["nbabsnonjust"] == "1"
|
||||
assert un_etud["nbabs"] == 3
|
||||
assert un_etud["nbjustifs_noabs"] == 2
|
||||
assert un_etud["nbabsjust"] == 2
|
||||
assert un_etud["nbabsnonjust"] == 1
|
||||
assert un_etud["nomprenom"] == etuds[0]["nomprenom"]
|
||||
|
||||
# --- Création de billets
|
||||
|
Loading…
Reference in New Issue
Block a user