réorganisation des anciens tests
88
README.md
@ -35,6 +35,10 @@ d'autres pas: merci de signaler les erreurs.
|
||||
|
||||
## Installation (sur Debian 11 / python 3.9.2)
|
||||
|
||||
|
||||
Voir https://scodoc.org/GuideInstallDebian11
|
||||
|
||||
## Notes à reporter dans la doc:
|
||||
On peut installer à partir de zéro, ou sur une machine ayant déjà un ScoDoc 7
|
||||
et migrer les données.
|
||||
|
||||
@ -60,70 +64,7 @@ et migrer les données.
|
||||
|
||||
Les données pourront être migrées après installation la nouvelle version, voir plus loin. **XXX TODO: script de migration "en place"** (actuellement, seule la migration depuis une _autre_ machine scodoc7 est prévue.)
|
||||
|
||||
### Installer ScoDoc
|
||||
Sur un système Linux Debian 11, en tant que `root`:
|
||||
|
||||
Si vous êtes développeur/testeur, partir du code _git_, avec `git clone https://scodoc.org/git/viennet/ScoDoc.git, le
|
||||
renommer en `/opt/scodoc`et aller directement à l'étape 3.
|
||||
|
||||
1. Charger la dernière release depuis https://scodoc.org/git/viennet/ScoDoc/releases
|
||||
|
||||
2. Déplacer ou copier le fichier `scodoc-x.y.z.tgz` dans `/opt` et le décomprimer:
|
||||
|
||||
sudo su
|
||||
cd /opt; tar xf - ScoDoc-x.y.z.tgz # remplacer x.y.z par votre version
|
||||
mv nom_du_rep_créé /opt/scodoc
|
||||
|
||||
|
||||
3. Lancer le script d'installation:
|
||||
|
||||
cd /opt/scodoc/
|
||||
./tools/install_debian11.sh
|
||||
|
||||
ce script crée un compte utilisateur "scodoc" s'il n'existe pas déjà.
|
||||
|
||||
Note: si vous installez sur une machine déjà configurée pour ScoDoc 7, il
|
||||
est inutile de reconfigurer la messagerie et le firewall.
|
||||
|
||||
### Bases de données
|
||||
ScoDoc 9 utilise une nouvelle base de données unique, regroupant tous les
|
||||
départements et les utilisateurs. Elle est nommée `SCODOC` (et `SCODOC_DEV`
|
||||
en mode développement, ou `SCODOC_TEST`pour les tests unitaires).
|
||||
Cette base est créée via `sqlalchemy` (l'ORM habituel de Flask).
|
||||
|
||||
Pour créer la base de données, lancer le script:
|
||||
|
||||
su scodoc # au besoin (pas root !)
|
||||
cd /opt/scodoc
|
||||
./tools/create_database.sh SCODOC
|
||||
./tools/create_database.sh SCODOC_DEV # pour la base "developement"
|
||||
./tools/create_database.sh SCODOC_TEST # pour les tests unitaires
|
||||
|
||||
Les bases créées appartiennent à l'utilisateur (rôle) postgres `scodoc`
|
||||
(qui a été créé par le script d'installation précédent).
|
||||
|
||||
### Variables d'environnement
|
||||
Le serveur utilise des variables d'environnement donnant la configuration de base.
|
||||
Le plus simple est de les grouper dans un fichier `.env` (dans `/opt/scodoc/.env`)
|
||||
qui est lu automatiquement au démarrage:
|
||||
|
||||
# .env for ScoDoc _development_
|
||||
|
||||
FLASK_APP=scodoc.py
|
||||
FLASK_ENV=development # ou production
|
||||
|
||||
MAIL_SERVER=votre.serveur.de.mail.net # ou vide si pas de mail
|
||||
MAIL_PORT=25
|
||||
|
||||
SCODOC_ADMIN_MAIL="adresse.admin@toto.fr" # important: le mail de admin
|
||||
SECRET_KEY="CGGAJAKlh6789JJK?KNAb=" # une chaine aléatoire
|
||||
|
||||
Le fichier `/opt/scodoc/.env-exemple`est donné à titre... d'exemple. Vous pouvez faire:
|
||||
|
||||
# en tant qu'utilisateur scodoc
|
||||
cd /opt/scodoc/
|
||||
cp .env-exemple .env
|
||||
nano .env # édition
|
||||
|
||||
### Initialisation de la base utilisateur par Flask
|
||||
|
||||
@ -150,25 +91,34 @@ Pour créer un utilisateur "super admin", c'est à dire admin dans tous les dép
|
||||
|
||||
flask user-create admin1 SuperAdmin @all
|
||||
|
||||
## Migration d'une installation ScoDoc 7
|
||||
## Migration d'une installation ScoDoc 7 sur un nouveau serveur
|
||||
|
||||
La migration va se faire en suivant les étapes:
|
||||
C'est le cas recommandé car il minimise la coupure
|
||||
Dans ce cas, la migration va se faire en suivant les étapes:
|
||||
|
||||
1. sauvegarder les données de ScoDoc7 (depuis le serveur de production);
|
||||
1. installer le nouveau serveur Linux et ScoDoc 9;
|
||||
|
||||
2. installer le nouveau serveur Linux et ScoDoc 9;
|
||||
2. sauvegarder les données de ScoDoc7 depuis le serveur de production et l'arrêter;
|
||||
|
||||
3. y charger les données ScoDoc 7;
|
||||
|
||||
4. importer ces données dans ScoDoc 9.
|
||||
|
||||
### Étape 1: sauvegarde des données du serveur ScoDoc 7
|
||||
### Étape 1
|
||||
|
||||
Installer le nouveau serveur avec Debian 11 et ScoDoc 9.
|
||||
|
||||
Voir https://scodoc.org/GuideInstallDebian11
|
||||
|
||||
### Étape 2: sauvegarde des données du serveur ScoDoc 7
|
||||
|
||||
Se connecter en tant que `root`sur le serveur ScoDoc 7.
|
||||
|
||||
cd /opt/scodoc/Products/ScoDoc/config
|
||||
# Mise à jour indispensable pour avoir le script de migration
|
||||
./upgrade.sh
|
||||
# Arrêt du service en production
|
||||
systemctl stop scodoc
|
||||
# Export des données
|
||||
./save_scodoc7_data.sh /tmp/sauvegarde-scodoc7
|
||||
|
||||
@ -179,9 +129,7 @@ exemple `/tmp/sauvegarde-scodoc7.tgz`
|
||||
|
||||
Copier ce fichier sur le nouveau serveur.
|
||||
|
||||
### Étape 2
|
||||
|
||||
Installer le nouveau serveur avec Debian 11 et ScoDoc 9.
|
||||
|
||||
### Étape 3
|
||||
|
||||
|
@ -660,7 +660,7 @@ def EtatAbsences():
|
||||
# crude portage from 1999 DTML
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Etat des absences"),
|
||||
"""<h2>Etat des absences pour un groupe</h2>
|
||||
"""<h2>État des absences pour un groupe</h2>
|
||||
<form action="EtatAbsencesGr" method="GET">""",
|
||||
formChoixSemestreGroupe(),
|
||||
"""<input type="submit" name="" value=" OK " width=100>
|
||||
|
@ -912,7 +912,7 @@ def EtatAbsencesGr(
|
||||
h = groups_infos.groups_titles
|
||||
gr_tit = p + h
|
||||
|
||||
title = "Etat des absences %s" % gr_tit
|
||||
title = "État des absences %s" % gr_tit
|
||||
if format == "xls" or format == "xml" or format == "json":
|
||||
columns_ids = ["etudid"] + columns_ids
|
||||
tab = GenTable(
|
||||
|
@ -1,75 +0,0 @@
|
||||
alembic==1.6.5
|
||||
astroid==2.6.5
|
||||
attrs==21.2.0
|
||||
Babel==2.9.1
|
||||
blinker==1.4
|
||||
certifi==2021.5.30
|
||||
cffi==1.14.6
|
||||
chardet==4.0.0
|
||||
charset-normalizer==2.0.3
|
||||
click==8.0.1
|
||||
coverage==5.5
|
||||
cracklib==2.9.3
|
||||
cryptography==3.4.7
|
||||
dnspython==2.1.0
|
||||
dominate==2.6.0
|
||||
email-validator==1.1.3
|
||||
et-xmlfile==1.1.0
|
||||
Flask==2.0.1
|
||||
Flask-Babel==2.0.0
|
||||
Flask-Bootstrap==3.3.7.1
|
||||
Flask-Caching==1.10.1
|
||||
Flask-Login==0.5.0
|
||||
Flask-Mail==0.9.1
|
||||
Flask-Migrate==3.0.1
|
||||
Flask-Moment==1.0.2
|
||||
Flask-SQLAlchemy==2.5.1
|
||||
Flask-WTF==0.15.1
|
||||
greenlet==1.1.0
|
||||
gunicorn==20.1.0
|
||||
icalendar==4.0.7
|
||||
idna==3.2
|
||||
importlib-metadata==4.6.1
|
||||
iniconfig==1.1.1
|
||||
isort==5.9.3
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.1
|
||||
jwt==1.2.0
|
||||
lazy-object-proxy==1.6.0
|
||||
Mako==1.1.4
|
||||
MarkupSafe==2.0.1
|
||||
mccabe==0.6.1
|
||||
openpyxl==3.0.7
|
||||
packaging==21.0
|
||||
Pillow==8.3.1
|
||||
pkg_resources==0.0.0
|
||||
pluggy==0.13.1
|
||||
psycopg2==2.9.1
|
||||
py==1.10.0
|
||||
pycparser==2.20
|
||||
pydot==1.4.2
|
||||
pylint==2.9.6
|
||||
pyOpenSSL==20.0.1
|
||||
pyparsing==2.4.7
|
||||
PyRSS2Gen==1.1
|
||||
pytest==6.2.4
|
||||
pytest-cov==2.12.1
|
||||
python-dateutil==2.8.2
|
||||
python-dotenv==0.18.0
|
||||
python-editor==1.0.4
|
||||
pytz==2021.1
|
||||
redis==3.5.3
|
||||
reportlab==3.5.68
|
||||
requests==2.26.0
|
||||
rq==1.9.0
|
||||
six==1.16.0
|
||||
SQLAlchemy==1.4.22
|
||||
toml==0.10.2
|
||||
typed-ast==1.4.3
|
||||
typing-extensions==3.10.0.0
|
||||
urllib3==1.26.6
|
||||
visitor==0.1.3
|
||||
Werkzeug==2.0.1
|
||||
wrapt==1.12.1
|
||||
WTForms==2.3.3
|
||||
zipp==3.5.0
|
@ -1 +0,0 @@
|
||||
#
|
@ -1,287 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -
|
||||
|
||||
""""
|
||||
Creation de 10 étudiants, formation, semestre, ue, module, absences le matin, l'apres midi, la journée compléte
|
||||
et justification d'absences, supression d'absences, création de listes d'absences, création de billet
|
||||
et creation d'un groupe.
|
||||
|
||||
Fonction de l'API utilisé :
|
||||
- doSignaleAbsence
|
||||
- doJustifAbsence
|
||||
- AddBilletAbs
|
||||
- XMLgetBilletAbsence
|
||||
- listeBilletEtud
|
||||
- list_abs_just
|
||||
- CountAbsJust
|
||||
- ListAbsNonJust
|
||||
- ListJustifs
|
||||
- list_abs_jour
|
||||
- ListAbsInRange
|
||||
|
||||
Fonction renvoyant du code HTML :
|
||||
- EtatAbsences
|
||||
- SignaleAbsenceGrSemestre
|
||||
- SignaleAbsenceGrHebdo
|
||||
- EtatAbsenceDate
|
||||
- AddBilletAbsenceForm
|
||||
- AnnuleAbsenceEtud
|
||||
- ProcessBilletAbsenceForm
|
||||
- JustifAbsenceEtud
|
||||
- doAnnuleJustif
|
||||
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
|
||||
REQUEST = REQUEST # pylint: disable=undefined-variable
|
||||
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
||||
import sco_abs
|
||||
import sco_abs_views
|
||||
import sco_abs_notification
|
||||
import ZAbsences
|
||||
|
||||
G = sco_fake_gen.ScoFake(xxx)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
||||
|
||||
# --- 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",
|
||||
)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
|
||||
# --- Création d'un groupe
|
||||
|
||||
_ = sco_groups.partition_create(
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
partition_name="Eleve",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
li1 = sco_groups.get_partitions_list(sem["formsemestre_id"])
|
||||
_ = sco_groups.createGroup(li1[0]["partition_id"], "Groupe 1")
|
||||
|
||||
# --- Affectation des élèves dans des groupes
|
||||
|
||||
li_grp1 = sco_groups.get_partition_groups(li1[0])
|
||||
for etud in etuds:
|
||||
sco_groups.set_group(etud["etudid"], li_grp1[0]["group_id"])
|
||||
|
||||
# --- Saisie absences
|
||||
etudid = etuds[0]["etudid"]
|
||||
|
||||
for debut, fin, demijournee in [
|
||||
("15/01/2021", "15/01/2021", 1),
|
||||
("18/01/2021", "18/01/2021", 0),
|
||||
("19/01/2021", "19/01/2021", 2),
|
||||
("22/01/2021", "22/01/2021", 1),
|
||||
]:
|
||||
sco_abs_views.doSignaleAbsence(
|
||||
datedebut=debut,
|
||||
datefin=fin,
|
||||
demijournee=demijournee,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
_ = sco_abs_views.doSignaleAbsence(
|
||||
"22/01/2021",
|
||||
"22/01/2021",
|
||||
demijournee=1,
|
||||
etudid=etuds[1]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Justification de certaines absences
|
||||
|
||||
for debut, fin, demijournee in [
|
||||
("15/01/2021", "15/01/2021", 1),
|
||||
("18/01/2021", "18/01/2021", 0),
|
||||
("19/01/2021", "19/01/2021", 2),
|
||||
]:
|
||||
sco_abs_views.doJustifAbsence(
|
||||
datedebut=debut,
|
||||
datefin=fin,
|
||||
demijournee=demijournee,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Test
|
||||
|
||||
_ = context.Absences.doSignaleAbsenceGrSemestre(
|
||||
dates="2021-01-13,2021-01-25",
|
||||
etudids=etuds[5]["etudid"] + "," + etuds[6]["etudid"],
|
||||
destination="",
|
||||
REQUEST=REQUEST,
|
||||
) # <----- rien ne se passe (pb parametre ?)
|
||||
|
||||
# --- Création de billets
|
||||
|
||||
b1 = context.Absences.AddBilletAbsence(
|
||||
begin="2021-01-22 00:00",
|
||||
end="2021-01-22 23:59",
|
||||
etudid=etudid,
|
||||
description="abs du 22",
|
||||
justified=False,
|
||||
code_nip=etuds[0]["code_nip"],
|
||||
code_ine=etuds[0]["code_ine"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
b2 = context.Absences.AddBilletAbsence(
|
||||
begin="2021-01-15 00:00",
|
||||
end="2021-01-15 23:59",
|
||||
etudid=etudid,
|
||||
description="abs du 15",
|
||||
code_nip=etuds[0]["code_nip"],
|
||||
code_ine=etuds[0]["code_ine"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- XMLgetBilletEtud
|
||||
|
||||
xml_bi = context.Absences.XMLgetBilletsEtud(etudid=etudid, REQUEST=REQUEST)
|
||||
print(1)
|
||||
print(xml_bi)
|
||||
print(1)
|
||||
|
||||
# --- Supression de 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[1]["billet_id"], REQUEST=REQUEST)
|
||||
|
||||
li_bi2 = context.Absences.listeBilletsEtud(
|
||||
etudid=etudid, REQUEST=REQUEST, format="json"
|
||||
)
|
||||
load_li_bi2 = json.loads(li_bi)
|
||||
|
||||
# assert len(load_li_bi2) == 1
|
||||
# assert load_li_bi2[0]["description"] == "abs du 22"
|
||||
|
||||
# --- Créaton de listes
|
||||
|
||||
li_abs_just = sco_abs.list_abs_just(etudid=etudid, datedebut="01/01/2021")
|
||||
nb_abs_just = sco_abs.count_abs_just(etudid, debut="01/01/2021", fin="06/30/2021")
|
||||
assert len(li_abs_just) == nb_abs_just
|
||||
assert li_abs_just[0]["etudid"] == etudid
|
||||
assert li_abs_just[0]["matin"] == True
|
||||
assert li_abs_just[0]["jour"] == datetime.date(2021, 1, 15)
|
||||
assert li_abs_just[2]["jour"] == datetime.date(2021, 1, 19)
|
||||
assert li_abs_just[2]["matin"] == False
|
||||
|
||||
|
||||
li_abs_njust = context.Absences.ListeAbsNonJust(etudid=etudid, datedebut="01/01/2021")
|
||||
nb_abs = context.Absences.CountAbs(etudid, debut="01/01/2021", fin="06/30/2021")
|
||||
assert len(li_abs_njust) == nb_abs - nb_abs_just
|
||||
assert li_abs_njust[0]["matin"] == True
|
||||
assert li_abs_njust[0]["etudid"] == etudid
|
||||
assert li_abs_njust[0]["jour"] == datetime.date(2021, 1, 22)
|
||||
|
||||
|
||||
li_just = sco_abs.list_abs_justifs(etudid=etudid, datedebut="2021-01-01")
|
||||
assert len(li_just) == 4
|
||||
li_just2 = context.Absences.list_abs_justifs(
|
||||
etudid=etudid, datedebut="2021-01-01", datefin="2021-01-18"
|
||||
)
|
||||
assert len(li_just2) == 2
|
||||
|
||||
|
||||
li_jour = sco_abs.list_abs_jour(date="01/22/2021")
|
||||
assert len(li_jour) == 2
|
||||
li_jour2 = sco_abs.list_abs_jour(date="01/18/2021")
|
||||
assert len(li_jour2) == 1
|
||||
|
||||
|
||||
li_range = context.Absences.ListAbsInRange(etudid, debut="01/01/2021", fin="06/01/2021")
|
||||
assert len(li_range) == 5
|
||||
|
||||
# li_xml = context.Absences.XMLgetAbsEtud(beg_date="01/01/2021", end_date="01/06/2021", REQUEST=REQUEST)
|
||||
# print(li_xml) need etudid
|
||||
|
||||
# --- Annulation d'absence
|
||||
|
||||
# context.Absences.AnnuleAbsencesDatesNoJust( dates="22/01/2021")
|
||||
|
||||
|
||||
# --- Fonction renvoyant du code HTML
|
||||
|
||||
etat_abs = context.Absences.EtatAbsences(REQUEST=REQUEST)
|
||||
|
||||
# cal_abs = sco_abs_views.CalAbs( REQUEST=REQUEST) #<--- retourne html + need etudid : how?
|
||||
|
||||
sag = context.Absences.SignaleAbsenceGrSemestre(
|
||||
datedebut="15/01/2021",
|
||||
datefin="22/01/2021",
|
||||
group_ids=[li_grp1[0]["group_id"]],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
sagh = context.Absences.SignaleAbsenceGrHebdo(
|
||||
datelundi="18/01/2021",
|
||||
group_ids=[li_grp1[0]["group_id"]],
|
||||
destination="",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
grp_abs_d = context.Absences.EtatAbsencesDate(
|
||||
group_ids=[li_grp1[0]["group_id"]], date="22/01/2021", REQUEST=REQUEST
|
||||
)
|
||||
|
||||
billet_form = context.Absences.AddBilletAbsenceForm(etudid=etudid, REQUEST=REQUEST)
|
||||
|
||||
# an_abs = AnnuleAbsenceEtud( REQUEST=REQUEST) #<- retourne html + need etudid : how?
|
||||
|
||||
# proc = context.Absences.ProcessBilletAbsenceForm(billet_id=load_li_bi[0]["billet_id"], REQUEST=REQUEST) #error
|
||||
|
||||
# just_form = sco_abs_views.JustifAbsenceEtud( REQUEST=REQUEST)
|
||||
|
||||
# delete_just = sco_abs_views.doAnnuleJustif( datedebut0="22/01/2021", datefin0="22/01/2021", demijournee=2, REQUEST=REQUEST)
|
||||
|
||||
|
||||
"""
|
||||
Commentaire :
|
||||
|
||||
Certaines fonctions ont besoin de l'id de l'étudiant mais n'ont pas ce parametre comment le récupérer ?
|
||||
(CalAbs, SignaleAbsenceEtud, AnnuleAbsenceEtud, JustifAbsenceEtud, doAnnuleJustif, XMLgetAbsEtud)
|
||||
|
||||
D'autres fonctions renvoient du HTML -> comment les tester en python?
|
||||
|
||||
doSignaleAbsenceGrSemestre -> ne fonctionne pas (pb au niveau de l'écriture des parametres au lancement
|
||||
de la fonction?)
|
||||
|
||||
XMLgetBilletsEtud, deleteBilletAbsence -> fonction get ne retourne rien et delete ne supprime rien
|
||||
(lancer fichier test_billet)
|
||||
|
||||
AnnuleAbsencesDatesNoJust -> error line 323, jour='2' (2 doit être un int et non un string?)
|
||||
|
||||
"""
|
@ -1,334 +0,0 @@
|
||||
import sco_formations
|
||||
import json
|
||||
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_moduleimpl
|
||||
import sco_groups_view
|
||||
import sco_abs_views
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
file = open("scotests/export_formation1.xml")
|
||||
doc = file.read()
|
||||
file.close()
|
||||
|
||||
# --- Création de la formation
|
||||
|
||||
f = sco_formations.formation_import_xml(doc=doc)
|
||||
|
||||
# --- Création des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem3 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=3,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=2,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
sem4 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=4,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
|
||||
# --- Implémentation des modules
|
||||
|
||||
li_module = context.Notes.do_module_list()
|
||||
mods_imp = []
|
||||
for mod in li_module:
|
||||
if mod["semestre_id"] == 1:
|
||||
formsemestre_id = sem1["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 2:
|
||||
formsemestre_id = sem2["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 3:
|
||||
formsemestre_id = sem3["formsemestre_id"]
|
||||
else:
|
||||
formsemestre_id = sem4["formsemestre_id"]
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
)
|
||||
mods_imp.append(mi)
|
||||
|
||||
# --- Création des étudiants
|
||||
|
||||
etuds = []
|
||||
for nom, prenom in [
|
||||
("Semestre11", "EtudiantNumero1"),
|
||||
("Semestre12", "EtudiantNumero2"),
|
||||
("Semestre23", "EtudiantNumero3"),
|
||||
("Semestre24", "EtudiantNumero4"),
|
||||
("Semestre35", "EtudiantNumero5"),
|
||||
("Semestre36", "EtudiantNumero6"),
|
||||
("Semestre47", "EtudiantNumero7"),
|
||||
("Semestre48", "EtudiantNumero8"),
|
||||
]:
|
||||
etud = G.create_etud(
|
||||
nom=nom,
|
||||
prenom=prenom,
|
||||
)
|
||||
etuds.append(etud)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
for etud in etuds[0:2]:
|
||||
G.inscrit_etudiant(sem1, etud)
|
||||
|
||||
for etud in etuds[2:4]:
|
||||
G.inscrit_etudiant(sem2, etud)
|
||||
|
||||
for etud in etuds[4:6]:
|
||||
G.inscrit_etudiant(sem3, etud)
|
||||
|
||||
for etud in etuds[6:]:
|
||||
G.inscrit_etudiant(sem4, etud)
|
||||
|
||||
# --- Création d'une évaluation pour chaque UE
|
||||
|
||||
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem1 = json.loads(lim_sem1)
|
||||
|
||||
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem2 = json.loads(lim_sem2)
|
||||
|
||||
lim_sem3 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem3["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem3 = json.loads(lim_sem3)
|
||||
|
||||
lim_sem4 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem4["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem4 = json.loads(lim_sem4)
|
||||
|
||||
|
||||
for moduleimpl_id, jour, description, coefficient in [
|
||||
(load_lim_sem1[1]["moduleimpl_id"], "02/09/2020", "InterroTestSemestre1", 1.0),
|
||||
(load_lim_sem1[2]["moduleimpl_id"], "03/09/2020", "InterroTestSemestre1", 1.0),
|
||||
(load_lim_sem2[1]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre2", 1.0),
|
||||
(load_lim_sem2[8]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre2", 1.0),
|
||||
(load_lim_sem3[3]["moduleimpl_id"], "02/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem3[9]["moduleimpl_id"], "03/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem3[15]["moduleimpl_id"], "04/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem4[3]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[9]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[13]["moduleimpl_id"], "05/02/2021", "InterroTestSemestre4", 1.0),
|
||||
]:
|
||||
e = G.create_evaluation(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
jour=jour,
|
||||
description=description,
|
||||
coefficient=coefficient,
|
||||
)
|
||||
|
||||
|
||||
# --- Saisie des notes des étudiants (un élève a 12, un autre a 7 pour chaque semestre)
|
||||
|
||||
lie1 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem1["formsemestre_id"]
|
||||
)
|
||||
lie2 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem2["formsemestre_id"]
|
||||
)
|
||||
lie3 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem3["formsemestre_id"]
|
||||
)
|
||||
lie4 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem4["formsemestre_id"]
|
||||
)
|
||||
|
||||
for eval in lie1:
|
||||
for etud in etuds[:2]:
|
||||
if etud == etuds[0]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
for eval in lie2:
|
||||
for etud in etuds[2:4]:
|
||||
if etud == etuds[2]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
|
||||
for eval in lie3:
|
||||
for etud in etuds[4:6]:
|
||||
if etud == etuds[4]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
for eval in lie4:
|
||||
for etud in etuds[6:]:
|
||||
if etud == etuds[6]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
# --- Département
|
||||
|
||||
li_dep = context.ScoDoc.list_depts(format="json", REQUEST=REQUEST)
|
||||
print(li_dep)
|
||||
|
||||
# --- Formation
|
||||
|
||||
lif = context.Notes.formation_list(format="json", REQUEST=REQUEST, formation_id=f[0])
|
||||
load_lif = json.loads(lif)
|
||||
assert len(load_lif) == 1
|
||||
assert load_lif[0]["formation_id"] == f[0]
|
||||
|
||||
exp = sco_formations.formation_export(formation_id=f[0], format="json", REQUEST=REQUEST)
|
||||
load_exp = json.loads(exp)
|
||||
assert load_exp["acronyme"] == "DUT Info"
|
||||
assert load_exp["titre_officiel"] == "DUT Informatique"
|
||||
assert load_exp["formation_code"] == "FCOD2"
|
||||
|
||||
# --- Semestre
|
||||
|
||||
li_sem = context.Notes.formsemestre_list(
|
||||
formation_id=f[0], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_li_sem = json.loads(li_sem)
|
||||
assert len(load_li_sem) == 4
|
||||
|
||||
# --- Création des groupes
|
||||
|
||||
_ = sco_groups.partition_create(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
partition_name="Eleve 1ere annee",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
||||
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A")
|
||||
|
||||
li_grp1 = sco_groups.get_partition_groups(context.Scolarite, li1[0])
|
||||
|
||||
for etud in etuds[0:2]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[0]["group_id"])
|
||||
|
||||
|
||||
# --- Groupes
|
||||
|
||||
li_part = sco_groups.formsemestre_partition_list(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_li_part = json.loads(li_part)
|
||||
assert len(load_li_part) == 2 # 2 partition (defaut et eleve 1ere annee)
|
||||
assert load_li_part[0]["formsemestre_id"] == sem1["formsemestre_id"]
|
||||
assert len(load_li_part[0]["group"]) == 1 # 2 groupes S1A
|
||||
assert load_li_part[0]["group"][0]["group_name"] == "Groupe S1A"
|
||||
assert load_li_part[0]["group"][0]["group_id"] == li_grp1[0]["group_id"]
|
||||
assert (
|
||||
load_li_part[0]["partition_id"]
|
||||
== load_li_part[0]["group"][0]["partition_id"]
|
||||
== li1[0]["partition_id"]
|
||||
)
|
||||
assert load_li_part[0]["partition_name"] == "Eleve 1ere annee"
|
||||
|
||||
vue_g1 = sco_groups_view.groups_view(
|
||||
group_ids=[li_grp1[0]["group_id"]],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_vue_g1 = json.loads(vue_g1)
|
||||
assert len(load_vue_g1) == 2
|
||||
assert load_vue_g1[0][li1[0]["partition_id"]] == li_grp1[0]["group_name"]
|
||||
|
||||
|
||||
# --- Etudiant
|
||||
|
||||
etudi = context.Scolarite.etud_info(
|
||||
etudid=etuds[0]["etudid"], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_etudi = json.loads(etudi)
|
||||
assert load_etudi["prenom"] == "Etudiantnumero1"
|
||||
assert load_etudi["nom"] == "SEMESTRE11"
|
||||
assert load_etudi["etudid"] == etuds[0]["etudid"]
|
||||
|
||||
# --- Absences
|
||||
|
||||
for debut, fin, demijournee in [
|
||||
("18/01/2021", "18/01/2021", 1),
|
||||
("19/01/2021", "19/01/2021", 0),
|
||||
]:
|
||||
sco_abs_views.doSignaleAbsence(
|
||||
datedebut=debut,
|
||||
datefin=fin,
|
||||
demijournee=demijournee,
|
||||
etudid=etuds[0]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
nb_abs = context.Absences.CountAbs(
|
||||
etuds[0]["etudid"], debut="09/01/2020", fin="02/01/2021"
|
||||
)
|
||||
assert nb_abs == 2
|
||||
|
||||
liste_abs = sco_abs_views.ListeAbsEtud(
|
||||
etuds[0]["etudid"], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_liste_abs = json.loads(liste_abs)
|
||||
assert len(load_liste_abs) == 2
|
||||
|
||||
_ = sco_abs_views.doAnnuleAbsence(
|
||||
"15/01/2021",
|
||||
"15/01/2021",
|
||||
1,
|
||||
etudid=etuds[0]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Module
|
||||
|
||||
# Voir test dans test_formation.
|
@ -1,104 +0,0 @@
|
||||
# -*- 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)
|
||||
etudid = etud["etudid"]
|
||||
|
||||
# --- Création d'une absence
|
||||
sco_abs_views.doSignaleAbsence(
|
||||
datedebut="22/01/2021",
|
||||
datefin="22/01/2021",
|
||||
demijournee=2,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Création d'un billet
|
||||
b1 = context.Absences.AddBilletAbsence(
|
||||
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,
|
||||
)
|
||||
|
||||
# --- 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)
|
||||
|
||||
li_bi2 = context.Absences.listeBilletsEtud(
|
||||
etudid=etudid, REQUEST=REQUEST, format="json"
|
||||
)
|
||||
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
|
||||
return self.sco_header(REQUEST) + "\n".join(H) + self.sco_footer()
|
||||
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 223: ordinal not in range(128)
|
||||
|
||||
"""
|
@ -1,73 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Test notes bonus/malus
|
||||
|
||||
Création 10 étudiants, puis formation en 4 semestre.
|
||||
Le premier étudiant redouble sa deuxième année.
|
||||
|
||||
Utiliser comme:
|
||||
scotests/scointeractive.sh -r TEST00 scotests/test_bonusmalus.py
|
||||
|
||||
"""
|
||||
|
||||
# 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
|
||||
import scotests.sco_fake_gen as sco_fake_gen
|
||||
import sco_utils as scu
|
||||
import sco_moduleimpl
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes) # pylint: disable=undefined-variable
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
||||
|
||||
# --- Mise en place formation 1 semestre
|
||||
f, ue_list, mod_list = G.setup_formation(nb_semestre=1)
|
||||
|
||||
# --- Ajoute module malus à la premiere matiere de la première UE
|
||||
mod_malus = G.create_module(
|
||||
titre="MALUS",
|
||||
code="MAL",
|
||||
coefficient=10,
|
||||
ue_id=ue_list[0]["ue_id"],
|
||||
matiere_id=mod_list[0]["matiere_id"],
|
||||
formation_id=f["formation_id"],
|
||||
semestre_id=1,
|
||||
module_type=scu.MODULE_MALUS,
|
||||
)
|
||||
mod_list.append(mod_malus)
|
||||
|
||||
# --- Crée le semestre
|
||||
|
||||
semestre_id, date_debut, date_fin = (1, "01/09/2019", "15/01/2020")
|
||||
sem, eval_list = G.setup_formsemestre(
|
||||
f, mod_list, semestre_id=semestre_id, date_debut=date_debut, date_fin=date_fin
|
||||
)
|
||||
|
||||
# --- Recupère le module de malus
|
||||
modimpls = sco_moduleimpl.do_moduleimpl_list( # pylint: disable=undefined-variable
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
)
|
||||
# de façon tout à fait inefficace ;-)
|
||||
moduleimpl_malus = [m for m in modimpls if m["module_id"] == mod_malus["module_id"]][0]
|
||||
# et l'évaluation de malus, de la même façon:
|
||||
eval_malus = [
|
||||
e for e in eval_list if e["moduleimpl_id"] == moduleimpl_malus["moduleimpl_id"]
|
||||
][0]
|
||||
eval_normales = [
|
||||
e for e in eval_list if e["moduleimpl_id"] != moduleimpl_malus["moduleimpl_id"]
|
||||
]
|
||||
|
||||
# --- Affect des malus entre -10 et +10
|
||||
n = len(etuds)
|
||||
malus = [((x / (n - 1.0)) * 20) - 10 for x in range(n)]
|
||||
for etud, note in zip(etuds, malus):
|
||||
G.create_note(evaluation=e, etud=etud, note=note)
|
||||
|
||||
# --- Inscrit les étudiants et affecte des notes aléatoires aux évaluations normales
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
G.set_etud_notes_sem(sem, eval_normales, etuds)
|
@ -1,112 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Test jury et capitalisation
|
||||
|
||||
Création 10 étudiants, puis formation en 4 semestre.
|
||||
Le premier étudiant redouble sa deuxième année.
|
||||
|
||||
Utiliser comme:
|
||||
scotests/scointeractive.sh -r TEST00 scotests/test_capitalisation.py
|
||||
|
||||
"""
|
||||
# La variable context est définie par le script de lancement
|
||||
# l'affecte ainsi pour éviter les warnings pylint:
|
||||
context = context # pylint: disable=undefined-variable
|
||||
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
||||
import sco_utils
|
||||
import sco_codes_parcours
|
||||
import sco_modalites
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
||||
|
||||
# Deux modalités
|
||||
# sco_modalites.do_modalite_create( {})
|
||||
|
||||
# --- Mise en place formation 4 semestres
|
||||
form_dut, ue_list, mod_list = G.setup_formation(
|
||||
nb_semestre=4, titre="DUT RT", acronyme="DUT-RT"
|
||||
)
|
||||
|
||||
# --- et une formation LP en 2 semestres
|
||||
form_lp, ue_list_lp, mod_list_lp = G.setup_formation(
|
||||
nb_semestre=2, titre="Licence Pro Ingéniérie Pédagogique", acronyme="LP IP"
|
||||
)
|
||||
# et un semestre que l'on ne va pas utiliser ici:
|
||||
_, _ = G.setup_formsemestre(
|
||||
form_lp,
|
||||
mod_list_lp,
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2021",
|
||||
date_fin="15/01/2022",
|
||||
titre="Licence Pro Ingéniérie Pédagogique",
|
||||
responsables=["callas"],
|
||||
modalite="FAP",
|
||||
)
|
||||
|
||||
# --- Crée les 4 semestres et affecte des notes aléatoires
|
||||
sems, evals = [], []
|
||||
for semestre_id, date_debut, date_fin in [
|
||||
(1, "01/09/2019", "15/01/2020"),
|
||||
(2, "16/01/2020", "30/06/2020"),
|
||||
(3, "01/09/2020", "15/01/2021"),
|
||||
(4, "16/01/2021", "30/06/2021"),
|
||||
]:
|
||||
sem, eval_list = G.setup_formsemestre(
|
||||
form_dut,
|
||||
mod_list,
|
||||
semestre_id=semestre_id,
|
||||
date_debut=date_debut,
|
||||
date_fin=date_fin,
|
||||
titre="BUT Réseaux et Tests",
|
||||
)
|
||||
sems.append(sem)
|
||||
evals.append(eval_list) # liste des listes d'evaluations
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
G.set_etud_notes_sem(sem, eval_list, etuds)
|
||||
|
||||
|
||||
# def evals_premiere_ue(eval_list):
|
||||
# return
|
||||
|
||||
|
||||
# Le premier étudiant va redoubler sa deuxième année
|
||||
# on crée 2 semestres supplémentaires auxquels on n'inscrit que lui
|
||||
# puis on ajuste ses notes de S3, S4 et S3bis, S4bis
|
||||
etud = etuds[0] # l'étudiant redoublant
|
||||
for semestre_id, date_debut, date_fin in [
|
||||
(3, "01/09/2022", "15/01/2023"),
|
||||
(4, "16/01/2023", "30/06/2023"),
|
||||
]:
|
||||
sem, eval_list = G.setup_formsemestre(
|
||||
form_dut,
|
||||
mod_list,
|
||||
semestre_id=semestre_id,
|
||||
date_debut=date_debut,
|
||||
date_fin=date_fin,
|
||||
titre="BUT Réseaux et Tests",
|
||||
)
|
||||
sems.append(sem)
|
||||
evals.append(eval_list) # liste des listes d'evaluations
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
|
||||
# Donne 11.5 aux evals UE1 de son premier S3:
|
||||
G.set_etud_notes_sem(sems[3 - 1], evals[3 - 1][:2], [etud], [11.5])
|
||||
# et 8 aux evals de l'UE2:
|
||||
G.set_etud_notes_sem(sems[3 - 1], evals[3 - 1][2:], [etud], [8.0])
|
||||
|
||||
# et 9 en UE1 de son second S3:
|
||||
# G.set_etud_notes_sem(sems[5 - 1], evals[5 - 1][:2], [etud], [9.0])
|
||||
# et 12 en U2 de son second S3:
|
||||
G.set_etud_notes_sem(sems[5 - 1], evals[5 - 1][2:], [etud], [12.0])
|
||||
|
||||
# Jury: S1/ADM, S2/ADJ, S3/AJ, S4/AJ
|
||||
G.set_code_jury(sems[0], etud, code_etat=sco_codes_parcours.ADM)
|
||||
G.set_code_jury(sems[1], etud, code_etat=sco_codes_parcours.ADJ)
|
||||
G.set_code_jury(sems[2], etud, code_etat=sco_codes_parcours.AJ)
|
||||
G.set_code_jury(sems[3], etud, code_etat=sco_codes_parcours.AJ)
|
@ -1,75 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -
|
||||
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)
|
||||
etudid = etud["etudid"]
|
||||
|
||||
# --- Création d'une absence
|
||||
sco_abs_views.doSignaleAbsence(
|
||||
datedebut="22/01/2021",
|
||||
datefin="22/01/2021",
|
||||
demijournee=2,
|
||||
etudid=etudid,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Création d'un billet
|
||||
b1 = context.Absences.AddBilletAbsence(
|
||||
begin="2021-01-22 00:00",
|
||||
end="2021-01-22 23:59",
|
||||
etudid=etudid,
|
||||
description="abs du 22",
|
||||
justified=False,
|
||||
code_nip=etuds[0]["code_nip"],
|
||||
code_ine=etuds[0]["code_ine"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Suppression d'un billet
|
||||
_ = context.Absences.deleteBilletAbsence(load_li_bi[1]["billet_id"], REQUEST=REQUEST)
|
||||
|
||||
li_bi = context.Absences.listeBilletsEtud(etudid=etudid, REQUEST=REQUEST, format="json")
|
||||
load_li_bi = json.loads(li_bi)
|
||||
|
||||
assert len(load_li_bi) == 0
|
@ -1,101 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Test inscriptions / demissions / affichages notes
|
||||
|
||||
- Création 2 étudiants, puis formation en 1 semestre.
|
||||
- Saisie de 2 notes
|
||||
- Demission d'un étudiant
|
||||
- bulletins
|
||||
|
||||
Utiliser comme:
|
||||
scotests/scointeractive.sh -r TEST00 scotests/test_demissions.py
|
||||
|
||||
"""
|
||||
import datetime
|
||||
import re
|
||||
import json
|
||||
|
||||
# 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_utils
|
||||
import sco_bulletins
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
nb_etuds = 10
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(nb_etuds)]
|
||||
# --- Mise en place formation
|
||||
form, ue_list, mod_list = G.setup_formation(
|
||||
nb_semestre=1, titre="Essai 1", acronyme="ESS01"
|
||||
)
|
||||
# Mise en place semestre
|
||||
sem, eval_list = G.setup_formsemestre(
|
||||
form,
|
||||
mod_list,
|
||||
semestre_id=1,
|
||||
date_debut="01/01/2021",
|
||||
date_fin="31/12/2021",
|
||||
titre="Essai démissions",
|
||||
)
|
||||
# Inscriptions
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
# Notes
|
||||
G.set_etud_notes_sem(sem, eval_list, etuds)
|
||||
|
||||
# Bulletins
|
||||
bul = sco_bulletins.formsemestre_bulletinetud_dict(
|
||||
sem["formsemestre_id"], etuds[0]["etudid"]
|
||||
)
|
||||
print(bul["moy_gen"])
|
||||
assert bul["ins"][0]["etat"] == "I"
|
||||
|
||||
# Démission:
|
||||
context.doDemEtudiant(
|
||||
etuds[0]["etudid"], sem["formsemestre_id"], event_date="15/12/2021"
|
||||
)
|
||||
bul = sco_bulletins.formsemestre_bulletinetud_dict(
|
||||
sem["formsemestre_id"], etuds[0]["etudid"]
|
||||
)
|
||||
print(bul["moy_gen"])
|
||||
|
||||
assert bul["moy_gen"] == "NA"
|
||||
assert bul["ins"][0]["etat"] == "D"
|
||||
|
||||
# ------------ Billets d'absences
|
||||
etud = etuds[1] # non demissionnaire
|
||||
d = sem["date_debut_iso"]
|
||||
d_beg = datetime.datetime(*[int(x) for x in d.split("-")])
|
||||
d_end = d_beg + datetime.timedelta(2)
|
||||
description = "billet test 0"
|
||||
x = context.Absences.AddBilletAbsence(
|
||||
d_beg.isoformat(),
|
||||
d_end.isoformat(),
|
||||
description=description,
|
||||
etudid=etud["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
#
|
||||
billet_id = re.search(r"billet_id value=\"([A-Z0-9]+)\"", x).group(1)
|
||||
context.Absences.deleteBilletAbsence(billet_id, REQUEST=REQUEST, dialog_confirmed=True)
|
||||
j = context.Absences.listeBilletsEtud(
|
||||
etudid=etud["etudid"], REQUEST=REQUEST, format="json"
|
||||
)
|
||||
assert len(json.loads(j)) == 0
|
||||
x = context.Absences.AddBilletAbsence(
|
||||
d_beg.isoformat(),
|
||||
d_end.isoformat(),
|
||||
description=description,
|
||||
etudid=etud["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
j = context.Absences.listeBilletsEtud(
|
||||
etudid=etud["etudid"], REQUEST=REQUEST, format="json"
|
||||
)
|
||||
assert json.loads(j)[0]["description"] == description
|
@ -1,145 +0,0 @@
|
||||
""" Création de 2 étudiants, un qui demissionne, un autre defaillant + annuler demission et annuler défaillance
|
||||
|
||||
Fonctions de l’API utilisé :
|
||||
- doDemEtudiant
|
||||
- doDefEtudiant
|
||||
- doCancelDem
|
||||
- doCancelDef
|
||||
- etud_info
|
||||
- search_etud_in_dept
|
||||
- fillEtudsInfo
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import random
|
||||
|
||||
# La variable context est définie par le script de lancement
|
||||
# l'affecte ainsi pour éviter 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 scolars
|
||||
import sco_find_etud
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
|
||||
etud1 = G.create_etud(
|
||||
code_nip="",
|
||||
nom="Poire",
|
||||
prenom="Kevin",
|
||||
code_ine="",
|
||||
civilite="M",
|
||||
etape="TST1",
|
||||
email="test1@localhost",
|
||||
emailperso="perso1@localhost",
|
||||
date_naissance="01/05/2001",
|
||||
lieu_naissance="Stains",
|
||||
dept_naissance="93",
|
||||
domicile="11, rue du test",
|
||||
codepostaldomicile="93430",
|
||||
villedomicile="Villetaneuse",
|
||||
paysdomicile="France",
|
||||
telephone="0102030405",
|
||||
typeadresse="domicile",
|
||||
boursier=None,
|
||||
description="etudiant test",
|
||||
)
|
||||
|
||||
etud2 = G.create_etud()
|
||||
|
||||
# --- 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/2020",
|
||||
date_fin="30/06/2020",
|
||||
)
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
G.inscrit_etudiant(sem, etud1)
|
||||
G.inscrit_etudiant(sem, etud2)
|
||||
|
||||
# --- Etud_info
|
||||
|
||||
info = context.Scolarite.etud_info(etud1["etudid"], format="json", REQUEST=REQUEST)
|
||||
load_info = json.loads(info)
|
||||
|
||||
|
||||
# --- Démission étudiant
|
||||
|
||||
context.doDemEtudiant(etud1["etudid"], sem["formsemestre_id"], event_date="01/01/2021")
|
||||
|
||||
bul = sco_bulletins.formsemestre_bulletinetud_dict(
|
||||
sem["formsemestre_id"], etud1["etudid"]
|
||||
)
|
||||
assert bul["moy_gen"] == "NA"
|
||||
assert bul["ins"][0]["etat"] == "D"
|
||||
|
||||
# --- Défaillance d'un étudiant
|
||||
|
||||
context.doDefEtudiant(etud2["etudid"], sem["formsemestre_id"], event_date="01/01/2021")
|
||||
|
||||
bul = sco_bulletins.formsemestre_bulletinetud_dict(
|
||||
sem["formsemestre_id"], etud1["etudid"]
|
||||
)
|
||||
assert bul["moy_gen"] == "NA"
|
||||
assert bul["ins"][0]["etat"] == "D"
|
||||
|
||||
# --- Annuler démission
|
||||
|
||||
context.Scolarite.doCancelDem(etud1["etudid"], sem["formsemestre_id"], REQUEST=REQUEST)
|
||||
bul = sco_bulletins.formsemestre_bulletinetud_dict(
|
||||
sem["formsemestre_id"], etud1["etudid"]
|
||||
)
|
||||
print(bul["ins"][0]["etat"])
|
||||
# assert bul["ins"][0]["etat"] == "I"
|
||||
|
||||
# --- Annuler défaillance
|
||||
|
||||
context.Scolarite.doCancelDef(etud2["etudid"], sem["formsemestre_id"], REQUEST=REQUEST)
|
||||
bul = sco_bulletins.formsemestre_bulletinetud_dict(
|
||||
sem["formsemestre_id"], etud1["etudid"]
|
||||
)
|
||||
print(bul["ins"][0]["etat"])
|
||||
# assert bul["ins"][0]["etat"] == "I"
|
||||
|
||||
# --- Fonctions retournant HTML
|
||||
|
||||
find = sco_find_etud.search_etud_in_dept(
|
||||
context.Scolarite, expnom="Poire", REQUEST=REQUEST
|
||||
)
|
||||
|
||||
_ = context.Scolarite.fillEtudsInfo(etuds=[etud1])
|
||||
|
||||
"""
|
||||
Commentaire :
|
||||
|
||||
L'etat ne se met pas à jour après l'annulation de la démission ou de la défaillance.
|
||||
|
||||
etud_info ne donne pas toutes les infos de l'étudiant voir mini test create_etud.
|
||||
|
||||
"""
|
@ -1,279 +0,0 @@
|
||||
""" Création d'une formation, d'élève de 2 ue dans un semestre et de 6 évaluations par 3 fonction différentes :
|
||||
create_eval, evaluation_create et do_evaluation_create. Saisir les notes des évaluations, lister ces evaluations,
|
||||
supprimer et modifier une evaluation
|
||||
|
||||
Fonction de l'API utilisé :
|
||||
- create_evaluation
|
||||
- evaluation_create
|
||||
- do_evaluation_create
|
||||
- do_evaluation_list_in_formsemestre
|
||||
- do_evaluation_list
|
||||
- create_note
|
||||
- check_absences
|
||||
- do_evaluation_etat
|
||||
- evaluation_supress_alln
|
||||
- do_evaluation_edit
|
||||
- do_evaluation_delete
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
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_moduleimpl
|
||||
import sco_liste_notes
|
||||
import sco_evaluations
|
||||
import sco_undo_notes
|
||||
import sco_abs_views
|
||||
import sco_saisie_notes
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
||||
|
||||
# --- Création d'une formation et de deux UE
|
||||
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
|
||||
)
|
||||
|
||||
ue2 = G.create_ue(formation_id=f["formation_id"], acronyme="TST2", titre="ue test2")
|
||||
mat2 = G.create_matiere(ue_id=ue2["ue_id"], titre="matière test2")
|
||||
mod2 = G.create_module(
|
||||
matiere_id=mat2["matiere_id"],
|
||||
code="TSM2",
|
||||
coefficient=1.0,
|
||||
titre="module test2",
|
||||
ue_id=ue2["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",
|
||||
)
|
||||
|
||||
mi2 = G.create_moduleimpl(
|
||||
module_id=mod2["module_id"],
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
|
||||
# --- Inscription des étudiants
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
|
||||
# --- Création des évaluations
|
||||
|
||||
# création d'éval avec create_evaluation
|
||||
e = G.create_evaluation(
|
||||
moduleimpl_id=mi["moduleimpl_id"],
|
||||
jour="7/01/2021",
|
||||
description="evaluation test 1",
|
||||
coefficient=1.0,
|
||||
)
|
||||
|
||||
e2 = G.create_evaluation(
|
||||
moduleimpl_id=mi2["moduleimpl_id"],
|
||||
jour="11/01/2021",
|
||||
description="evaluation test 2",
|
||||
coefficient=1.0,
|
||||
)
|
||||
|
||||
|
||||
# création d'éval avec evaluation_create
|
||||
# e3 = context.Notes.evaluation_create(mi["moduleimpl_id"], REQUEST)
|
||||
# e4 = context.Notes.evaluation_create(mi2["moduleimpl_id"], REQUEST) # rien ne se passe
|
||||
|
||||
# création d'éval avec do_evaluation_create ! WARNING : retourne l'id de l'éval !
|
||||
e5 = context.Notes.do_evaluation_create(
|
||||
moduleimpl_id=mi["moduleimpl_id"],
|
||||
jour="01/02/2021",
|
||||
heure_debut="9h0",
|
||||
heure_fin="11h0",
|
||||
description="evaluation test 5",
|
||||
note_max="20.0",
|
||||
coefficient="1",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
e6 = context.Notes.do_evaluation_create(
|
||||
moduleimpl_id=mi2["moduleimpl_id"],
|
||||
jour="01/02/2021",
|
||||
heure_debut="13h0",
|
||||
heure_fin="15h0",
|
||||
description="evaluation test 6",
|
||||
note_max="20.0",
|
||||
coefficient="1",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
# --- Liste des évaluations dans le semestre
|
||||
|
||||
lie = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem["formsemestre_id"]
|
||||
)
|
||||
assert len(lie) == 4
|
||||
""" print(lie[0])
|
||||
print(" ")
|
||||
print(lie[1])
|
||||
print(" ")
|
||||
print(lie[2])
|
||||
print(" ")
|
||||
print(lie[3]) """
|
||||
|
||||
eval5 = context.Notes.do_evaluation_list({"evaluation_id": e5})[0]
|
||||
eval6 = context.Notes.do_evaluation_list({"evaluation_id": e6})[0]
|
||||
|
||||
# --- Saisie des absences aux évaluations
|
||||
|
||||
_ = sco_abs_views.doSignaleAbsence(
|
||||
"7/01/2021",
|
||||
"7/01/2021",
|
||||
demijournee=1,
|
||||
etudid=etuds[0]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
_ = sco_abs_views.doSignaleAbsence(
|
||||
"01/02/2021",
|
||||
"01/02/2021",
|
||||
demijournee=1,
|
||||
etudid=etuds[1]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
_ = sco_abs_views.doJustifAbsence(
|
||||
"01/02/2021",
|
||||
"01/02/2021",
|
||||
demijournee=1,
|
||||
etudid=etuds[1]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Saisie des notes
|
||||
|
||||
evals = [e, e2, eval5, eval6]
|
||||
|
||||
for eval in evals:
|
||||
for etud in etuds:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=float(random.randint(0, 20))
|
||||
)
|
||||
|
||||
# --- Check abs
|
||||
|
||||
check = sco_liste_notes.evaluation_check_absences(evaluation_id=e["evaluation_id"])
|
||||
|
||||
check2 = sco_liste_notes.evaluation_check_absences(evaluation_id=e2["evaluation_id"])
|
||||
|
||||
# --- Liste de note d'une évaluation
|
||||
|
||||
# lien = sco_liste_notes.do_evaluation_listenotes(context=context.Notes, REQUEST=REQUEST)
|
||||
|
||||
cal = sco_evaluations.formsemestre_evaluations_cal(
|
||||
context.Notes, formsemestre_id=sem["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
# html
|
||||
|
||||
delai = sco_evaluations.formsemestre_evaluations_delai_correction(
|
||||
context.Notes,
|
||||
formsemestre_id=sem["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
# html
|
||||
|
||||
lio = sco_undo_notes.evaluation_list_operations(
|
||||
evaluation_id=e["evaluation_id"], REQUEST=REQUEST
|
||||
)
|
||||
# html
|
||||
|
||||
|
||||
# --- Supression de toutes les notes d'une évaluations
|
||||
|
||||
etat = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
||||
assert etat["evalcomplete"]
|
||||
sco_saisie_notes.evaluation_suppress_alln(e2["evaluation_id"])
|
||||
etat2 = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
||||
|
||||
# assert not etat2["evalcomplete"] rien ne se passe...
|
||||
|
||||
# --- Modification d'une évaluation
|
||||
|
||||
context.Notes.do_evaluation_edit(
|
||||
REQUEST=REQUEST,
|
||||
args={
|
||||
"evaluation_id": e5,
|
||||
"coefficient": 2.0,
|
||||
"description": "modification",
|
||||
"note_max": 20,
|
||||
"heure_debut": "8h0",
|
||||
"heure_fin": "10h0",
|
||||
"jour": "03/02/2021",
|
||||
},
|
||||
)
|
||||
new_eval5 = context.Notes.do_evaluation_list({"evaluation_id": e5})[0]
|
||||
|
||||
assert new_eval5["description"] == "modification"
|
||||
assert new_eval5["jour"] == "03/02/2021"
|
||||
assert new_eval5["heure_debut"] == "08h00"
|
||||
assert new_eval5["heure_fin"] == "10h00"
|
||||
assert new_eval5["coefficient"] == 2.0
|
||||
|
||||
# --- Supression d'une évaluation
|
||||
|
||||
e7 = G.create_evaluation(
|
||||
moduleimpl_id=mi["moduleimpl_id"],
|
||||
jour="7/01/2021",
|
||||
description="evaluation test 7",
|
||||
coefficient=1.0,
|
||||
)
|
||||
|
||||
lie = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem["formsemestre_id"]
|
||||
)
|
||||
assert len(lie) == 5
|
||||
|
||||
# context.Notes.evaluation_delete(REQUEST=REQUEST, evaluation_id=e7) rien ne se passe
|
||||
sco_evaluations.do_evaluation_delete(
|
||||
context.Notes, REQUEST=REQUEST, evaluation_id=e7["evaluation_id"]
|
||||
)
|
||||
lie2 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem["formsemestre_id"]
|
||||
)
|
||||
assert len(lie2) == 4
|
||||
|
||||
|
||||
"""
|
||||
Commentaire :
|
||||
|
||||
Plusieurs fonction retourne de l'HTML, les notes ne se suppriment pas malgre l'utilisation de la fonction
|
||||
evaluation_supress_alln (voir mini test). evaluation_delete ---> rien ne se passe.
|
||||
|
||||
"""
|
@ -1,82 +0,0 @@
|
||||
import sco_formations
|
||||
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_moduleimpl
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
file = open("scotests/export_formation1.xml")
|
||||
doc = file.read()
|
||||
file.close()
|
||||
|
||||
print(doc)
|
||||
print("\n \n \n")
|
||||
# --- Création de la formation
|
||||
|
||||
f = sco_formations.formation_import_xml(doc=doc)
|
||||
|
||||
|
||||
# --- Création des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem3 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=3,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=2,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
sem4 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=4,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
|
||||
# --- Implémentation des modules
|
||||
|
||||
li_module = context.Notes.do_module_list()
|
||||
mods_imp = []
|
||||
for mod in li_module:
|
||||
if mod["semestre_id"] == 1:
|
||||
formsemestre_id = sem1["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 2:
|
||||
formsemestre_id = sem2["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 3:
|
||||
formsemestre_id = sem3["formsemestre_id"]
|
||||
else:
|
||||
formsemestre_id = sem4["formsemestre_id"]
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
)
|
||||
mods_imp.append(mi)
|
||||
|
||||
# --- Test de export_formation format xml
|
||||
|
||||
form_exp = sco_formations.formation_export(
|
||||
formation_id=f[0], format="xml", REQUEST=REQUEST
|
||||
)
|
||||
print(form_exp[39:])
|
@ -1,442 +0,0 @@
|
||||
""" 1) Création de 20 étudiants, création d’une formation, inscription de 10 étudiants dans un semestre (1ere année),
|
||||
10 dans un autre (2eme année), création de module, ue,
|
||||
matière et affectation des étudiants dans deux groupes : A et B pour chaque semestre.
|
||||
créer 2 évaluations,
|
||||
affecter des notes dans chaque évaluation et donner la liste des étudiants inscrits à l’évaluation pour chaque groupe.
|
||||
Donner la liste des groupes auxquels des étudiants inscrits appartiennent à cette évaluation.
|
||||
Pour une raison quelquonque un élève souhaite changer de groupe.
|
||||
Changer le nom d'un groupe et d'une partition (à l'aide de fonction)
|
||||
|
||||
|
||||
|
||||
- Vérification du bon nombres d’étudiants dans chaque chaque groupe (5)
|
||||
|
||||
- Vérification des noms de la formations (acro = DUTI, titre = DUT Info, titre_officiel = DUT Informatique),
|
||||
UE (acr = UE11/UE31, titre = UE1S1/UE1S3), modules (code = M1S1/M1S3, titre = mod1/mod2), matières (ue_id=ue1/2[ue_id], titre = mat1/mat2)
|
||||
|
||||
- Vérification des listes de groupes et de partitions
|
||||
|
||||
- Vérification du changement de groupe des étudiants
|
||||
|
||||
- Teste d'autres fonctions de l'API correspondant aux groupes
|
||||
|
||||
Fonctions de l’API utilisé :
|
||||
- create_formation
|
||||
- create_ue
|
||||
- create_module
|
||||
- create_matiere
|
||||
- create_formsemestre
|
||||
- create_moduleimpl
|
||||
- inscrit_etudiant
|
||||
- partition_create
|
||||
- get_default_partition
|
||||
- createGroupe
|
||||
- partition_create
|
||||
- get_partitions_list
|
||||
- get_partition_groups
|
||||
- set_group
|
||||
- get_etud_groups
|
||||
- change_etud_group_in_partition
|
||||
- get_group
|
||||
- group_delete
|
||||
- get_partition
|
||||
- get_default_group
|
||||
- get_default_partition
|
||||
- get_sem_groups
|
||||
- get_group_members
|
||||
- do_evaluation_listeetuds_groups
|
||||
- do_evaluation_listegroupes
|
||||
- formsemestre_partition_list
|
||||
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
# La variable context est définie par le script de lancement
|
||||
# l'affecte ainsi pour éviter 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_groups
|
||||
import sco_groups_view
|
||||
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(20)]
|
||||
assert len(etuds) == 20
|
||||
|
||||
# --- Création d'une formation
|
||||
|
||||
f = G.create_formation(
|
||||
acronyme="DUTI",
|
||||
titre="DUT Info",
|
||||
titre_officiel="DUT Informatique",
|
||||
)
|
||||
|
||||
assert f["acronyme"] == "DUTI"
|
||||
assert f["titre"] == "DUT Info"
|
||||
assert f["titre_officiel"] == "DUT Informatique"
|
||||
|
||||
|
||||
# --- Création d'UE, matière, module pour les premieres années
|
||||
|
||||
ue1 = G.create_ue(formation_id=f["formation_id"], acronyme="UE11", titre="UE1S1")
|
||||
|
||||
mat1 = G.create_matiere(ue_id=ue1["ue_id"], titre="mat1")
|
||||
mod1 = G.create_module(
|
||||
matiere_id=mat1["matiere_id"],
|
||||
code="M1S1",
|
||||
coefficient=1.0,
|
||||
titre="mod1",
|
||||
ue_id=ue1["ue_id"], # faiblesse de l'API
|
||||
formation_id=f["formation_id"], # faiblesse de l'API
|
||||
)
|
||||
|
||||
assert ue1["formation_id"] == f["formation_id"]
|
||||
assert ue1["acronyme"] == "UE11"
|
||||
assert ue1["titre"] == "UE1S1"
|
||||
|
||||
assert mod1["matiere_id"] == mat1["matiere_id"]
|
||||
assert mod1["code"] == "M1S1"
|
||||
assert mod1["titre"] == "mod1"
|
||||
assert mod1["ue_id"] == ue1["ue_id"]
|
||||
assert mod1["formation_id"] == f["formation_id"]
|
||||
|
||||
# --- Création d'UE, matière, module pour les deuxieme années
|
||||
|
||||
ue2 = G.create_ue(formation_id=f["formation_id"], acronyme="UE31", titre="UE1S1")
|
||||
|
||||
mat2 = G.create_matiere(ue_id=ue2["ue_id"], titre="mat2")
|
||||
mod2 = G.create_module(
|
||||
matiere_id=mat2["matiere_id"],
|
||||
code="M1S3",
|
||||
coefficient=1.0,
|
||||
titre="mod2",
|
||||
ue_id=ue2["ue_id"], # faiblesse de l'API
|
||||
formation_id=f["formation_id"], # faiblesse de l'API
|
||||
)
|
||||
|
||||
# --- Mise place des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f["formation_id"],
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
assert sem1["formation_id"] == f["formation_id"]
|
||||
assert sem1["semestre_id"] == 1
|
||||
assert sem1["date_debut"] == "01/09/2020"
|
||||
assert sem1["date_fin"] == "01/02/2021"
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f["formation_id"],
|
||||
semestre_id=2,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
|
||||
mi1 = G.create_moduleimpl(
|
||||
module_id=mod1["module_id"],
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
assert mi1["module_id"] == mod1["module_id"]
|
||||
assert mi1["formsemestre_id"] == sem1["formsemestre_id"]
|
||||
assert mi1["responsable_id"] == "bach"
|
||||
|
||||
mi2 = G.create_moduleimpl(
|
||||
module_id=mod2["module_id"],
|
||||
formsemestre_id=sem2["formsemestre_id"],
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
for etud in etuds[:10]:
|
||||
G.inscrit_etudiant(sem1, etud)
|
||||
|
||||
for etud in etuds[10:]:
|
||||
G.inscrit_etudiant(sem2, etud)
|
||||
|
||||
# --- Création de 2 partitions
|
||||
|
||||
_ = sco_groups.partition_create(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
partition_name="Eleve 1ere annee",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
_ = sco_groups.partition_create(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem2["formsemestre_id"],
|
||||
partition_name="Eleve 2eme annee",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
||||
li2 = sco_groups.get_partitions_list(context.Scolarite, sem2["formsemestre_id"])
|
||||
|
||||
|
||||
# --- Création des groupes
|
||||
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1B")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3A")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3B")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe TEST")
|
||||
|
||||
li_grp1 = sco_groups.get_partition_groups(context.Scolarite, li1[0])
|
||||
li_grp2 = sco_groups.get_partition_groups(context.Scolarite, li2[0])
|
||||
li_grp3 = sco_groups.get_partition_groups(
|
||||
context.Scolarite, li1[1]
|
||||
) # liste groupe defaut
|
||||
|
||||
assert len(li_grp1) == 2 # test de get_partition_groups # 2
|
||||
assert len(li_grp2) == 3 # test de get_partition_groups # 3
|
||||
assert li_grp1[0]["group_name"] == "Groupe S1A"
|
||||
|
||||
|
||||
# --- Affectation des élèves dans les groupes
|
||||
|
||||
for etud in etuds[:5]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[0]["group_id"])
|
||||
|
||||
for etud in etuds[5:10]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[1]["group_id"])
|
||||
|
||||
for etud in etuds[10:15]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp2[0]["group_id"])
|
||||
|
||||
for etud in etuds[15:]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp2[1]["group_id"])
|
||||
|
||||
# --- Vérification si les élèves sont bien dans les bons groupes
|
||||
|
||||
for etud in etuds[:5]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S1A"
|
||||
|
||||
for etud in etuds[5:10]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S1B"
|
||||
|
||||
for etud in etuds[10:15]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem2, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S3A"
|
||||
|
||||
for etud in etuds[15:]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem2, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S3B"
|
||||
|
||||
# --- Création d'une évaluation
|
||||
|
||||
e1 = G.create_evaluation(
|
||||
moduleimpl_id=mi1["moduleimpl_id"],
|
||||
jour="01/10/2020",
|
||||
description="evaluation test",
|
||||
coefficient=1.0,
|
||||
)
|
||||
|
||||
e2 = G.create_evaluation(
|
||||
moduleimpl_id=mi2["moduleimpl_id"],
|
||||
jour="01/11/2020",
|
||||
description="evaluation test2",
|
||||
coefficient=1.0,
|
||||
)
|
||||
|
||||
# --- Saisie des notes
|
||||
|
||||
for etud in etuds[10:]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=e1, etud=etud, note=float(random.randint(0, 20))
|
||||
)
|
||||
|
||||
|
||||
for etud in etuds[:10]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=e2, etud=etud, note=float(random.randint(0, 20))
|
||||
)
|
||||
|
||||
# --- Liste des étudiants inscrits aux evaluations
|
||||
|
||||
lie1 = sco_groups.do_evaluation_listeetuds_groups(
|
||||
context.Scolarite, e1["evaluation_id"], groups=li_grp1
|
||||
)
|
||||
lie2 = sco_groups.do_evaluation_listeetuds_groups(
|
||||
context.Scolarite, e2["evaluation_id"], groups=li_grp2
|
||||
)
|
||||
|
||||
for etud in etuds[:10]:
|
||||
assert etud["etudid"] in lie1 # test de do_evaluation_listeetuds_groups
|
||||
|
||||
for etud in etuds[10:]:
|
||||
assert etud["etudid"] in lie2 # test de do_evaluation_listeetuds_groups
|
||||
|
||||
|
||||
# --- Liste des groupes présents aux évaluation
|
||||
|
||||
lig1 = sco_groups.do_evaluation_listegroupes(e1["evaluation_id"], include_default=False)
|
||||
lig2 = sco_groups.do_evaluation_listegroupes(e2["evaluation_id"], include_default=False)
|
||||
|
||||
|
||||
assert len(lig1) == 2
|
||||
assert len(lig2) == 2
|
||||
assert li_grp1[0] and li_grp1[1] in lig1 # test do_evaluation_listegroupes
|
||||
assert li_grp2[0] and li_grp2[1] in lig2 # test do_evaluation_listegroupes
|
||||
|
||||
|
||||
# --- Changement de groupe d'un élève
|
||||
|
||||
grp1 = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etuds[0]["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
sco_groups.change_etud_group_in_partition(
|
||||
context.Scolarite,
|
||||
etuds[0]["etudid"],
|
||||
li_grp1[1]["group_id"],
|
||||
li1[0],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
grp2 = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etuds[0]["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
assert grp1 != grp2
|
||||
assert grp1[0] == li_grp1[0] # test get_etud_groups
|
||||
assert grp2[0]["group_name"] == "Groupe S1B" # test du changement de groupe
|
||||
|
||||
|
||||
# --- Liste des partitions en format json
|
||||
|
||||
lijson_s1 = sco_groups.formsemestre_partition_list(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_lijson_s1 = json.loads(lijson_s1)
|
||||
|
||||
assert len(load_lijson_s1) == 2 # 2 partition (defaut et eleve 1ere annee)
|
||||
assert load_lijson_s1[0]["formsemestre_id"] == sem1["formsemestre_id"]
|
||||
assert len(load_lijson_s1[0]["group"]) == 2 # 2 groupes S1A et S1B
|
||||
assert load_lijson_s1[0]["group"][0]["group_name"] == "Groupe S1A"
|
||||
assert load_lijson_s1[0]["group"][0]["group_id"] == li_grp1[0]["group_id"]
|
||||
assert (
|
||||
load_lijson_s1[0]["partition_id"]
|
||||
== load_lijson_s1[0]["group"][0]["partition_id"]
|
||||
== li1[0]["partition_id"]
|
||||
)
|
||||
assert load_lijson_s1[0]["partition_name"] == "Eleve 1ere annee"
|
||||
|
||||
|
||||
# --- Vue d'un groupes (liste d'élève en format json)
|
||||
|
||||
vue_g1 = sco_groups_view.groups_view(
|
||||
group_ids=[li_grp1[0]["group_id"]],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_vue_g1 = json.loads(vue_g1)
|
||||
|
||||
assert len(load_vue_g1) == 4
|
||||
assert load_vue_g1[0][li1[0]["partition_id"]] == li_grp1[0]["group_name"]
|
||||
|
||||
vue_sem = sco_groups_view.groups_view(
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_vue_sem = json.loads(vue_sem)
|
||||
|
||||
assert len(load_vue_sem) == 10
|
||||
|
||||
tab = []
|
||||
val = False
|
||||
for etud in etuds[:10]:
|
||||
for i in range(len(load_vue_sem)):
|
||||
if (
|
||||
etud["prenom"] == load_vue_sem[i]["prenom"]
|
||||
and etud["nom_disp"] == load_vue_sem[i]["nom_disp"]
|
||||
):
|
||||
val = True
|
||||
tab.append(val)
|
||||
|
||||
assert not False in tab # tout mes etudiants sont present dans vue_sem.
|
||||
|
||||
# --- Test des fonctions dans sco_groups
|
||||
|
||||
|
||||
assert li_grp1[0] == sco_groups.get_group(
|
||||
context.Scolarite, li_grp1[0]["group_id"]
|
||||
) # test get_group
|
||||
|
||||
assert len(li_grp2) == 3
|
||||
sco_groups.group_delete(context.Scolarite, li_grp2[2])
|
||||
# assert len(li_grp2) == 2 #TEST DE group_delete, aucun changement sur la console mais se supprime sur scodoc web
|
||||
# mais pas dans la console comme pour countAbs()
|
||||
|
||||
assert (
|
||||
sco_groups.get_partition(context.Scolarite, li1[0]["partition_id"]) == li1[0]
|
||||
) # test de get_partition
|
||||
assert (
|
||||
sco_groups.get_partition(context.Scolarite, li2[0]["partition_id"]) == li2[0]
|
||||
) # test de get_partition
|
||||
|
||||
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
||||
# assert p1 in li1 #test de get_partitions_list
|
||||
assert len(li1) == 2 # eleve de 1ere annee + la partition defaut
|
||||
|
||||
li2 = sco_groups.get_partitions_list(context.Scolarite, sem2["formsemestre_id"])
|
||||
# assert p2 in li2 #test de get_partitions_list
|
||||
assert len(li2) == 2 # eleve de 2eme annee + la partition defaut
|
||||
|
||||
|
||||
dp1 = sco_groups.get_default_partition(context.Scolarite, sem1["formsemestre_id"])
|
||||
dp2 = sco_groups.get_default_partition(context.Scolarite, sem2["formsemestre_id"])
|
||||
|
||||
assert (
|
||||
dp1 in li1
|
||||
) # test si dp1 est bien dans li1 et par consequent teste la fonction get_default_partition
|
||||
assert (
|
||||
dp2 in li2
|
||||
) # test si dp2 est bien dans li1 et par consequent teste la fonction get_default_partition
|
||||
|
||||
|
||||
dg1 = sco_groups.get_default_group(sem1["formsemestre_id"])
|
||||
assert li_grp3[0]["group_id"] == dg1 # test de get_default_group
|
||||
|
||||
|
||||
sg = sco_groups.get_sem_groups(context.Scolarite, sem1["formsemestre_id"])
|
||||
assert len(sg) == 3 # test de get_sem_groups
|
||||
assert li_grp1[0] and li_grp1[1] in sg
|
||||
assert li_grp3[0] in sg # test de get_sem_groups
|
||||
|
||||
limembre = sco_groups.get_group_members(context.Scolarite, li_grp1[0]["group_id"])
|
||||
assert (
|
||||
len(limembre) == 4
|
||||
) # car on a changé de groupe un etudiant de ce groupe donc 5-1=4
|
||||
|
||||
"""
|
||||
Commentaire :
|
||||
|
||||
Meme probleme que pour les groupes, lorsque l'on supprime un groupe il est toujours présent dans la liste de groupe
|
||||
mais pas dans scodoc web.
|
||||
|
||||
"""
|
@ -1,168 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
A executer apres s'etre place dans /opt/scodoc/Products/ScoDoc
|
||||
et en lancant l'interpreteur avec /opt/scodoc/bin/zopectl debug
|
||||
|
||||
execfile("test_jurype.py")
|
||||
|
||||
|
||||
@author: barasc
|
||||
Juin 2017
|
||||
"""
|
||||
import pprint
|
||||
|
||||
from debug import *
|
||||
|
||||
import sco_utils
|
||||
import sco_formsemestre
|
||||
import sco_codes_parcours
|
||||
|
||||
import pe_tools
|
||||
|
||||
reload(pe_tools) # inutile sauf en debug interactif
|
||||
import pe_tagtable
|
||||
|
||||
reload(pe_tagtable)
|
||||
import pe_semestretag
|
||||
|
||||
reload(pe_semestretag)
|
||||
import pe_settag
|
||||
|
||||
reload(pe_settag)
|
||||
import pe_jurype
|
||||
|
||||
reload(pe_jurype)
|
||||
import codecs
|
||||
import pe_avislatex
|
||||
|
||||
reload(pe_avislatex)
|
||||
|
||||
# ****************************************************************************
|
||||
# Initialisations generales
|
||||
# ****************************************************************************
|
||||
context = go_dept(app, "RT") # se place dans le departement RT
|
||||
authuser = app.acl_users.getUserById("admin")
|
||||
sems = (
|
||||
context.Notes.formsemestre_list()
|
||||
) # Renvoie la liste de tous les semestres de la BDD
|
||||
|
||||
qui = "emmanuel"
|
||||
if qui == "cleo":
|
||||
fid = "SEM9045" # Choix du semestre sur lequel sera fait le calcul du jury (ici promo 2016 avec tous les résultats)
|
||||
# fid = 'SEM14440' # Cas d'une promo dans laquelle manque au moins le S4
|
||||
else:
|
||||
fid = "SEM27456" # RT S3 jan 2016
|
||||
|
||||
print("Semestre=", fid)
|
||||
|
||||
if qui == "cleo":
|
||||
nom = "BRUN" # Choix du nom de l'étudiant dont les résultats seront affichés sur la console
|
||||
else:
|
||||
nom = "ROSSE"
|
||||
|
||||
# paramètres des avis Latex
|
||||
REPERTOIRE_MODELES = "tmp/avis/modeles/"
|
||||
REPERTOIRE_ECRITURE_AVIS = "tmp/avis/"
|
||||
|
||||
# class = "avisPE.cls"
|
||||
# main = "avis.tex" # Fichier principal de compilation
|
||||
modele = "un_avis.tex" # Modele à actualiser au regard des résultats de l'étudiant
|
||||
|
||||
# *****************************************************************************
|
||||
# Calcul du Jury PE
|
||||
# *****************************************************************************
|
||||
# semsDUT = [sem for sem in sems if 1 <= sem['semestre_id'] <= 4 ]
|
||||
semBase = sco_formsemestre.get_formsemestre(fid)
|
||||
jury = pe_jurype.JuryPE(context, semBase)
|
||||
|
||||
|
||||
# *****************************************************************************
|
||||
# Affichage des résultats (texte)
|
||||
# *****************************************************************************
|
||||
etudid = [
|
||||
etudid for etudid in jury.syntheseJury if jury.syntheseJury[etudid]["nom"] == nom
|
||||
][0]
|
||||
resEtudiant = jury.syntheseJury[etudid] # Résultat de l'étudiant au jury PE
|
||||
|
||||
# Parcours
|
||||
parcours = resEtudiant["parcours"][::-1]
|
||||
print("Parcours de %s %s" % (resEtudiant["prenom"], resEtudiant["nom"]))
|
||||
for (no, sem) in enumerate(parcours):
|
||||
print(" %d) %s" % (no + 1, sem))
|
||||
|
||||
# Bilan synthétique par semestre et par tag
|
||||
for sem in ["S1", "S2", "S3", "S4", "1A", "2A", "3S", "4S"]:
|
||||
if sem in ["S1", "S2", "S3", "S4"]:
|
||||
print("Semestre %s" % (sem))
|
||||
elif sem in ["1A", "2A"]:
|
||||
print("Annee %s" % (sem))
|
||||
elif sem == "3S":
|
||||
print("Fusion S1/S2/S3")
|
||||
else:
|
||||
print("Fusion S1/S2/S3/S4")
|
||||
|
||||
allTags = resEtudiant[sem]["groupe"].keys()
|
||||
allTags.extend(resEtudiant[sem]["promo"].keys())
|
||||
allTags = sorted(list(set(allTags))) # tous les tags du groupe et de la promo
|
||||
|
||||
restxt = ""
|
||||
for tag in allTags:
|
||||
chaine = " * %20s\t" % (tag)
|
||||
|
||||
for ensembleRes in [resEtudiant[sem]["groupe"], resEtudiant[sem]["promo"]]:
|
||||
if tag in ensembleRes:
|
||||
(note, coeff, classement, nb_inscrits, vmoy, vmax, vmin) = ensembleRes[
|
||||
tag
|
||||
]
|
||||
note = "%2.2f" % note if isinstance(note, float) else str(note)
|
||||
classement = "None" if classement == None else classement
|
||||
nb_inscrits = (
|
||||
("%d" % nb_inscrits)
|
||||
if isinstance(nb_inscrits, int)
|
||||
else str(nb_inscrits)
|
||||
)
|
||||
vmin = "%2.2f" % vmin if isinstance(vmin, float) else str(vmin)
|
||||
vmoy = "%2.2f" % vmoy if isinstance(vmoy, float) else str(vmoy)
|
||||
vmax = "%2.2f" % vmax if isinstance(vmax, float) else str(vmax)
|
||||
|
||||
chaine += "%5s\t%5s/%2s\t%5s/%5s/%5s\t" % (
|
||||
note,
|
||||
classement,
|
||||
nb_inscrits,
|
||||
vmin,
|
||||
vmoy,
|
||||
vmax,
|
||||
)
|
||||
else:
|
||||
chaine += "miss.\t" * 3
|
||||
|
||||
restxt += chaine + "\n"
|
||||
print(restxt)
|
||||
|
||||
# Sauvegarde du zip contenant les CSV:
|
||||
filename = "/tmp/test_pe.zip"
|
||||
print("Enregistrement du ZIP: ", filename)
|
||||
f = open(filename, "w")
|
||||
f.write(jury.get_zipped_data())
|
||||
f.close()
|
||||
|
||||
# *****************************************************************************
|
||||
# Genere l'avis latex
|
||||
# *****************************************************************************
|
||||
# Choix d'un modele d'avis PE
|
||||
|
||||
|
||||
# Genere l'avis PE
|
||||
print("Avis PE de %s (%s)" % (jury.syntheseJury[etudid]["nom"], etudid))
|
||||
un_avis_latex = pe_avislatex.get_code_latex_from_modele(
|
||||
REPERTOIRE_MODELES + "un_avis.tex"
|
||||
)
|
||||
code_latex = pe_avislatex.get_code_latex_avis_etudiant(
|
||||
jury.syntheseJury[etudid], un_avis_latex
|
||||
)
|
||||
|
||||
# Sauvegarde l'avis
|
||||
fid = codecs.open(REPERTOIRE_ECRITURE_AVIS + modele, "w", encoding="utf-8")
|
||||
fid.write(code_latex)
|
||||
fid.close()
|
@ -1,131 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# XXX A REVOIR POUR SCODOC8
|
||||
|
||||
import random
|
||||
from app import db
|
||||
from app.auth.models import User
|
||||
from app.auth.models import Role
|
||||
|
||||
DEPT = "TEST"
|
||||
|
||||
import scotests.sco_fake_gen as sco_fake_gen # pylint: disable=import-error
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
# --- Création d'étudiants
|
||||
etuds = [G.create_etud(code_nip=None) for _ in range(10)]
|
||||
|
||||
# --- Création de l'utilisateur responsable du semestre, des modules etc....
|
||||
user = User(user_name="unutil")
|
||||
user.set_password("scodocpass")
|
||||
user.add_role(Role.get_named_role("Ens"), DEPT)
|
||||
db.session.add(u)
|
||||
db.session.commit()
|
||||
print(user)
|
||||
|
||||
# --- Création formation et de deux UE
|
||||
f = G.create_formation(acronyme="")
|
||||
ue = G.create_ue(formation_id=f["formation_id"], acronyme="TST1", titre="ue test")
|
||||
mat11 = G.create_matiere(ue_id=ue["ue_id"], titre="matière test")
|
||||
mod11 = G.create_module(
|
||||
matiere_id=mat11["matiere_id"],
|
||||
code="TSM11",
|
||||
coefficient=1.0,
|
||||
titre="module test11",
|
||||
ue_id=ue["ue_id"], # faiblesse de l'API
|
||||
formation_id=f["formation_id"], # faiblesse de l'API
|
||||
)
|
||||
|
||||
mat12 = G.create_matiere(ue_id=ue["ue_id"], titre="matière test12")
|
||||
mod12 = G.create_module(
|
||||
matiere_id=mat12["matiere_id"],
|
||||
code="TSM12",
|
||||
coefficient=1.0,
|
||||
titre="module test12",
|
||||
ue_id=ue["ue_id"], # faiblesse de l'API
|
||||
formation_id=f["formation_id"], # faiblesse de l'API
|
||||
)
|
||||
|
||||
|
||||
ue2 = G.create_ue(formation_id=f["formation_id"], acronyme="TST2", titre="ue test2")
|
||||
mat21 = G.create_matiere(ue_id=ue2["ue_id"], titre="matière test21")
|
||||
mod21 = G.create_module(
|
||||
matiere_id=mat21["matiere_id"],
|
||||
code="TSM21",
|
||||
coefficient=1.0,
|
||||
titre="module test21",
|
||||
ue_id=ue2["ue_id"], # faiblesse de l'API
|
||||
formation_id=f["formation_id"], # faiblesse de l'API
|
||||
)
|
||||
|
||||
mat22 = G.create_matiere(ue_id=ue2["ue_id"], titre="matière test22")
|
||||
mod22 = G.create_module(
|
||||
matiere_id=mat22["matiere_id"],
|
||||
code="TSM22",
|
||||
coefficient=1.0,
|
||||
titre="module test22",
|
||||
ue_id=ue2["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",
|
||||
)
|
||||
|
||||
mods = []
|
||||
for module_id, formsemestre_id, responsable_id in [
|
||||
(mod11["module_id"], sem["formsemestre_id"], "bach"),
|
||||
(mod12["module_id"], sem["formsemestre_id"], "bach"),
|
||||
(mod21["module_id"], sem["formsemestre_id"], "bach"),
|
||||
(mod22["module_id"], sem["formsemestre_id"], "bach"),
|
||||
]:
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=module_id,
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id=responsable_id,
|
||||
)
|
||||
mods.append(mi)
|
||||
|
||||
|
||||
# --- Inscription des étudiants
|
||||
for etud in etuds:
|
||||
G.inscrit_etudiant(sem, etud)
|
||||
|
||||
|
||||
# --- Création d'évaluations (2 par modules)
|
||||
|
||||
evals = []
|
||||
|
||||
for moduleimpl_id, jour, description, coefficient in [
|
||||
(mods[0]["moduleimpl_id"], "01/02/2021", "e1", 1.0),
|
||||
(mods[0]["moduleimpl_id"], "02/02/2021", "e2", 1.0),
|
||||
(mods[1]["moduleimpl_id"], "03/02/2021", "e3", 1.0),
|
||||
(mods[1]["moduleimpl_id"], "04/02/2021", "e4", 1.0),
|
||||
(mods[2]["moduleimpl_id"], "05/02/2021", "e5", 1.0),
|
||||
(mods[2]["moduleimpl_id"], "06/02/2021", "e6", 1.0),
|
||||
(mods[3]["moduleimpl_id"], "07/02/2021", "e7", 1.0),
|
||||
(mods[3]["moduleimpl_id"], "08/02/2021", "e8", 1.0),
|
||||
]:
|
||||
e = G.create_evaluation(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
jour=jour,
|
||||
description=description,
|
||||
coefficient=coefficient,
|
||||
)
|
||||
evals.append(e)
|
||||
|
||||
|
||||
# --- Saisie des notes aléatoires
|
||||
|
||||
for eval in evals:
|
||||
for etud in etuds:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=float(random.randint(0, 20))
|
||||
)
|
@ -1,106 +0,0 @@
|
||||
import sco_formations
|
||||
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_moduleimpl
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
file = open("scotests/export_formation1.xml")
|
||||
doc = file.read()
|
||||
file.close()
|
||||
|
||||
|
||||
# --- Création de la formation
|
||||
|
||||
f = sco_formations.formation_import_xml(doc=doc)
|
||||
|
||||
# --- Création des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem3 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=3,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=2,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
sem4 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=4,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
|
||||
# --- Implémentation des modules
|
||||
|
||||
li_module = context.Notes.do_module_list()
|
||||
mods_imp = []
|
||||
for mod in li_module:
|
||||
if mod["semestre_id"] == 1:
|
||||
formsemestre_id = sem1["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 2:
|
||||
formsemestre_id = sem2["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 3:
|
||||
formsemestre_id = sem3["formsemestre_id"]
|
||||
else:
|
||||
formsemestre_id = sem4["formsemestre_id"]
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
)
|
||||
mods_imp.append(mi)
|
||||
|
||||
# --- Création des étudiants
|
||||
|
||||
etuds = []
|
||||
for nom, prenom in [
|
||||
("Semestre11", "EtudiantNumero1"),
|
||||
("Semestre12", "EtudiantNumero2"),
|
||||
("Semestre23", "EtudiantNumero3"),
|
||||
("Semestre24", "EtudiantNumero4"),
|
||||
("Semestre35", "EtudiantNumero5"),
|
||||
("Semestre36", "EtudiantNumero6"),
|
||||
("Semestre47", "EtudiantNumero7"),
|
||||
("Semestre48", "EtudiantNumero8"),
|
||||
]:
|
||||
etud = G.create_etud(
|
||||
nom=nom,
|
||||
prenom=prenom,
|
||||
)
|
||||
etuds.append(etud)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
for etud in etuds[0:2]:
|
||||
G.inscrit_etudiant(sem1, etud)
|
||||
|
||||
for etud in etuds[2:4]:
|
||||
G.inscrit_etudiant(sem2, etud)
|
||||
|
||||
for etud in etuds[4:6]:
|
||||
G.inscrit_etudiant(sem3, etud)
|
||||
|
||||
for etud in etuds[6:]:
|
||||
G.inscrit_etudiant(sem4, etud)
|
@ -1,149 +0,0 @@
|
||||
import sco_formations
|
||||
import json
|
||||
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_moduleimpl
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
file = open("scotests/export_formation1.xml")
|
||||
doc = file.read()
|
||||
file.close()
|
||||
|
||||
|
||||
# --- Création de la formation
|
||||
|
||||
f = sco_formations.formation_import_xml(doc=doc)
|
||||
|
||||
# --- Création des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem3 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=3,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=2,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
sem4 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=4,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
|
||||
# --- Implémentation des modules
|
||||
|
||||
li_module = context.Notes.do_module_list()
|
||||
mods_imp = []
|
||||
for mod in li_module:
|
||||
if mod["semestre_id"] == 1:
|
||||
formsemestre_id = sem1["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 2:
|
||||
formsemestre_id = sem2["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 3:
|
||||
formsemestre_id = sem3["formsemestre_id"]
|
||||
else:
|
||||
formsemestre_id = sem4["formsemestre_id"]
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
)
|
||||
mods_imp.append(mi)
|
||||
|
||||
# --- Création des étudiants
|
||||
|
||||
etuds = []
|
||||
for nom, prenom in [
|
||||
("Semestre11", "EtudiantNumero1"),
|
||||
("Semestre12", "EtudiantNumero2"),
|
||||
("Semestre23", "EtudiantNumero3"),
|
||||
("Semestre24", "EtudiantNumero4"),
|
||||
("Semestre35", "EtudiantNumero5"),
|
||||
("Semestre36", "EtudiantNumero6"),
|
||||
("Semestre47", "EtudiantNumero7"),
|
||||
("Semestre48", "EtudiantNumero8"),
|
||||
]:
|
||||
etud = G.create_etud(
|
||||
nom=nom,
|
||||
prenom=prenom,
|
||||
)
|
||||
etuds.append(etud)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
for etud in etuds[0:2]:
|
||||
G.inscrit_etudiant(sem1, etud)
|
||||
|
||||
for etud in etuds[2:4]:
|
||||
G.inscrit_etudiant(sem2, etud)
|
||||
|
||||
for etud in etuds[4:6]:
|
||||
G.inscrit_etudiant(sem3, etud)
|
||||
|
||||
for etud in etuds[6:]:
|
||||
G.inscrit_etudiant(sem4, etud)
|
||||
|
||||
# --- Création d'une évaluation pour chaque UE
|
||||
|
||||
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem1 = json.loads(lim_sem1)
|
||||
|
||||
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem2 = json.loads(lim_sem2)
|
||||
|
||||
lim_sem3 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem3["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem3 = json.loads(lim_sem3)
|
||||
|
||||
lim_sem4 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem4["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem4 = json.loads(lim_sem4)
|
||||
|
||||
|
||||
for moduleimpl_id, jour, description, coefficient in [
|
||||
(load_lim_sem1[1]["moduleimpl_id"], "02/09/2020", "InterroTestSemestre1", 1.0),
|
||||
(load_lim_sem1[2]["moduleimpl_id"], "03/09/2020", "InterroTestSemestre1", 1.0),
|
||||
(load_lim_sem2[1]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre2", 1.0),
|
||||
(load_lim_sem2[8]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre2", 1.0),
|
||||
(load_lim_sem3[3]["moduleimpl_id"], "02/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem3[9]["moduleimpl_id"], "03/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem3[15]["moduleimpl_id"], "04/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem4[3]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[9]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[13]["moduleimpl_id"], "05/02/2021", "InterroTestSemestre4", 1.0),
|
||||
]:
|
||||
e = G.create_evaluation(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
jour=jour,
|
||||
description=description,
|
||||
coefficient=coefficient,
|
||||
)
|
@ -1,210 +0,0 @@
|
||||
import sco_formations
|
||||
import json
|
||||
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_moduleimpl
|
||||
|
||||
G = sco_fake_gen.ScoFake(context.Notes)
|
||||
G.verbose = False
|
||||
|
||||
file = open("scotests/export_formation1.xml")
|
||||
doc = file.read()
|
||||
file.close()
|
||||
|
||||
|
||||
# --- Création de la formation
|
||||
|
||||
f = sco_formations.formation_import_xml(doc=doc)
|
||||
|
||||
# --- Création des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=1,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem3 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=3,
|
||||
date_debut="01/09/2020",
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=2,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
sem4 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
semestre_id=4,
|
||||
date_debut="02/02/2021",
|
||||
date_fin="01/06/2021",
|
||||
)
|
||||
|
||||
|
||||
# --- Implémentation des modules
|
||||
|
||||
li_module = context.Notes.do_module_list()
|
||||
mods_imp = []
|
||||
for mod in li_module:
|
||||
if mod["semestre_id"] == 1:
|
||||
formsemestre_id = sem1["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 2:
|
||||
formsemestre_id = sem2["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 3:
|
||||
formsemestre_id = sem3["formsemestre_id"]
|
||||
else:
|
||||
formsemestre_id = sem4["formsemestre_id"]
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
)
|
||||
mods_imp.append(mi)
|
||||
|
||||
# --- Création des étudiants
|
||||
|
||||
etuds = []
|
||||
for nom, prenom in [
|
||||
("Semestre11", "EtudiantNumero1"),
|
||||
("Semestre12", "EtudiantNumero2"),
|
||||
("Semestre23", "EtudiantNumero3"),
|
||||
("Semestre24", "EtudiantNumero4"),
|
||||
("Semestre35", "EtudiantNumero5"),
|
||||
("Semestre36", "EtudiantNumero6"),
|
||||
("Semestre47", "EtudiantNumero7"),
|
||||
("Semestre48", "EtudiantNumero8"),
|
||||
]:
|
||||
etud = G.create_etud(
|
||||
nom=nom,
|
||||
prenom=prenom,
|
||||
)
|
||||
etuds.append(etud)
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
for etud in etuds[0:2]:
|
||||
G.inscrit_etudiant(sem1, etud)
|
||||
|
||||
for etud in etuds[2:4]:
|
||||
G.inscrit_etudiant(sem2, etud)
|
||||
|
||||
for etud in etuds[4:6]:
|
||||
G.inscrit_etudiant(sem3, etud)
|
||||
|
||||
for etud in etuds[6:]:
|
||||
G.inscrit_etudiant(sem4, etud)
|
||||
|
||||
# --- Création d'une évaluation pour chaque UE
|
||||
|
||||
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem1 = json.loads(lim_sem1)
|
||||
|
||||
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem2 = json.loads(lim_sem2)
|
||||
|
||||
lim_sem3 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem3["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem3 = json.loads(lim_sem3)
|
||||
|
||||
lim_sem4 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem4["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem4 = json.loads(lim_sem4)
|
||||
|
||||
|
||||
for moduleimpl_id, jour, description, coefficient in [
|
||||
(load_lim_sem1[1]["moduleimpl_id"], "02/09/2020", "InterroTestSemestre1", 1.0),
|
||||
(load_lim_sem1[2]["moduleimpl_id"], "03/09/2020", "InterroTestSemestre1", 1.0),
|
||||
(load_lim_sem2[1]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre2", 1.0),
|
||||
(load_lim_sem2[8]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre2", 1.0),
|
||||
(load_lim_sem3[3]["moduleimpl_id"], "02/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem3[9]["moduleimpl_id"], "03/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem3[15]["moduleimpl_id"], "04/09/2020", "InterroTestSemestre3", 1.0),
|
||||
(load_lim_sem4[3]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[9]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[13]["moduleimpl_id"], "05/02/2021", "InterroTestSemestre4", 1.0),
|
||||
]:
|
||||
e = G.create_evaluation(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
jour=jour,
|
||||
description=description,
|
||||
coefficient=coefficient,
|
||||
)
|
||||
|
||||
|
||||
# --- Saisie des notes des étudiants (un élève a 12, un autre a 7 pour chaque semestre)
|
||||
|
||||
lie1 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem1["formsemestre_id"]
|
||||
)
|
||||
lie2 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem2["formsemestre_id"]
|
||||
)
|
||||
lie3 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem3["formsemestre_id"]
|
||||
)
|
||||
lie4 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem4["formsemestre_id"]
|
||||
)
|
||||
|
||||
for eval in lie1:
|
||||
for etud in etuds[:2]:
|
||||
if etud == etuds[0]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
for eval in lie2:
|
||||
for etud in etuds[2:4]:
|
||||
if etud == etuds[2]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
|
||||
for eval in lie3:
|
||||
for etud in etuds[4:6]:
|
||||
if etud == etuds[4]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
for eval in lie4:
|
||||
for etud in etuds[6:]:
|
||||
if etud == etuds[6]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
@ -40,7 +40,7 @@ from app.scodoc.sco_exceptions import ScoValueError
|
||||
random.seed(12345) # tests reproductibles
|
||||
|
||||
|
||||
DEMO_DIR = Config.SCODOC_DIR + "/scotests/demo/"
|
||||
DEMO_DIR = Config.SCODOC_DIR + "/tools/demo/"
|
||||
NOMS = [x.strip() for x in open(DEMO_DIR + "/noms.txt").readlines()]
|
||||
PRENOMS_H = [x.strip() for x in open(DEMO_DIR + "/prenoms-h.txt").readlines()]
|
||||
PRENOMS_F = [x.strip() for x in open(DEMO_DIR + "/prenoms-f.txt").readlines()]
|
||||
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |