2021-07-02 12:34:44 +02:00
|
|
|
# -*- mode: python -*-
|
|
|
|
# -*- coding: utf-8 -
|
|
|
|
|
|
|
|
""" Création de billet, utilisation de XMLgetBilletsEtud et suppression de billet """
|
|
|
|
import random
|
|
|
|
|
|
|
|
# La variable context est définie par le script de lancement
|
|
|
|
# l'affecte ainsi pour évietr les warnins pylint:
|
|
|
|
context = context # pylint: disable=undefined-variable
|
|
|
|
REQUEST = REQUEST # pylint: disable=undefined-variable
|
|
|
|
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
|
|
|
import sco_abs_views
|
|
|
|
|
|
|
|
|
|
|
|
G = sco_fake_gen.ScoFake(context.Notes)
|
|
|
|
G.verbose = False
|
|
|
|
|
|
|
|
# --- Création d'une formation
|
|
|
|
f = G.create_formation(acronyme="")
|
|
|
|
ue = G.create_ue(formation_id=f["formation_id"], acronyme="TST1", titre="ue test")
|
|
|
|
mat = G.create_matiere(ue_id=ue["ue_id"], titre="matière test")
|
|
|
|
mod = G.create_module(
|
|
|
|
matiere_id=mat["matiere_id"],
|
|
|
|
code="TSM1",
|
|
|
|
coefficient=1.0,
|
|
|
|
titre="module test",
|
|
|
|
ue_id=ue["ue_id"], # faiblesse de l'API
|
|
|
|
formation_id=f["formation_id"], # faiblesse de l'API
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Mise place d'un semestre
|
|
|
|
sem = G.create_formsemestre(
|
|
|
|
formation_id=f["formation_id"],
|
|
|
|
semestre_id=1,
|
|
|
|
date_debut="01/01/2021",
|
|
|
|
date_fin="30/06/2021",
|
|
|
|
)
|
|
|
|
|
|
|
|
mi = G.create_moduleimpl(
|
|
|
|
module_id=mod["module_id"],
|
|
|
|
formsemestre_id=sem["formsemestre_id"],
|
|
|
|
responsable_id="bach",
|
|
|
|
)
|
|
|
|
|
|
|
|
# --- Création d'un étudiant
|
|
|
|
etud = G.create_etud(code_nip=None)
|
|
|
|
G.inscrit_etudiant(sem, etud)
|
2021-07-29 10:19:00 +02:00
|
|
|
etudid = etud["etudid"]
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
# --- Création d'une absence
|
2021-07-29 10:19:00 +02:00
|
|
|
sco_abs_views.doSignaleAbsence(
|
|
|
|
context.Absences,
|
|
|
|
datedebut="22/01/2021",
|
|
|
|
datefin="22/01/2021",
|
|
|
|
demijournee=2,
|
|
|
|
etudid=etudid,
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
# --- Création d'un billet
|
|
|
|
b1 = context.Absences.AddBilletAbsence(
|
2021-07-29 10:19:00 +02:00
|
|
|
begin="2021-01-22 00:00",
|
|
|
|
end="2021-01-22 23:59",
|
|
|
|
etudid=etudid,
|
|
|
|
description="abs du 22",
|
|
|
|
justified=False,
|
|
|
|
code_nip=etud["code_nip"],
|
|
|
|
code_ine=etud["code_ine"],
|
|
|
|
REQUEST=REQUEST,
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
|
|
|
|
# --- XMLgetBilletEtud
|
|
|
|
|
|
|
|
xml_bi = context.Absences.XMLgetBilletsEtud(etudid=etudid, REQUEST=REQUEST)
|
|
|
|
print(1)
|
|
|
|
print(xml_bi)
|
|
|
|
print(1)
|
|
|
|
|
|
|
|
|
|
|
|
# --- Suppression d'un billet
|
|
|
|
li_bi = context.Absences.listeBilletsEtud(etudid=etudid, REQUEST=REQUEST, format="json")
|
|
|
|
load_li_bi = json.loads(li_bi)
|
|
|
|
|
|
|
|
_ = context.Absences.deleteBilletAbsence(load_li_bi[0]["billet_id"], REQUEST=REQUEST)
|
|
|
|
|
2021-07-29 10:19:00 +02:00
|
|
|
li_bi2 = context.Absences.listeBilletsEtud(
|
|
|
|
etudid=etudid, REQUEST=REQUEST, format="json"
|
|
|
|
)
|
2021-07-02 12:34:44 +02:00
|
|
|
load_li_bi2 = json.loads(li_bi)
|
|
|
|
|
|
|
|
assert len(load_li_bi2) == 0
|
|
|
|
|
|
|
|
"""
|
|
|
|
Commentaire :
|
|
|
|
|
|
|
|
XMLgetBilletsEtud retourne une chaine vide
|
|
|
|
|
|
|
|
deleteBilletsEtud : erreur
|
|
|
|
File "/opt/scodoc/Products/ScoDoc/ZAbsences.py", line 1809, in deleteBilletAbsence
|
|
|
|
parameters={"billet_id": billet_id},
|
|
|
|
File "/opt/scodoc/Products/ScoDoc/ZScolar.py", line 2664, in confirmDialog
|
2021-07-29 10:19:00 +02:00
|
|
|
return self.sco_header(REQUEST) + "\n".join(H) + self.sco_footer()
|
2021-07-02 12:34:44 +02:00
|
|
|
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 223: ordinal not in range(128)
|
|
|
|
|
|
|
|
"""
|