forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "6aba3a3ccdd6fc959ff28863210608b8fcdef8fc" and "92e9f4bc5f59268421855026ff7ac4100f2f74ca" have entirely different histories.
6aba3a3ccd
...
92e9f4bc5f
@ -123,32 +123,19 @@ def etudiant(etudid: int = None, nip: int = None, ine: int = None):
|
||||
"prenom": "JACQUES"
|
||||
}
|
||||
"""
|
||||
# etu = []
|
||||
etu = []
|
||||
|
||||
if etudid is None:
|
||||
if nip is None: # si ine
|
||||
etu = models.Identite.query.filter_by(code_ine=str(ine)).first()
|
||||
else: # si nip
|
||||
etu = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
||||
|
||||
else: # si etudid
|
||||
if etudid is not None: # Si route etudid
|
||||
# Récupération de l'étudiant
|
||||
etu = models.Identite.query.filter_by(id=etudid).first()
|
||||
|
||||
if nip is not None: # Si route nip
|
||||
# Récupération de l'étudiant
|
||||
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
||||
|
||||
|
||||
# if etudid is not None: # Si route etudid
|
||||
# # Récupération de l'étudiant
|
||||
# etu = models.Identite.query.filter_by(id=etudid).first()
|
||||
#
|
||||
# if nip is not None: # Si route nip
|
||||
# # Récupération de l'étudiant
|
||||
# etu = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
||||
#
|
||||
# breakpoint()
|
||||
#
|
||||
# if ine is not None: # Si route ine
|
||||
# # Récupération de l'étudiant
|
||||
# etu = models.Identite.query.filter_by(code_ine=str(ine)).first()
|
||||
if ine is not None: # Si route ine
|
||||
# Récupération de l'étudiant
|
||||
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
||||
|
||||
# Mise en forme des données
|
||||
data = etu.to_dict_bul(include_urls=False)
|
||||
@ -334,10 +321,9 @@ def etudiant_groups(formsemestre_id: int, etudid: int = None, nip: int = None, i
|
||||
|
||||
# Récupération du formsemestre
|
||||
sem = models.FormSemestre.query.filter_by(id=formsemestre_id).first()
|
||||
#breakpoint()
|
||||
try:
|
||||
# Utilisation de la fonction get_etud_groups
|
||||
data = get_etud_groups(etudid, sem.id)
|
||||
data = get_etud_groups(etudid, sem.to_dict())
|
||||
except ValueError:
|
||||
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||
|
||||
|
@ -4,6 +4,7 @@ from flask import jsonify
|
||||
from app import models
|
||||
from app.api import bp
|
||||
from app.api.errors import error_response
|
||||
from app.decorators import permission_required
|
||||
from app.api.auth import token_auth, token_permission_required
|
||||
from app.scodoc.sco_bulletins import formsemestre_bulletinetud_dict
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
|
@ -102,15 +102,9 @@ class ScolarNews(db.Model):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def last_news(cls, n=1, dept_id=None, filter_dept=True) -> list:
|
||||
def last_news(cls, n=1) -> list:
|
||||
"The most recent n news. Returns list of ScolarNews instances."
|
||||
query = cls.query
|
||||
if filter_dept:
|
||||
if dept_id is None:
|
||||
dept_id = g.scodoc_dept_id
|
||||
query = query.filter_by(dept_id=dept_id)
|
||||
|
||||
return query.order_by(cls.date.desc()).limit(n).all()
|
||||
return cls.query.order_by(cls.date.desc()).limit(n).all()
|
||||
|
||||
@classmethod
|
||||
def add(cls, typ, obj=None, text="", url=None, max_frequency=0):
|
||||
|
@ -222,7 +222,7 @@ def do_ue_delete(ue_id, delete_validations=False, force=False):
|
||||
ScolarNews.add(
|
||||
typ=ScolarNews.NEWS_FORM,
|
||||
obj=ue.formation_id,
|
||||
text=f"Modification de la formation {F['acronyme']}",
|
||||
text="Modification de la formation %(acronyme)s" % F,
|
||||
max_frequency=10 * 60,
|
||||
)
|
||||
#
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.2.2"
|
||||
SCOVERSION = "9.2.1"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
@ -75,9 +75,9 @@ def test_referenciel_competences():
|
||||
|
||||
|
||||
# # semestre_index
|
||||
# def test_semestre_index(): #XXX TODO pour Seb
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/departements/TAPI/formsemestre/1/programme",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
def test_semestre_index(): #XXX TODO pour Seb
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/formsemestre/1/programme",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
@ -22,7 +22,6 @@ import requests
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
|
||||
# etudiants
|
||||
def test_etudiants():
|
||||
r = requests.get(
|
||||
@ -47,20 +46,6 @@ def test_etudiants():
|
||||
"nom",
|
||||
"prenom",
|
||||
"nomprenom",
|
||||
"lieu_naissance",
|
||||
"dept_naissance",
|
||||
"nationalite",
|
||||
"boursier",
|
||||
"id",
|
||||
"domicile",
|
||||
"villedomicile",
|
||||
"telephone",
|
||||
"fax",
|
||||
"description",
|
||||
"codepostaldomicile",
|
||||
"paysdomicile",
|
||||
"telephonemobile",
|
||||
"typeadresse",
|
||||
]
|
||||
|
||||
fields_OK = True
|
||||
@ -74,43 +59,40 @@ def test_etudiants():
|
||||
|
||||
|
||||
# etudiants_courant
|
||||
def test_etudiants_courant(): # XXX TODO pour Seb
|
||||
def test_etudiants_courant(): #XXX TODO pour Seb
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 16
|
||||
assert len(r.json()) == 0
|
||||
|
||||
|
||||
# etudiant
|
||||
def test_etudiant(): # XXX TODO pour Seb
|
||||
def test_etudiant(): #XXX TODO pour Seb
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 24
|
||||
assert len(r.json()) == 10
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 24
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 24
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
|
||||
|
||||
# etudiant_formsemestres
|
||||
def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
||||
def test_etudiant_formsemestres(): #XXX TODO pour Seb
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
|
||||
headers=HEADERS,
|
||||
|
@ -24,7 +24,7 @@ from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
# formsemestre
|
||||
def test_formsemestre():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/formsemestre/1",
|
||||
SCODOC_URL + "/ScoDoc/api/formations/formsemestre/<int:formsemestre_id>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
@ -35,7 +35,7 @@ def test_formsemestre():
|
||||
def test_etudiant_bulletin(): #XXX TODO pour Seb
|
||||
r = requests.get(
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formsemestre/1/departements/TAPI/etudiant/etudid/1/bulletin",
|
||||
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
@ -43,7 +43,7 @@ def test_etudiant_bulletin(): #XXX TODO pour Seb
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formsemestre/1/departements/TAPI/etudiant/nip/1/bulletin",
|
||||
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
@ -51,7 +51,7 @@ def test_etudiant_bulletin(): #XXX TODO pour Seb
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formsemestre/1/departements/TAPI/etudiant/ine/1/bulletin",
|
||||
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
@ -61,7 +61,7 @@ def test_etudiant_bulletin(): #XXX TODO pour Seb
|
||||
# bulletins
|
||||
def test_bulletins():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1/bulletins",
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/bulletins",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
@ -71,7 +71,7 @@ def test_bulletins():
|
||||
# jury
|
||||
def test_jury():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1/jury",
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/jury",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
@ -86,10 +86,6 @@ def create_fake_etud(dept):
|
||||
etud = models.Identite(civilite=civilite, nom=nom, prenom=prenom, dept_id=dept.id)
|
||||
db.session.add(etud)
|
||||
db.session.commit()
|
||||
etud.code_nip = etud.id
|
||||
etud.code_ine = etud.id
|
||||
db.session.add(etud)
|
||||
db.session.commit()
|
||||
adresse = models.Adresse(
|
||||
etudid=etud.id, email=f"{etud.prenom}.{etud.nom}@example.com"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user