forked from ScoDoc/ScoDoc
refactoring and tests
This commit is contained in:
parent
c153c11606
commit
540623d3b9
3
README.md
Executable file → Normal file
3
README.md
Executable file → Normal file
@ -240,6 +240,9 @@ Puis dérouler les tests unitaires:
|
|||||||
|
|
||||||
pytest tests/unit
|
pytest tests/unit
|
||||||
|
|
||||||
|
Ou avec couverture (`pip install pytest-cov`)
|
||||||
|
|
||||||
|
pytest --cov=app --cov-report=term-missing --cov-branch tests/unit/*
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
@ -164,8 +164,7 @@ def scodoc7func(context):
|
|||||||
req_args = REQUEST.form # args from query string (get) or form (post)
|
req_args = REQUEST.form # args from query string (get) or form (post)
|
||||||
# --- Add positional arguments
|
# --- Add positional arguments
|
||||||
pos_arg_values = []
|
pos_arg_values = []
|
||||||
# PY3 à remplacer par inspect.getfullargspec en py3: TODO
|
argspec = inspect.getfullargspec(func)
|
||||||
argspec = inspect.getargspec(func)
|
|
||||||
# current_app.logger.info("argspec=%s" % str(argspec))
|
# current_app.logger.info("argspec=%s" % str(argspec))
|
||||||
nb_default_args = len(argspec.defaults) if argspec.defaults else 0
|
nb_default_args = len(argspec.defaults) if argspec.defaults else 0
|
||||||
if nb_default_args:
|
if nb_default_args:
|
||||||
|
@ -2,14 +2,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import inspect
|
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
from flask import current_app
|
|
||||||
|
from flask import g, current_app
|
||||||
|
|
||||||
"""Simple & stupid file logguer, used only to debug
|
"""Simple & stupid file logguer, used only to debug
|
||||||
(logging to SQL is done in scolog)
|
(logging to SQL is done in scolog)
|
||||||
@ -18,7 +17,7 @@ from flask import current_app
|
|||||||
LOG_FILENAME = "notes.log" # empty to disable logging
|
LOG_FILENAME = "notes.log" # empty to disable logging
|
||||||
DEFAULT_LOG_DIR = "/tmp" # clients should call set_log_directory to change this
|
DEFAULT_LOG_DIR = "/tmp" # clients should call set_log_directory to change this
|
||||||
|
|
||||||
ALARM_DESTINATION = "emmanuel.viennet@univ-paris13.fr" # XXX a mettre en preference
|
ALARM_DESTINATION = "emmanuel.viennet@gmail.com" # XXX a mettre en preference
|
||||||
|
|
||||||
|
|
||||||
class _logguer(object):
|
class _logguer(object):
|
||||||
@ -46,7 +45,11 @@ class _logguer(object):
|
|||||||
if not self.file:
|
if not self.file:
|
||||||
self._open()
|
self._open()
|
||||||
if self.file:
|
if self.file:
|
||||||
dept = retreive_dept()
|
try:
|
||||||
|
dept = getattr(g, "scodoc_dept", "")
|
||||||
|
except RuntimeError:
|
||||||
|
# Flask Working outside of application context.
|
||||||
|
dept = ""
|
||||||
if dept:
|
if dept:
|
||||||
dept = " (%s)" % dept
|
dept = " (%s)" % dept
|
||||||
msg = dept + " " + msg
|
msg = dept + " " + msg
|
||||||
@ -60,42 +63,6 @@ class _logguer(object):
|
|||||||
log = _logguer()
|
log = _logguer()
|
||||||
|
|
||||||
|
|
||||||
def retreive_request(skip=0):
|
|
||||||
"""Try to retreive a REQUEST variable in caller stack.
|
|
||||||
This is a hack, used only in log functions.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def search(frame):
|
|
||||||
if "REQUEST" in frame.f_locals:
|
|
||||||
return frame.f_locals["REQUEST"]
|
|
||||||
if frame.f_back:
|
|
||||||
return search(frame.f_back)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
frame = inspect.currentframe()
|
|
||||||
if frame: # not supported by all pythons
|
|
||||||
startframe = frame
|
|
||||||
while skip and startframe.f_back:
|
|
||||||
startframe = startframe.f_back
|
|
||||||
return search(startframe)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def retreive_dept():
|
|
||||||
"""Try to retreive departement (from REQUEST URL)"""
|
|
||||||
REQUEST = retreive_request()
|
|
||||||
if not REQUEST:
|
|
||||||
return ""
|
|
||||||
try:
|
|
||||||
url = REQUEST.URL
|
|
||||||
m = re.match(r"^.*ScoDoc/(\w+).*$", url)
|
|
||||||
return m.group(1)
|
|
||||||
except:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
# Alarms by email:
|
# Alarms by email:
|
||||||
def sendAlarm(context, subj, txt):
|
def sendAlarm(context, subj, txt):
|
||||||
from . import sco_utils
|
from . import sco_utils
|
||||||
|
@ -617,7 +617,6 @@ def add_absence(
|
|||||||
vars(),
|
vars(),
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
"AddAbsence",
|
"AddAbsence",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -642,7 +641,6 @@ def add_justif(context, etudid, jour, matin, REQUEST, description=None):
|
|||||||
vars(),
|
vars(),
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
"AddJustif",
|
"AddJustif",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -679,7 +677,6 @@ def annule_absence(context, etudid, jour, matin, moduleimpl_id=None, REQUEST=Non
|
|||||||
req += " and moduleimpl_id=%(moduleimpl_id)s"
|
req += " and moduleimpl_id=%(moduleimpl_id)s"
|
||||||
cursor.execute(req, vars())
|
cursor.execute(req, vars())
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
"AnnuleAbsence",
|
"AnnuleAbsence",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -704,7 +701,6 @@ def annule_justif(context, etudid, jour, matin, REQUEST=None):
|
|||||||
vars(),
|
vars(),
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
"AnnuleJustif",
|
"AnnuleJustif",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
|
@ -652,7 +652,6 @@ def AnnuleAbsencesDatesNoJust(context, etudid, dates, moduleimpl_id=None, REQUES
|
|||||||
else:
|
else:
|
||||||
date1 = None
|
date1 = None
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
"AnnuleAbsencesDatesNoJust",
|
"AnnuleAbsencesDatesNoJust",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
|
@ -488,7 +488,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
|
|||||||
msg = "Nouvelle%20archive%20créée"
|
msg = "Nouvelle%20archive%20créée"
|
||||||
|
|
||||||
# submitted or cancelled:
|
# submitted or cancelled:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_list_archives?formsemestre_id=%s&head_message=%s"
|
"formsemestre_list_archives?formsemestre_id=%s&head_message=%s"
|
||||||
% (formsemestre_id, msg)
|
% (formsemestre_id, msg)
|
||||||
)
|
)
|
||||||
@ -566,12 +566,10 @@ def formsemestre_delete_archive(
|
|||||||
|
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression de l'archive du %s ?</h2>
|
"""<h2>Confirmer la suppression de l'archive du %s ?</h2>
|
||||||
<p>La suppression sera définitive.</p>"""
|
<p>La suppression sera définitive.</p>"""
|
||||||
% PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y %H:%M"),
|
% PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y %H:%M"),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=dest_url,
|
cancel_url=dest_url,
|
||||||
parameters={
|
parameters={
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre_id,
|
||||||
@ -580,4 +578,4 @@ def formsemestre_delete_archive(
|
|||||||
)
|
)
|
||||||
|
|
||||||
PVArchive.delete_archive(archive_id)
|
PVArchive.delete_archive(archive_id)
|
||||||
return REQUEST.RESPONSE.redirect(dest_url + "&head_message=Archive%20supprimée")
|
return flask.redirect(dest_url + "&head_message=Archive%20supprimée")
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
Il s'agit de fichiers quelconques, généralement utilisés pour conserver
|
Il s'agit de fichiers quelconques, généralement utilisés pour conserver
|
||||||
les dossiers d'admission et autres pièces utiles.
|
les dossiers d'admission et autres pièces utiles.
|
||||||
"""
|
"""
|
||||||
|
import flask
|
||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -164,7 +165,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -174,7 +175,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
|
|||||||
_store_etud_file_to_new_archive(
|
_store_etud_file_to_new_archive(
|
||||||
context, REQUEST, etudid, data, filename, description=descr
|
context, REQUEST, etudid, data, filename, description=descr
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -201,7 +202,6 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
|
|||||||
archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name)
|
archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name)
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression des fichiers ?</h2>
|
"""<h2>Confirmer la suppression des fichiers ?</h2>
|
||||||
<p>Fichier associé le %s à l'étudiant %s</p>
|
<p>Fichier associé le %s à l'étudiant %s</p>
|
||||||
<p>La suppression sera définitive.</p>"""
|
<p>La suppression sera définitive.</p>"""
|
||||||
@ -210,7 +210,6 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
|
|||||||
etud["nomprenom"],
|
etud["nomprenom"],
|
||||||
),
|
),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=url_for(
|
cancel_url=url_for(
|
||||||
"scolar.ficheEtud",
|
"scolar.ficheEtud",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
@ -221,7 +220,7 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
|
|||||||
)
|
)
|
||||||
|
|
||||||
EtudsArchive.delete_archive(archive_id)
|
EtudsArchive.delete_archive(archive_id)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for(
|
url_for(
|
||||||
"scolar.ficheEtud",
|
"scolar.ficheEtud",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
@ -311,9 +310,13 @@ def etudarchive_import_files_form(context, group_id, REQUEST=None):
|
|||||||
return "\n".join(H) + tf[1] + "</li></ol>" + F
|
return "\n".join(H) + tf[1] + "</li></ol>" + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
# retrouve le semestre à partir du groupe:
|
# retrouve le semestre à partir du groupe:
|
||||||
g = sco_groups.get_group(context, group_id)
|
group = sco_groups.get_group(context, group_id)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=" + g["formsemestre_id"]
|
url_for(
|
||||||
|
"notes.formsemestre_status",
|
||||||
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
formsemestre_id=group["formsemestre_id"],
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return etudarchive_import_files(
|
return etudarchive_import_files(
|
||||||
|
@ -256,7 +256,7 @@ def itemsuivi_suppress(context, itemsuivi_id, REQUEST=None):
|
|||||||
item = itemsuivi_get(cnx, itemsuivi_id, ignore_errors=True)
|
item = itemsuivi_get(cnx, itemsuivi_id, ignore_errors=True)
|
||||||
if item:
|
if item:
|
||||||
_itemsuivi_delete(cnx, itemsuivi_id)
|
_itemsuivi_delete(cnx, itemsuivi_id)
|
||||||
logdb(REQUEST, cnx, method="itemsuivi_suppress", etudid=item["etudid"])
|
logdb(cnx, method="itemsuivi_suppress", etudid=item["etudid"])
|
||||||
log("suppressed itemsuivi %s" % (itemsuivi_id,))
|
log("suppressed itemsuivi %s" % (itemsuivi_id,))
|
||||||
|
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ def itemsuivi_create(
|
|||||||
itemsuivi_id = _itemsuivi_create(
|
itemsuivi_id = _itemsuivi_create(
|
||||||
cnx, args={"etudid": etudid, "item_date": item_date, "situation": situation}
|
cnx, args={"etudid": etudid, "item_date": item_date, "situation": situation}
|
||||||
)
|
)
|
||||||
logdb(REQUEST, cnx, method="itemsuivi_create", etudid=etudid)
|
logdb(cnx, method="itemsuivi_create", etudid=etudid)
|
||||||
log("created itemsuivi %s for %s" % (itemsuivi_id, etudid))
|
log("created itemsuivi %s for %s" % (itemsuivi_id, etudid))
|
||||||
item = itemsuivi_get(cnx, itemsuivi_id)
|
item = itemsuivi_get(cnx, itemsuivi_id)
|
||||||
if format == "json":
|
if format == "json":
|
||||||
|
@ -73,19 +73,17 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
|
|||||||
else:
|
else:
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression de la formation %(titre)s (%(acronyme)s) ?</h2>
|
"""<h2>Confirmer la suppression de la formation %(titre)s (%(acronyme)s) ?</h2>
|
||||||
<p><b>Attention:</b> la suppression d'une formation est <b>irréversible</b> et implique la supression de toutes les UE, matières et modules de la formation !
|
<p><b>Attention:</b> la suppression d'une formation est <b>irréversible</b> et implique la supression de toutes les UE, matières et modules de la formation !
|
||||||
</p>
|
</p>
|
||||||
"""
|
"""
|
||||||
% F,
|
% F,
|
||||||
REQUEST=REQUEST,
|
|
||||||
OK="Supprimer cette formation",
|
OK="Supprimer cette formation",
|
||||||
cancel_url=scu.NotesURL(),
|
cancel_url=scu.NotesURL(),
|
||||||
parameters={"formation_id": formation_id},
|
parameters={"formation_id": formation_id},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
do_formation_delete(context, F["formation_id"], REQUEST)
|
do_formation_delete(context, F["formation_id"])
|
||||||
H.append(
|
H.append(
|
||||||
"""<p>OK, formation supprimée.</p>
|
"""<p>OK, formation supprimée.</p>
|
||||||
<p><a class="stdlink" href="%s">continuer</a></p>"""
|
<p><a class="stdlink" href="%s">continuer</a></p>"""
|
||||||
@ -96,7 +94,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
|
|||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
|
|
||||||
def do_formation_delete(context, oid, REQUEST):
|
def do_formation_delete(context, oid):
|
||||||
"""delete a formation (and all its UE, matieres, modules)
|
"""delete a formation (and all its UE, matieres, modules)
|
||||||
XXX delete all ues, will break if there are validations ! USE WITH CARE !
|
XXX delete all ues, will break if there are validations ! USE WITH CARE !
|
||||||
"""
|
"""
|
||||||
@ -107,7 +105,7 @@ def do_formation_delete(context, oid, REQUEST):
|
|||||||
# delete all UE in this formation
|
# delete all UE in this formation
|
||||||
ues = sco_edit_ue.do_ue_list(context, {"formation_id": oid})
|
ues = sco_edit_ue.do_ue_list(context, {"formation_id": oid})
|
||||||
for ue in ues:
|
for ue in ues:
|
||||||
sco_edit_ue.do_ue_delete(context, ue["ue_id"], REQUEST=REQUEST, force=True)
|
sco_edit_ue.do_ue_delete(context, ue["ue_id"], force=True)
|
||||||
|
|
||||||
sco_formations._formationEditor.delete(cnx, oid)
|
sco_formations._formationEditor.delete(cnx, oid)
|
||||||
|
|
||||||
@ -222,7 +220,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.NotesURL())
|
return flask.redirect(scu.NotesURL())
|
||||||
else:
|
else:
|
||||||
# check unicity : constraint UNIQUE(acronyme,titre,version)
|
# check unicity : constraint UNIQUE(acronyme,titre,version)
|
||||||
if create:
|
if create:
|
||||||
@ -247,13 +245,13 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
|
|||||||
)
|
)
|
||||||
#
|
#
|
||||||
if create:
|
if create:
|
||||||
formation_id = do_formation_create(context, tf[2], REQUEST)
|
formation_id = do_formation_create(context, tf[2])
|
||||||
else:
|
else:
|
||||||
do_formation_edit(context, tf[2])
|
do_formation_edit(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect("ue_list?formation_id=%s" % formation_id)
|
return flask.redirect("ue_list?formation_id=%s" % formation_id)
|
||||||
|
|
||||||
|
|
||||||
def do_formation_create(context, args, REQUEST):
|
def do_formation_create(context, args):
|
||||||
"create a formation"
|
"create a formation"
|
||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
# check unique acronyme/titre/version
|
# check unique acronyme/titre/version
|
||||||
@ -338,7 +336,7 @@ def module_move(context, module_id, after=0, REQUEST=None, redirect=1):
|
|||||||
|
|
||||||
# redirect to ue_list page:
|
# redirect to ue_list page:
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect("ue_list?formation_id=" + formation_id)
|
return flask.redirect("ue_list?formation_id=" + formation_id)
|
||||||
|
|
||||||
|
|
||||||
def ue_move(context, ue_id, after=0, REQUEST=None, redirect=1):
|
def ue_move(context, ue_id, after=0, REQUEST=None, redirect=1):
|
||||||
@ -369,4 +367,4 @@ def ue_move(context, ue_id, after=0, REQUEST=None, redirect=1):
|
|||||||
sco_edit_ue._ueEditor.edit(cnx, neigh)
|
sco_edit_ue._ueEditor.edit(cnx, neigh)
|
||||||
# redirect to ue_list page
|
# redirect to ue_list page
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect("ue_list?formation_id=" + o["formation_id"])
|
return flask.redirect("ue_list?formation_id=" + o["formation_id"])
|
@ -68,7 +68,7 @@ def do_matiere_edit(context, *args, **kw):
|
|||||||
sco_edit_formation.invalidate_sems_in_formation(formation_id)
|
sco_edit_formation.invalidate_sems_in_formation(formation_id)
|
||||||
|
|
||||||
|
|
||||||
def do_matiere_create(context, args, REQUEST):
|
def do_matiere_create(context, args):
|
||||||
"create a matiere"
|
"create a matiere"
|
||||||
from app.scodoc import sco_edit_ue
|
from app.scodoc import sco_edit_ue
|
||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
@ -138,7 +138,7 @@ associé.
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
# check unicity
|
# check unicity
|
||||||
mats = do_matiere_list(context, args={"ue_id": ue_id, "titre": tf[2]["titre"]})
|
mats = do_matiere_list(context, args={"ue_id": ue_id, "titre": tf[2]["titre"]})
|
||||||
@ -149,11 +149,11 @@ associé.
|
|||||||
+ tf[1]
|
+ tf[1]
|
||||||
+ html_sco_header.sco_footer()
|
+ html_sco_header.sco_footer()
|
||||||
)
|
)
|
||||||
_ = do_matiere_create(context, tf[2], REQUEST)
|
_ = do_matiere_create(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
def do_matiere_delete(context, oid, REQUEST):
|
def do_matiere_delete(context, oid):
|
||||||
"delete matiere and attached modules"
|
"delete matiere and attached modules"
|
||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
from app.scodoc import sco_edit_ue
|
from app.scodoc import sco_edit_ue
|
||||||
@ -174,7 +174,7 @@ def do_matiere_delete(context, oid, REQUEST):
|
|||||||
# delete all modules in this matiere
|
# delete all modules in this matiere
|
||||||
mods = sco_edit_module.do_module_list(context, {"matiere_id": oid})
|
mods = sco_edit_module.do_module_list(context, {"matiere_id": oid})
|
||||||
for mod in mods:
|
for mod in mods:
|
||||||
sco_edit_module.do_module_delete(context, mod["module_id"], REQUEST)
|
sco_edit_module.do_module_delete(context, mod["module_id"])
|
||||||
_matiereEditor.delete(cnx, oid)
|
_matiereEditor.delete(cnx, oid)
|
||||||
|
|
||||||
# news
|
# news
|
||||||
@ -211,10 +211,10 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
do_matiere_delete(context, matiere_id, REQUEST)
|
do_matiere_delete(context, matiere_id)
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
def matiere_edit(context, matiere_id=None, REQUEST=None):
|
def matiere_edit(context, matiere_id=None, REQUEST=None):
|
||||||
@ -284,7 +284,7 @@ associé.
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + help + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + help + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
# check unicity
|
# check unicity
|
||||||
mats = do_matiere_list(
|
mats = do_matiere_list(
|
||||||
@ -308,7 +308,7 @@ associé.
|
|||||||
|
|
||||||
do_matiere_edit(context, tf[2])
|
do_matiere_edit(context, tf[2])
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
def matiere_is_locked(context, matiere_id):
|
def matiere_is_locked(context, matiere_id):
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
"""Ajout/Modification/Suppression modules
|
"""Ajout/Modification/Suppression modules
|
||||||
(portage from DTML)
|
(portage from DTML)
|
||||||
"""
|
"""
|
||||||
|
import flask
|
||||||
|
from flask import url_for, g
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app.scodoc.notes_log import log
|
||||||
@ -96,7 +99,7 @@ def do_module_list(context, *args, **kw):
|
|||||||
return _moduleEditor.list(cnx, *args, **kw)
|
return _moduleEditor.list(cnx, *args, **kw)
|
||||||
|
|
||||||
|
|
||||||
def do_module_create(context, args, REQUEST):
|
def do_module_create(context, args):
|
||||||
"create a module"
|
"create a module"
|
||||||
# create
|
# create
|
||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
@ -237,13 +240,17 @@ def module_create(context, matiere_id=None, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
else:
|
else:
|
||||||
do_module_create(context, tf[2], REQUEST)
|
do_module_create(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
|
url_for(
|
||||||
|
"notes.ue_list",
|
||||||
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
formation_id=UE["formation_id"],
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def do_module_delete(context, oid, REQUEST):
|
def do_module_delete(context, oid):
|
||||||
"delete module"
|
"delete module"
|
||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
|
|
||||||
@ -255,12 +262,10 @@ def do_module_delete(context, oid, REQUEST):
|
|||||||
mods = sco_moduleimpl.do_moduleimpl_list(context, module_id=oid)
|
mods = sco_moduleimpl.do_moduleimpl_list(context, module_id=oid)
|
||||||
if mods:
|
if mods:
|
||||||
err_page = scu.confirm_dialog(
|
err_page = scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="""<h3>Destruction du module impossible car il est utilisé dans des semestres existants !</h3>""",
|
message="""<h3>Destruction du module impossible car il est utilisé dans des semestres existants !</h3>""",
|
||||||
helpmsg="""Il faut d'abord supprimer le semestre. Mais il est peut être préférable de laisser ce programme intact et d'en créer une nouvelle version pour la modifier.""",
|
helpmsg="""Il faut d'abord supprimer le semestre. Mais il est peut être préférable de laisser ce programme intact et d'en créer une nouvelle version pour la modifier.""",
|
||||||
dest_url="ue_list",
|
dest_url="ue_list",
|
||||||
parameters={"formation_id": mod["formation_id"]},
|
parameters={"formation_id": mod["formation_id"]},
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
raise ScoGenError(err_page)
|
raise ScoGenError(err_page)
|
||||||
# delete
|
# delete
|
||||||
@ -303,10 +308,10 @@ def module_delete(context, module_id=None, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
do_module_delete(context, module_id, REQUEST)
|
do_module_delete(context, module_id)
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
def do_module_edit(context, val):
|
def do_module_edit(context, val):
|
||||||
@ -498,14 +503,14 @@ def module_edit(context, module_id=None, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
# l'UE peut changer
|
# l'UE peut changer
|
||||||
tf[2]["ue_id"], tf[2]["matiere_id"] = tf[2]["ue_matiere_id"].split("!")
|
tf[2]["ue_id"], tf[2]["matiere_id"] = tf[2]["ue_matiere_id"].split("!")
|
||||||
# Check unicité code module dans la formation
|
# Check unicité code module dans la formation
|
||||||
|
|
||||||
do_module_edit(context, tf[2])
|
do_module_edit(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
# Edition en ligne du code Apogee
|
# Edition en ligne du code Apogee
|
||||||
@ -594,7 +599,7 @@ def formation_add_malus_modules(context, formation_id, titre=None, REQUEST=None)
|
|||||||
ue_add_malus_module(context, ue["ue_id"], titre=titre, REQUEST=REQUEST)
|
ue_add_malus_module(context, ue["ue_id"], titre=titre, REQUEST=REQUEST)
|
||||||
|
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
return REQUEST.RESPONSE.redirect("ue_list?formation_id=" + formation_id)
|
return flask.redirect("ue_list?formation_id=" + formation_id)
|
||||||
|
|
||||||
|
|
||||||
def ue_add_malus_module(context, ue_id, titre=None, code=None, REQUEST=None):
|
def ue_add_malus_module(context, ue_id, titre=None, code=None, REQUEST=None):
|
||||||
@ -623,7 +628,7 @@ def ue_add_malus_module(context, ue_id, titre=None, code=None, REQUEST=None):
|
|||||||
Matlist = sco_edit_matiere.do_matiere_list(context, args={"ue_id": ue_id})
|
Matlist = sco_edit_matiere.do_matiere_list(context, args={"ue_id": ue_id})
|
||||||
numero = max([mat["numero"] for mat in Matlist]) + 10
|
numero = max([mat["numero"] for mat in Matlist]) + 10
|
||||||
matiere_id = sco_edit_matiere.do_matiere_create(
|
matiere_id = sco_edit_matiere.do_matiere_create(
|
||||||
context, {"ue_id": ue_id, "titre": "Malus", "numero": numero}, REQUEST
|
context, {"ue_id": ue_id, "titre": "Malus", "numero": numero}
|
||||||
)
|
)
|
||||||
|
|
||||||
module_id = do_module_create(
|
module_id = do_module_create(
|
||||||
@ -638,7 +643,6 @@ def ue_add_malus_module(context, ue_id, titre=None, code=None, REQUEST=None):
|
|||||||
"semestre_id": semestre_id,
|
"semestre_id": semestre_id,
|
||||||
"module_type": scu.MODULE_MALUS,
|
"module_type": scu.MODULE_MALUS,
|
||||||
},
|
},
|
||||||
REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return module_id
|
return module_id
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
"""Ajout/Modification/Suppression UE
|
"""Ajout/Modification/Suppression UE
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import flask
|
||||||
|
from flask import g, url_for
|
||||||
|
from flask_login import current_user
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.notes_log import log
|
from app.scodoc.notes_log import log
|
||||||
@ -83,7 +87,7 @@ def do_ue_list(context, *args, **kw):
|
|||||||
return _ueEditor.list(cnx, *args, **kw)
|
return _ueEditor.list(cnx, *args, **kw)
|
||||||
|
|
||||||
|
|
||||||
def do_ue_create(context, args, REQUEST):
|
def do_ue_create(context, args):
|
||||||
"create an ue"
|
"create an ue"
|
||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
|
|
||||||
@ -130,11 +134,9 @@ def do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=F
|
|||||||
)
|
)
|
||||||
if validations and not delete_validations and not force:
|
if validations and not delete_validations and not force:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<p>%d étudiants ont validé l'UE %s (%s)</p><p>Si vous supprimez cette UE, ces validations vont être supprimées !</p>"
|
"<p>%d étudiants ont validé l'UE %s (%s)</p><p>Si vous supprimez cette UE, ces validations vont être supprimées !</p>"
|
||||||
% (len(validations), ue["acronyme"], ue["titre"]),
|
% (len(validations), ue["acronyme"], ue["titre"]),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
target_variable="delete_validations",
|
target_variable="delete_validations",
|
||||||
cancel_url="ue_list?formation_id=%s" % ue["formation_id"],
|
cancel_url="ue_list?formation_id=%s" % ue["formation_id"],
|
||||||
parameters={"ue_id": ue_id, "dialog_confirmed": 1},
|
parameters={"ue_id": ue_id, "dialog_confirmed": 1},
|
||||||
@ -149,7 +151,7 @@ def do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=F
|
|||||||
# delete all matiere in this UE
|
# delete all matiere in this UE
|
||||||
mats = sco_edit_matiere.do_matiere_list(context, {"ue_id": ue_id})
|
mats = sco_edit_matiere.do_matiere_list(context, {"ue_id": ue_id})
|
||||||
for mat in mats:
|
for mat in mats:
|
||||||
sco_edit_matiere.do_matiere_delete(context, mat["matiere_id"], REQUEST)
|
sco_edit_matiere.do_matiere_delete(context, mat["matiere_id"])
|
||||||
# delete uecoef and events
|
# delete uecoef and events
|
||||||
ndb.SimpleQuery(
|
ndb.SimpleQuery(
|
||||||
"DELETE FROM notes_formsemestre_uecoef WHERE ue_id=%(ue_id)s",
|
"DELETE FROM notes_formsemestre_uecoef WHERE ue_id=%(ue_id)s",
|
||||||
@ -171,8 +173,12 @@ def do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=F
|
|||||||
)
|
)
|
||||||
#
|
#
|
||||||
if not force:
|
if not force:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.NotesURL() + "/ue_list?formation_id=" + str(ue["formation_id"])
|
url_for(
|
||||||
|
"notes.ue_list",
|
||||||
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
formation_id=ue["formation_id"],
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@ -337,12 +343,11 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
|
|||||||
context, formation_id, int(tf[2]["semestre_id"] or 0)
|
context, formation_id, int(tf[2]["semestre_id"] or 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
ue_id = do_ue_create(context, tf[2], REQUEST)
|
ue_id = do_ue_create(context, tf[2])
|
||||||
if parcours.UE_IS_MODULE or tf[2]["create_matiere"]:
|
if parcours.UE_IS_MODULE or tf[2]["create_matiere"]:
|
||||||
matiere_id = sco_edit_matiere.do_matiere_create(
|
matiere_id = sco_edit_matiere.do_matiere_create(
|
||||||
context,
|
context,
|
||||||
{"ue_id": ue_id, "titre": tf[2]["titre"], "numero": 1},
|
{"ue_id": ue_id, "titre": tf[2]["titre"], "numero": 1},
|
||||||
REQUEST,
|
|
||||||
)
|
)
|
||||||
if parcours.UE_IS_MODULE:
|
if parcours.UE_IS_MODULE:
|
||||||
# dans ce mode, crée un (unique) module dans l'UE:
|
# dans ce mode, crée un (unique) module dans l'UE:
|
||||||
@ -357,12 +362,13 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
|
|||||||
"formation_id": formation_id,
|
"formation_id": formation_id,
|
||||||
"semestre_id": tf[2]["semestre_id"],
|
"semestre_id": tf[2]["semestre_id"],
|
||||||
},
|
},
|
||||||
REQUEST,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
do_ue_edit(context, tf[2])
|
do_ue_edit(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.NotesURL() + "/ue_list?formation_id=" + formation_id
|
url_for(
|
||||||
|
"notes.ue_list", scodoc_dept=g.scodoc_dept, formation_id=formation_id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -409,10 +415,8 @@ def ue_delete(
|
|||||||
|
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<h2>Suppression de l'UE %(titre)s (%(acronyme)s))</h2>" % ue,
|
"<h2>Suppression de l'UE %(titre)s (%(acronyme)s))</h2>" % ue,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
parameters={"ue_id": ue_id},
|
parameters={"ue_id": ue_id},
|
||||||
cancel_url="ue_list?formation_id=%s" % ue["formation_id"],
|
cancel_url="ue_list?formation_id=%s" % ue["formation_id"],
|
||||||
)
|
)
|
||||||
@ -429,8 +433,6 @@ def ue_list(context, formation_id=None, msg="", REQUEST=None):
|
|||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
from app.scodoc import sco_formsemestre_validation
|
from app.scodoc import sco_formsemestre_validation
|
||||||
|
|
||||||
authuser = REQUEST.AUTHENTICATED_USER
|
|
||||||
|
|
||||||
F = sco_formations.formation_list(context, args={"formation_id": formation_id})
|
F = sco_formations.formation_list(context, args={"formation_id": formation_id})
|
||||||
if not F:
|
if not F:
|
||||||
raise ScoValueError("invalid formation_id")
|
raise ScoValueError("invalid formation_id")
|
||||||
@ -444,7 +446,7 @@ def ue_list(context, formation_id=None, msg="", REQUEST=None):
|
|||||||
ue_list.sort(key=lambda u: (u["semestre_id"], u["numero"]))
|
ue_list.sort(key=lambda u: (u["semestre_id"], u["numero"]))
|
||||||
has_duplicate_ue_codes = len(set([ue["ue_code"] for ue in ue_list])) != len(ue_list)
|
has_duplicate_ue_codes = len(set([ue["ue_code"] for ue in ue_list])) != len(ue_list)
|
||||||
|
|
||||||
perm_change = authuser.has_permission(Permission.ScoChangeFormation)
|
perm_change = current_user.has_permission(Permission.ScoChangeFormation)
|
||||||
# editable = (not locked) and perm_change
|
# editable = (not locked) and perm_change
|
||||||
# On autorise maintanant la modification des formations qui ont des semestres verrouillés,
|
# On autorise maintanant la modification des formations qui ont des semestres verrouillés,
|
||||||
# sauf si cela affect les notes passées (verrouillées):
|
# sauf si cela affect les notes passées (verrouillées):
|
||||||
@ -452,14 +454,14 @@ def ue_list(context, formation_id=None, msg="", REQUEST=None):
|
|||||||
# - pas de changement des codes d'UE utilisés dans des semestres verrouillés
|
# - pas de changement des codes d'UE utilisés dans des semestres verrouillés
|
||||||
editable = perm_change
|
editable = perm_change
|
||||||
tag_editable = (
|
tag_editable = (
|
||||||
authuser.has_permission(Permission.ScoEditFormationTags) or perm_change
|
current_user.has_permission(Permission.ScoEditFormationTags) or perm_change
|
||||||
)
|
)
|
||||||
if locked:
|
if locked:
|
||||||
lockicon = scu.icontag("lock32_img", title="verrouillé")
|
lockicon = scu.icontag("lock32_img", title="verrouillé")
|
||||||
else:
|
else:
|
||||||
lockicon = ""
|
lockicon = ""
|
||||||
|
|
||||||
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags(context, REQUEST)
|
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags()
|
||||||
delete_icon = scu.icontag(
|
delete_icon = scu.icontag(
|
||||||
"delete_small_img", title="Supprimer (module inutilisé)", alt="supprimer"
|
"delete_small_img", title="Supprimer (module inutilisé)", alt="supprimer"
|
||||||
)
|
)
|
||||||
@ -802,7 +804,7 @@ Si vous souhaitez modifier cette formation (par exemple pour y ajouter un module
|
|||||||
H.append("</li>")
|
H.append("</li>")
|
||||||
H.append("</ul>")
|
H.append("</ul>")
|
||||||
|
|
||||||
if authuser.has_permission(Permission.ScoImplement):
|
if current_user.has_permission(Permission.ScoImplement):
|
||||||
H.append(
|
H.append(
|
||||||
"""<ul>
|
"""<ul>
|
||||||
<li><a class="stdlink" href="formsemestre_createwithmodules?formation_id=%(formation_id)s&semestre_id=1">Mettre en place un nouveau semestre de formation %(acronyme)s</a>
|
<li><a class="stdlink" href="formsemestre_createwithmodules?formation_id=%(formation_id)s&semestre_id=1">Mettre en place un nouveau semestre de formation %(acronyme)s</a>
|
||||||
|
@ -640,7 +640,7 @@ def view_apo_csv_store(
|
|||||||
context, data, semset["annee_scolaire"], semset["sem_id"]
|
context, data, semset["annee_scolaire"], semset["sem_id"]
|
||||||
)
|
)
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect("apo_semset_maq_status?semset_id=" + semset_id)
|
return flask.redirect("apo_semset_maq_status?semset_id=" + semset_id)
|
||||||
|
|
||||||
|
|
||||||
def view_apo_csv_download_and_store(context, etape_apo="", semset_id="", REQUEST=None):
|
def view_apo_csv_download_and_store(context, etape_apo="", semset_id="", REQUEST=None):
|
||||||
@ -670,12 +670,10 @@ def view_apo_csv_delete(
|
|||||||
dest_url = "apo_semset_maq_status?semset_id=" + semset_id
|
dest_url = "apo_semset_maq_status?semset_id=" + semset_id
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression du fichier étape <tt>%s</tt>?</h2>
|
"""<h2>Confirmer la suppression du fichier étape <tt>%s</tt>?</h2>
|
||||||
<p>La suppression sera définitive.</p>"""
|
<p>La suppression sera définitive.</p>"""
|
||||||
% (etape_apo,),
|
% (etape_apo,),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=dest_url,
|
cancel_url=dest_url,
|
||||||
parameters={"semset_id": semset_id, "etape_apo": etape_apo},
|
parameters={"semset_id": semset_id, "etape_apo": etape_apo},
|
||||||
)
|
)
|
||||||
@ -684,7 +682,7 @@ def view_apo_csv_delete(
|
|||||||
context, etape_apo, semset["annee_scolaire"], semset["sem_id"]
|
context, etape_apo, semset["annee_scolaire"], semset["sem_id"]
|
||||||
)
|
)
|
||||||
sco_etape_apogee.apo_csv_delete(context, info["archive_id"])
|
sco_etape_apogee.apo_csv_delete(context, info["archive_id"])
|
||||||
return REQUEST.RESPONSE.redirect(dest_url + "&head_message=Archive%20supprimée")
|
return flask.redirect(dest_url + "&head_message=Archive%20supprimée")
|
||||||
|
|
||||||
|
|
||||||
def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=None):
|
def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=None):
|
||||||
|
@ -351,7 +351,6 @@ def _check_duplicate_code(cnx, args, code_name, context, edit=True, REQUEST=None
|
|||||||
parameters = {}
|
parameters = {}
|
||||||
if context:
|
if context:
|
||||||
err_page = scu.confirm_dialog(
|
err_page = scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="""<h3>Code étudiant (%s) dupliqué !</h3>""" % code_name,
|
message="""<h3>Code étudiant (%s) dupliqué !</h3>""" % code_name,
|
||||||
helpmsg="""Le %s %s est déjà utilisé: un seul étudiant peut avoir ce code. Vérifier votre valeur ou supprimer l'autre étudiant avec cette valeur.<p><ul><li>"""
|
helpmsg="""Le %s %s est déjà utilisé: un seul étudiant peut avoir ce code. Vérifier votre valeur ou supprimer l'autre étudiant avec cette valeur.<p><ul><li>"""
|
||||||
% (code_name, args[code_name])
|
% (code_name, args[code_name])
|
||||||
@ -360,7 +359,6 @@ def _check_duplicate_code(cnx, args, code_name, context, edit=True, REQUEST=None
|
|||||||
OK=OK,
|
OK=OK,
|
||||||
dest_url=dest_url,
|
dest_url=dest_url,
|
||||||
parameters=parameters,
|
parameters=parameters,
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
err_page = """<h3>Code étudiant (%s) dupliqué !</h3>""" % code_name
|
err_page = """<h3>Code étudiant (%s) dupliqué !</h3>""" % code_name
|
||||||
@ -692,7 +690,6 @@ def create_etud(context, cnx, args={}, REQUEST=None):
|
|||||||
)
|
)
|
||||||
# log
|
# log
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="etudident_edit_form",
|
method="etudident_edit_form",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
|
@ -1046,7 +1046,7 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, REQUEST=None):
|
|||||||
resp = u["prenomnom"]
|
resp = u["prenomnom"]
|
||||||
nomcomplet = u["nomcomplet"]
|
nomcomplet = u["nomcomplet"]
|
||||||
can_edit = sco_permissions_check.can_edit_notes(
|
can_edit = sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, moduleimpl_id, allow_ens=False
|
REQUEST.AUTHENTICATED_USER, moduleimpl_id, allow_ens=False
|
||||||
)
|
)
|
||||||
|
|
||||||
link = (
|
link = (
|
||||||
@ -1363,7 +1363,7 @@ def evaluation_create_form(
|
|||||||
head = html_sco_header.sco_header(page_title=page_title)
|
head = html_sco_header.sco_header(page_title=page_title)
|
||||||
return head + "\n".join(H) + "\n" + tf[1] + help + html_sco_header.sco_footer()
|
return head + "\n".join(H) + "\n" + tf[1] + help + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
# form submission
|
# form submission
|
||||||
if tf[2]["visibulletinlist"]:
|
if tf[2]["visibulletinlist"]:
|
||||||
@ -1373,7 +1373,7 @@ def evaluation_create_form(
|
|||||||
if not edit:
|
if not edit:
|
||||||
# creation d'une evaluation
|
# creation d'une evaluation
|
||||||
evaluation_id = do_evaluation_create(REQUEST=REQUEST, **tf[2])
|
evaluation_id = do_evaluation_create(REQUEST=REQUEST, **tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
do_evaluation_edit(tf[2])
|
do_evaluation_edit(tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
@ -116,7 +116,7 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
|
|||||||
|
|
||||||
if len(etuds) == 1:
|
if len(etuds) == 1:
|
||||||
# va directement a la fiche
|
# va directement a la fiche
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for(
|
url_for(
|
||||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etuds[0]["etudid"]
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etuds[0]["etudid"]
|
||||||
)
|
)
|
||||||
|
@ -175,7 +175,7 @@ def formation_import_xml(context, REQUEST, doc, import_tags=True):
|
|||||||
# create formation
|
# create formation
|
||||||
# F_unquoted = F.copy()
|
# F_unquoted = F.copy()
|
||||||
# unescape_html_dict(F_unquoted)
|
# unescape_html_dict(F_unquoted)
|
||||||
formation_id = sco_edit_formation.do_formation_create(context, F, REQUEST)
|
formation_id = sco_edit_formation.do_formation_create(context, F)
|
||||||
log("formation %s created" % formation_id)
|
log("formation %s created" % formation_id)
|
||||||
ues_old2new = {} # xml ue_id : new ue_id
|
ues_old2new = {} # xml ue_id : new ue_id
|
||||||
modules_old2new = {} # xml module_id : new module_id
|
modules_old2new = {} # xml module_id : new module_id
|
||||||
@ -189,14 +189,14 @@ def formation_import_xml(context, REQUEST, doc, import_tags=True):
|
|||||||
del ue_info[1]["ue_id"]
|
del ue_info[1]["ue_id"]
|
||||||
else:
|
else:
|
||||||
xml_ue_id = None
|
xml_ue_id = None
|
||||||
ue_id = sco_edit_ue.do_ue_create(context, ue_info[1], REQUEST)
|
ue_id = sco_edit_ue.do_ue_create(context, ue_info[1])
|
||||||
if xml_ue_id:
|
if xml_ue_id:
|
||||||
ues_old2new[xml_ue_id] = ue_id
|
ues_old2new[xml_ue_id] = ue_id
|
||||||
# -- create matieres
|
# -- create matieres
|
||||||
for mat_info in ue_info[2]:
|
for mat_info in ue_info[2]:
|
||||||
assert mat_info[0] == "matiere"
|
assert mat_info[0] == "matiere"
|
||||||
mat_info[1]["ue_id"] = ue_id
|
mat_info[1]["ue_id"] = ue_id
|
||||||
mat_id = sco_edit_matiere.do_matiere_create(context, mat_info[1], REQUEST)
|
mat_id = sco_edit_matiere.do_matiere_create(context, mat_info[1])
|
||||||
# -- create modules
|
# -- create modules
|
||||||
for mod_info in mat_info[2]:
|
for mod_info in mat_info[2]:
|
||||||
assert mod_info[0] == "module"
|
assert mod_info[0] == "module"
|
||||||
@ -208,7 +208,7 @@ def formation_import_xml(context, REQUEST, doc, import_tags=True):
|
|||||||
mod_info[1]["formation_id"] = formation_id
|
mod_info[1]["formation_id"] = formation_id
|
||||||
mod_info[1]["matiere_id"] = mat_id
|
mod_info[1]["matiere_id"] = mat_id
|
||||||
mod_info[1]["ue_id"] = ue_id
|
mod_info[1]["ue_id"] = ue_id
|
||||||
mod_id = sco_edit_module.do_module_create(context, mod_info[1], REQUEST)
|
mod_id = sco_edit_module.do_module_create(context, mod_info[1])
|
||||||
if xml_module_id:
|
if xml_module_id:
|
||||||
modules_old2new[xml_module_id] = mod_id
|
modules_old2new[xml_module_id] = mod_id
|
||||||
if import_tags:
|
if import_tags:
|
||||||
@ -350,7 +350,7 @@ def formation_create_new_version(context, formation_id, redirect=True, REQUEST=N
|
|||||||
text="Nouvelle version de la formation %(acronyme)s" % F,
|
text="Nouvelle version de la formation %(acronyme)s" % F,
|
||||||
)
|
)
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"ue_list?formation_id=" + new_id + "&msg=Nouvelle version !"
|
"ue_list?formation_id=" + new_id + "&msg=Nouvelle version !"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -130,7 +130,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
# form submission
|
# form submission
|
||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
@ -157,4 +157,4 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
|
|||||||
"url": tf[2]["url_" + custommenu_id],
|
"url": tf[2]["url_" + custommenu_id],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
@ -741,7 +741,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
"responsable_id": tf[2][module_id],
|
"responsable_id": tf[2][module_id],
|
||||||
}
|
}
|
||||||
_ = sco_moduleimpl.do_moduleimpl_create(context, modargs)
|
_ = sco_moduleimpl.do_moduleimpl_create(context, modargs)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé"
|
"formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé"
|
||||||
% formsemestre_id
|
% formsemestre_id
|
||||||
)
|
)
|
||||||
@ -845,7 +845,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
)
|
)
|
||||||
return msg_html
|
return msg_html
|
||||||
else:
|
else:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s&head_message=Semestre modifié"
|
"formsemestre_status?formsemestre_id=%s&head_message=Semestre modifié"
|
||||||
% formsemestre_id
|
% formsemestre_id
|
||||||
)
|
)
|
||||||
@ -989,7 +989,7 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
|
|||||||
if tf[0] == 0 or msg:
|
if tf[0] == 0 or msg:
|
||||||
return "".join(H) + msg + tf[1] + html_sco_header.sco_footer()
|
return "".join(H) + msg + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1: # cancel
|
elif tf[0] == -1: # cancel
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -1003,7 +1003,7 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
|
|||||||
clone_partitions=tf[2]["clone_partitions"],
|
clone_partitions=tf[2]["clone_partitions"],
|
||||||
REQUEST=REQUEST,
|
REQUEST=REQUEST,
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé"
|
"formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé"
|
||||||
% new_formsemestre_id
|
% new_formsemestre_id
|
||||||
)
|
)
|
||||||
@ -1173,7 +1173,6 @@ def formsemestre_associate_new_version(
|
|||||||
)
|
)
|
||||||
|
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Associer à une nouvelle version de formation non verrouillée ?</h2>
|
"""<h2>Associer à une nouvelle version de formation non verrouillée ?</h2>
|
||||||
<p>Le programme pédagogique ("formation") va être dupliqué pour que vous puissiez le modifier sans affecter les autres semestres. Les autres paramètres (étudiants, notes...) du semestre seront inchangés.</p>
|
<p>Le programme pédagogique ("formation") va être dupliqué pour que vous puissiez le modifier sans affecter les autres semestres. Les autres paramètres (étudiants, notes...) du semestre seront inchangés.</p>
|
||||||
<p>Veillez à ne pas abuser de cette possibilité, car créer trop de versions de formations va vous compliquer la gestion (à vous de garder trace des différences et à ne pas vous tromper par la suite...).
|
<p>Veillez à ne pas abuser de cette possibilité, car créer trop de versions de formations va vous compliquer la gestion (à vous de garder trace des différences et à ne pas vous tromper par la suite...).
|
||||||
@ -1183,7 +1182,6 @@ def formsemestre_associate_new_version(
|
|||||||
+ "</div>",
|
+ "</div>",
|
||||||
OK="Associer ces semestres à une nouvelle version",
|
OK="Associer ces semestres à une nouvelle version",
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={"formsemestre_id": formsemestre_id},
|
parameters={"formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
@ -1191,7 +1189,7 @@ def formsemestre_associate_new_version(
|
|||||||
do_formsemestres_associate_new_version(
|
do_formsemestres_associate_new_version(
|
||||||
context, [formsemestre_id] + other_formsemestre_ids, REQUEST=REQUEST
|
context, [formsemestre_id] + other_formsemestre_ids, REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s&head_message=Formation%%20dupliquée"
|
"formsemestre_status?formsemestre_id=%s&head_message=Formation%%20dupliquée"
|
||||||
% formsemestre_id
|
% formsemestre_id
|
||||||
)
|
)
|
||||||
@ -1315,13 +1313,11 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
|
|||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
return "\n".join(H) + html_sco_header.sco_footer()
|
return "\n".join(H) + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1: # cancel
|
elif tf[0] == -1: # cancel
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
|
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("formsemestre_delete2?formsemestre_id=" + formsemestre_id)
|
||||||
"formsemestre_delete2?formsemestre_id=" + formsemestre_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def formsemestre_delete2(
|
def formsemestre_delete2(
|
||||||
@ -1331,16 +1327,14 @@ def formsemestre_delete2(
|
|||||||
# Confirmation dialog
|
# Confirmation dialog
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Vous voulez vraiment supprimer ce semestre ???</h2><p>(opération irréversible)</p>""",
|
"""<h2>Vous voulez vraiment supprimer ce semestre ???</h2><p>(opération irréversible)</p>""",
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={"formsemestre_id": formsemestre_id},
|
parameters={"formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
# Bon, s'il le faut...
|
# Bon, s'il le faut...
|
||||||
do_formsemestre_delete(context, formsemestre_id, REQUEST)
|
do_formsemestre_delete(context, formsemestre_id)
|
||||||
return REQUEST.RESPONSE.redirect(scu.ScoURL() + "?head_message=Semestre%20supprimé")
|
return flask.redirect(scu.ScoURL() + "?head_message=Semestre%20supprimé")
|
||||||
|
|
||||||
|
|
||||||
def formsemestre_has_decisions_or_compensations(context, formsemestre_id):
|
def formsemestre_has_decisions_or_compensations(context, formsemestre_id):
|
||||||
@ -1354,7 +1348,7 @@ def formsemestre_has_decisions_or_compensations(context, formsemestre_id):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def do_formsemestre_delete(context, formsemestre_id, REQUEST):
|
def do_formsemestre_delete(context, formsemestre_id):
|
||||||
"""delete formsemestre, and all its moduleimpls.
|
"""delete formsemestre, and all its moduleimpls.
|
||||||
No checks, no warnings: erase all !
|
No checks, no warnings: erase all !
|
||||||
"""
|
"""
|
||||||
@ -1444,9 +1438,7 @@ def formsemestre_edit_options(context, formsemestre_id, target_url=None, REQUEST
|
|||||||
(accessible par ScoImplement ou dir. etudes)
|
(accessible par ScoImplement ou dir. etudes)
|
||||||
"""
|
"""
|
||||||
log("formsemestre_edit_options")
|
log("formsemestre_edit_options")
|
||||||
ok, err = sco_permissions_check.check_access_diretud(
|
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
|
||||||
context, formsemestre_id, REQUEST
|
|
||||||
)
|
|
||||||
if not ok:
|
if not ok:
|
||||||
return err
|
return err
|
||||||
return sco_preferences.SemPreferences(formsemestre_id).edit(
|
return sco_preferences.SemPreferences(formsemestre_id).edit(
|
||||||
@ -1460,9 +1452,7 @@ def formsemestre_change_lock(
|
|||||||
"""Change etat (verrouille si ouvert, déverrouille si fermé)
|
"""Change etat (verrouille si ouvert, déverrouille si fermé)
|
||||||
nota: etat (1 ouvert, 0 fermé)
|
nota: etat (1 ouvert, 0 fermé)
|
||||||
"""
|
"""
|
||||||
ok, err = sco_permissions_check.check_access_diretud(
|
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
|
||||||
context, formsemestre_id, REQUEST
|
|
||||||
)
|
|
||||||
if not ok:
|
if not ok:
|
||||||
return err
|
return err
|
||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
@ -1474,7 +1464,6 @@ def formsemestre_change_lock(
|
|||||||
else:
|
else:
|
||||||
msg = "verrouillage"
|
msg = "verrouillage"
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<h2>Confirmer le %s du semestre ?</h2>" % msg,
|
"<h2>Confirmer le %s du semestre ?</h2>" % msg,
|
||||||
helpmsg="""Les notes d'un semestre verrouillé ne peuvent plus être modifiées.
|
helpmsg="""Les notes d'un semestre verrouillé ne peuvent plus être modifiées.
|
||||||
Un semestre verrouillé peut cependant être déverrouillé facilement à tout moment
|
Un semestre verrouillé peut cependant être déverrouillé facilement à tout moment
|
||||||
@ -1483,7 +1472,6 @@ def formsemestre_change_lock(
|
|||||||
Le programme d'une formation qui a un semestre verrouillé ne peut plus être modifié.
|
Le programme d'une formation qui a un semestre verrouillé ne peut plus être modifié.
|
||||||
""",
|
""",
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={"etat": etat, "formsemestre_id": formsemestre_id},
|
parameters={"etat": etat, "formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
@ -1493,7 +1481,7 @@ def formsemestre_change_lock(
|
|||||||
args = {"formsemestre_id": formsemestre_id, "etat": etat}
|
args = {"formsemestre_id": formsemestre_id, "etat": etat}
|
||||||
sco_formsemestre.do_formsemestre_edit(context, args)
|
sco_formsemestre.do_formsemestre_edit(context, args)
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1502,9 +1490,7 @@ def formsemestre_change_publication_bul(
|
|||||||
context, formsemestre_id, REQUEST=None, dialog_confirmed=False
|
context, formsemestre_id, REQUEST=None, dialog_confirmed=False
|
||||||
):
|
):
|
||||||
"""Change etat publication bulletins sur portail"""
|
"""Change etat publication bulletins sur portail"""
|
||||||
ok, err = sco_permissions_check.check_access_diretud(
|
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
|
||||||
context, formsemestre_id, REQUEST
|
|
||||||
)
|
|
||||||
if not ok:
|
if not ok:
|
||||||
return err
|
return err
|
||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
@ -1516,7 +1502,6 @@ def formsemestre_change_publication_bul(
|
|||||||
else:
|
else:
|
||||||
msg = ""
|
msg = ""
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<h2>Confirmer la %s publication des bulletins ?</h2>" % msg,
|
"<h2>Confirmer la %s publication des bulletins ?</h2>" % msg,
|
||||||
helpmsg="""Il est parfois utile de désactiver la diffusion des bulletins,
|
helpmsg="""Il est parfois utile de désactiver la diffusion des bulletins,
|
||||||
par exemple pendant la tenue d'un jury ou avant harmonisation des notes.
|
par exemple pendant la tenue d'un jury ou avant harmonisation des notes.
|
||||||
@ -1524,7 +1509,6 @@ def formsemestre_change_publication_bul(
|
|||||||
Ce réglage n'a d'effet que si votre établissement a interfacé ScoDoc et un portail étudiant.
|
Ce réglage n'a d'effet que si votre établissement a interfacé ScoDoc et un portail étudiant.
|
||||||
""",
|
""",
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={"bul_hide_xml": etat, "formsemestre_id": formsemestre_id},
|
parameters={"bul_hide_xml": etat, "formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
@ -1536,7 +1520,7 @@ def formsemestre_change_publication_bul(
|
|||||||
args = {"formsemestre_id": formsemestre_id, "bul_hide_xml": etat}
|
args = {"formsemestre_id": formsemestre_id, "bul_hide_xml": etat}
|
||||||
sco_formsemestre.do_formsemestre_edit(context, args)
|
sco_formsemestre.do_formsemestre_edit(context, args)
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
@ -1546,9 +1530,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
|
|||||||
"""Changement manuel des coefficients des UE capitalisées."""
|
"""Changement manuel des coefficients des UE capitalisées."""
|
||||||
from app.scodoc import notes_table
|
from app.scodoc import notes_table
|
||||||
|
|
||||||
ok, err = sco_permissions_check.check_access_diretud(
|
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
|
||||||
context, formsemestre_id, REQUEST
|
|
||||||
)
|
|
||||||
if not ok:
|
if not ok:
|
||||||
return err
|
return err
|
||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
|
@ -199,14 +199,14 @@ def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None)
|
|||||||
)
|
)
|
||||||
return "\n".join(H) + "\n" + tf[1] + F
|
return "\n".join(H) + "\n" + tf[1] + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"%s/formsemestre_bulletinetud?formsemestre_id==%s&etudid=%s"
|
"%s/formsemestre_bulletinetud?formsemestre_id==%s&etudid=%s"
|
||||||
% (scu.ScoURL(), formsemestre_id, etudid)
|
% (scu.ScoURL(), formsemestre_id, etudid)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
tf[2]["formation_id"] = orig_sem["formation_id"]
|
tf[2]["formation_id"] = orig_sem["formation_id"]
|
||||||
formsemestre_ext_create(context, etudid, tf[2], REQUEST=REQUEST)
|
formsemestre_ext_create(context, etudid, tf[2], REQUEST=REQUEST)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ def formsemestre_ext_edit_ue_validations(
|
|||||||
_record_ue_validations_and_coefs(
|
_record_ue_validations_and_coefs(
|
||||||
context, formsemestre_id, etudid, ue_list, tf[2], REQUEST=REQUEST
|
context, formsemestre_id, etudid, ue_list, tf[2], REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s"
|
"formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s"
|
||||||
% (formsemestre_id, etudid)
|
% (formsemestre_id, etudid)
|
||||||
)
|
)
|
||||||
|
@ -102,7 +102,6 @@ def do_formsemestre_inscription_create(context, args, REQUEST, method=None):
|
|||||||
)
|
)
|
||||||
# Log etudiant
|
# Log etudiant
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method=method,
|
method=method,
|
||||||
etudid=args["etudid"],
|
etudid=args["etudid"],
|
||||||
@ -187,13 +186,10 @@ def do_formsemestre_desinscription(context, etudid, formsemestre_id, REQUEST=Non
|
|||||||
"do_formsemestre_desinscription: suppression du semestre extérieur %s"
|
"do_formsemestre_desinscription: suppression du semestre extérieur %s"
|
||||||
% formsemestre_id
|
% formsemestre_id
|
||||||
)
|
)
|
||||||
sco_formsemestre_edit.do_formsemestre_delete(
|
sco_formsemestre_edit.do_formsemestre_delete(context, formsemestre_id)
|
||||||
context, formsemestre_id, REQUEST=REQUEST
|
|
||||||
)
|
|
||||||
|
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="formsemestre_desinscription",
|
method="formsemestre_desinscription",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -416,7 +412,7 @@ def formsemestre_inscription_with_modules(
|
|||||||
REQUEST=REQUEST,
|
REQUEST=REQUEST,
|
||||||
method="formsemestre_inscription_with_modules",
|
method="formsemestre_inscription_with_modules",
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -569,7 +565,7 @@ function chkbx_select(field_id, state) {
|
|||||||
)
|
)
|
||||||
return "\n".join(H) + "\n" + tf[1] + F
|
return "\n".join(H) + "\n" + tf[1] + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -417,17 +417,17 @@ def _redirect_valid_choice(
|
|||||||
adr += "&sortcol=" + sortcol
|
adr += "&sortcol=" + sortcol
|
||||||
# if desturl:
|
# if desturl:
|
||||||
# desturl += "&desturl=" + desturl
|
# desturl += "&desturl=" + desturl
|
||||||
return REQUEST.RESPONSE.redirect(adr)
|
return flask.redirect(adr)
|
||||||
# Si le precedent a été modifié, demande relecture du parcours.
|
# Si le precedent a été modifié, demande relecture du parcours.
|
||||||
# sinon renvoie au listing general,
|
# sinon renvoie au listing general,
|
||||||
|
|
||||||
|
|
||||||
# if choice.new_code_prev:
|
# if choice.new_code_prev:
|
||||||
# REQUEST.RESPONSE.redirect( 'formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1&desturl=%s' % (formsemestre_id, etudid, desturl) )
|
# flask.redirect( 'formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1&desturl=%s' % (formsemestre_id, etudid, desturl) )
|
||||||
# else:
|
# else:
|
||||||
# if not desturl:
|
# if not desturl:
|
||||||
# desturl = 'formsemestre_recapcomplet?modejury=1&hidemodules=1&formsemestre_id=' + formsemestre_id
|
# desturl = 'formsemestre_recapcomplet?modejury=1&hidemodules=1&formsemestre_id=' + formsemestre_id
|
||||||
# REQUEST.RESPONSE.redirect(desturl)
|
# flask.redirect(desturl)
|
||||||
|
|
||||||
|
|
||||||
def _dispcode(c):
|
def _dispcode(c):
|
||||||
@ -1080,7 +1080,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
|
|||||||
warn, ue_multiples = check_formation_ues(context, Fo["formation_id"])
|
warn, ue_multiples = check_formation_ues(context, Fo["formation_id"])
|
||||||
return "\n".join(H) + tf[1] + X + warn + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + X + warn + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
|
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -1098,7 +1098,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
|
|||||||
semestre_id=semestre_id,
|
semestre_id=semestre_id,
|
||||||
REQUEST=REQUEST,
|
REQUEST=REQUEST,
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL()
|
scu.ScoURL()
|
||||||
+ "/Notes/formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s&head_message=Validation%%20d'UE%%20enregistree"
|
+ "/Notes/formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s&head_message=Validation%%20d'UE%%20enregistree"
|
||||||
% (formsemestre_id, etudid)
|
% (formsemestre_id, etudid)
|
||||||
@ -1146,7 +1146,6 @@ def do_formsemestre_validate_previous_ue(
|
|||||||
)
|
)
|
||||||
|
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="formsemestre_validate_previous_ue",
|
method="formsemestre_validate_previous_ue",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -1221,7 +1220,7 @@ def etud_ue_suppress_validation(context, etudid, formsemestre_id, ue_id, REQUEST
|
|||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
_invalidate_etud_formation_caches(context, etudid, sem["formation_id"])
|
_invalidate_etud_formation_caches(context, etudid, sem["formation_id"])
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.NotesURL()
|
scu.NotesURL()
|
||||||
+ "/formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s"
|
+ "/formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s"
|
||||||
% (etudid, formsemestre_id)
|
% (etudid, formsemestre_id)
|
||||||
|
@ -571,7 +571,6 @@ def change_etud_group_in_partition(
|
|||||||
if REQUEST:
|
if REQUEST:
|
||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="changeGroup",
|
method="changeGroup",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -649,7 +648,6 @@ def setGroups(
|
|||||||
cursor=cursor,
|
cursor=cursor,
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="removeFromGroup",
|
method="removeFromGroup",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -778,7 +776,7 @@ def partition_create(
|
|||||||
return partition_id
|
return partition_id
|
||||||
|
|
||||||
|
|
||||||
def getArrowIconsTags(context, REQUEST):
|
def getArrowIconsTags():
|
||||||
"""returns html tags for arrows"""
|
"""returns html tags for arrows"""
|
||||||
#
|
#
|
||||||
arrow_up = scu.icontag("arrow_up", title="remonter")
|
arrow_up = scu.icontag("arrow_up", title="remonter")
|
||||||
@ -794,7 +792,7 @@ def editPartitionForm(context, formsemestre_id=None, REQUEST=None):
|
|||||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||||
partitions = get_partitions_list(context, formsemestre_id)
|
partitions = get_partitions_list(context, formsemestre_id)
|
||||||
arrow_up, arrow_down, arrow_none = getArrowIconsTags(context, REQUEST)
|
arrow_up, arrow_down, arrow_none = getArrowIconsTags()
|
||||||
suppricon = scu.icontag(
|
suppricon = scu.icontag(
|
||||||
"delete_small_img", border="0", alt="supprimer", title="Supprimer"
|
"delete_small_img", border="0", alt="supprimer", title="Supprimer"
|
||||||
)
|
)
|
||||||
@ -957,13 +955,11 @@ def partition_delete(
|
|||||||
else:
|
else:
|
||||||
grnames = ""
|
grnames = ""
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Supprimer la partition "%s" ?</h2>
|
"""<h2>Supprimer la partition "%s" ?</h2>
|
||||||
<p>Les groupes %s de cette partition seront supprimés</p>
|
<p>Les groupes %s de cette partition seront supprimés</p>
|
||||||
"""
|
"""
|
||||||
% (partition["partition_name"], grnames),
|
% (partition["partition_name"], grnames),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="editPartitionForm?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="editPartitionForm?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={"redirect": redirect, "partition_id": partition_id},
|
parameters={"redirect": redirect, "partition_id": partition_id},
|
||||||
)
|
)
|
||||||
@ -977,9 +973,7 @@ def partition_delete(
|
|||||||
|
|
||||||
# redirect to partition edit page:
|
# redirect to partition edit page:
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("editPartitionForm?formsemestre_id=" + formsemestre_id)
|
||||||
"editPartitionForm?formsemestre_id=" + formsemestre_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def partition_move(context, partition_id, after=0, REQUEST=None, redirect=1):
|
def partition_move(context, partition_id, after=0, REQUEST=None, redirect=1):
|
||||||
@ -1012,9 +1006,7 @@ def partition_move(context, partition_id, after=0, REQUEST=None, redirect=1):
|
|||||||
|
|
||||||
# redirect to partition edit page:
|
# redirect to partition edit page:
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("editPartitionForm?formsemestre_id=" + formsemestre_id)
|
||||||
"editPartitionForm?formsemestre_id=" + formsemestre_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def partition_rename(context, partition_id, REQUEST=None):
|
def partition_rename(context, partition_id, REQUEST=None):
|
||||||
@ -1051,9 +1043,7 @@ def partition_rename(context, partition_id, REQUEST=None):
|
|||||||
+ html_sco_header.sco_footer()
|
+ html_sco_header.sco_footer()
|
||||||
)
|
)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("editPartitionForm?formsemestre_id=" + formsemestre_id)
|
||||||
"editPartitionForm?formsemestre_id=" + formsemestre_id
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# form submission
|
# form submission
|
||||||
return partition_set_name(
|
return partition_set_name(
|
||||||
@ -1091,9 +1081,7 @@ def partition_set_name(context, partition_id, partition_name, REQUEST=None, redi
|
|||||||
|
|
||||||
# redirect to partition edit page:
|
# redirect to partition edit page:
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("editPartitionForm?formsemestre_id=" + formsemestre_id)
|
||||||
"editPartitionForm?formsemestre_id=" + formsemestre_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def group_set_name(context, group_id, group_name, REQUEST=None, redirect=1):
|
def group_set_name(context, group_id, group_name, REQUEST=None, redirect=1):
|
||||||
@ -1114,9 +1102,7 @@ def group_set_name(context, group_id, group_name, REQUEST=None, redirect=1):
|
|||||||
|
|
||||||
# redirect to partition edit page:
|
# redirect to partition edit page:
|
||||||
if redirect:
|
if redirect:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("affectGroups?partition_id=" + group["partition_id"])
|
||||||
"affectGroups?partition_id=" + group["partition_id"]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def group_rename(context, group_id, REQUEST=None):
|
def group_rename(context, group_id, REQUEST=None):
|
||||||
@ -1153,9 +1139,7 @@ def group_rename(context, group_id, REQUEST=None):
|
|||||||
+ html_sco_header.sco_footer()
|
+ html_sco_header.sco_footer()
|
||||||
)
|
)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("affectGroups?partition_id=" + group["partition_id"])
|
||||||
"affectGroups?partition_id=" + group["partition_id"]
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# form submission
|
# form submission
|
||||||
return group_set_name(
|
return group_set_name(
|
||||||
@ -1213,7 +1197,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
# form submission
|
# form submission
|
||||||
log(
|
log(
|
||||||
@ -1263,7 +1247,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
|
|||||||
context, etudid, group_id, partition, REQUEST=REQUEST
|
context, etudid, group_id, partition, REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
log("%s in group %s" % (etudid, group_id))
|
log("%s in group %s" % (etudid, group_id))
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
def get_prev_moy(context, etudid, formsemestre_id):
|
def get_prev_moy(context, etudid, formsemestre_id):
|
||||||
|
@ -350,7 +350,6 @@ def formsemestre_inscr_passage(
|
|||||||
H.append("""<h3>Il n'y a rien à modifier !</h3>""")
|
H.append("""<h3>Il n'y a rien à modifier !</h3>""")
|
||||||
H.append(
|
H.append(
|
||||||
scu.confirm_dialog(
|
scu.confirm_dialog(
|
||||||
context,
|
|
||||||
dest_url="formsemestre_inscr_passage",
|
dest_url="formsemestre_inscr_passage",
|
||||||
add_headers=False,
|
add_headers=False,
|
||||||
cancel_url="formsemestre_inscr_passage?formsemestre_id="
|
cancel_url="formsemestre_inscr_passage?formsemestre_id="
|
||||||
@ -362,7 +361,6 @@ def formsemestre_inscr_passage(
|
|||||||
"inscrit_groupes": inscrit_groupes,
|
"inscrit_groupes": inscrit_groupes,
|
||||||
"submitted": 1,
|
"submitted": 1,
|
||||||
},
|
},
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -192,7 +192,7 @@ def do_evaluation_listenotes(context, REQUEST):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1]
|
return "\n".join(H) + "\n" + tf[1]
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"%s/Notes/moduleimpl_status?moduleimpl_id=%s"
|
"%s/Notes/moduleimpl_status?moduleimpl_id=%s"
|
||||||
% (scu.ScoURL(), E["moduleimpl_id"])
|
% (scu.ScoURL(), E["moduleimpl_id"])
|
||||||
)
|
)
|
||||||
|
@ -222,7 +222,6 @@ def do_moduleimpl_inscription_create(context, args, REQUEST=None, formsemestre_i
|
|||||||
) # > moduleimpl_inscription
|
) # > moduleimpl_inscription
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
scolog.logdb(
|
scolog.logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="moduleimpl_inscription",
|
method="moduleimpl_inscription",
|
||||||
etudid=args["etudid"],
|
etudid=args["etudid"],
|
||||||
|
@ -200,9 +200,7 @@ def moduleimpl_inscriptions_edit(
|
|||||||
sco_moduleimpl.do_moduleimpl_inscrit_etuds(
|
sco_moduleimpl.do_moduleimpl_inscrit_etuds(
|
||||||
context, moduleimpl_id, formsemestre_id, etuds, reset=True, REQUEST=REQUEST
|
context, moduleimpl_id, formsemestre_id, etuds, reset=True, REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("moduleimpl_status?moduleimpl_id=%s" % (moduleimpl_id))
|
||||||
"moduleimpl_status?moduleimpl_id=%s" % (moduleimpl_id)
|
|
||||||
)
|
|
||||||
#
|
#
|
||||||
H.append(footer)
|
H.append(footer)
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
@ -557,7 +555,6 @@ def do_etud_desinscrit_ue(context, etudid, formsemestre_id, ue_id, REQUEST=None)
|
|||||||
)
|
)
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="etud_desinscrit_ue",
|
method="etud_desinscrit_ue",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
|
@ -31,6 +31,7 @@ import time
|
|||||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for
|
||||||
|
from flask_login import current_user
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
@ -64,7 +65,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
sco_permissions_check.can_edit_notes(
|
sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
||||||
)
|
)
|
||||||
and nbnotes != 0
|
and nbnotes != 0
|
||||||
):
|
):
|
||||||
@ -80,7 +81,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
"evaluation_id": evaluation_id,
|
"evaluation_id": evaluation_id,
|
||||||
},
|
},
|
||||||
"enabled": sco_permissions_check.can_edit_notes(
|
"enabled": sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"]
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"]
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -90,7 +91,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
"evaluation_id": evaluation_id,
|
"evaluation_id": evaluation_id,
|
||||||
},
|
},
|
||||||
"enabled": sco_permissions_check.can_edit_notes(
|
"enabled": sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -101,7 +102,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
},
|
},
|
||||||
"enabled": nbnotes == 0
|
"enabled": nbnotes == 0
|
||||||
and sco_permissions_check.can_edit_notes(
|
and sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -111,7 +112,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
"evaluation_id": evaluation_id,
|
"evaluation_id": evaluation_id,
|
||||||
},
|
},
|
||||||
"enabled": sco_permissions_check.can_edit_notes(
|
"enabled": sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -130,7 +131,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
},
|
},
|
||||||
"enabled": nbnotes == 0
|
"enabled": nbnotes == 0
|
||||||
and sco_permissions_check.can_edit_notes(
|
and sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"]
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"]
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -157,7 +158,6 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
|||||||
|
|
||||||
def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=None):
|
def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=None):
|
||||||
"""Tableau de bord module (liste des evaluations etc)"""
|
"""Tableau de bord module (liste des evaluations etc)"""
|
||||||
authuser = REQUEST.AUTHENTICATED_USER
|
|
||||||
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
|
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
|
||||||
formsemestre_id = M["formsemestre_id"]
|
formsemestre_id = M["formsemestre_id"]
|
||||||
Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
|
Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
|
||||||
@ -177,12 +177,10 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
|
|||||||
|
|
||||||
#
|
#
|
||||||
caneditevals = sco_permissions_check.can_edit_notes(
|
caneditevals = sco_permissions_check.can_edit_notes(
|
||||||
context, authuser, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
||||||
)
|
)
|
||||||
caneditnotes = sco_permissions_check.can_edit_notes(
|
caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
||||||
context, authuser, moduleimpl_id
|
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags()
|
||||||
)
|
|
||||||
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags(context, REQUEST)
|
|
||||||
#
|
#
|
||||||
H = [
|
H = [
|
||||||
html_sco_header.sco_header(page_title="Module %(titre)s" % Mod),
|
html_sco_header.sco_header(page_title="Module %(titre)s" % Mod),
|
||||||
@ -240,7 +238,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
|
|||||||
"""<tr><td class="fichetitre2">Inscrits: </td><td> %d étudiants"""
|
"""<tr><td class="fichetitre2">Inscrits: </td><td> %d étudiants"""
|
||||||
% len(ModInscrits)
|
% len(ModInscrits)
|
||||||
)
|
)
|
||||||
if authuser.has_permission(Permission.ScoEtudInscrit):
|
if current_user.has_permission(Permission.ScoEtudInscrit):
|
||||||
H.append(
|
H.append(
|
||||||
"""<a class="stdlink" style="margin-left:2em;" href="moduleimpl_inscriptions_edit?moduleimpl_id=%s">modifier</a>"""
|
"""<a class="stdlink" style="margin-left:2em;" href="moduleimpl_inscriptions_edit?moduleimpl_id=%s">modifier</a>"""
|
||||||
% M["moduleimpl_id"]
|
% M["moduleimpl_id"]
|
||||||
@ -279,7 +277,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
|
|||||||
)
|
)
|
||||||
# Adapté à partir d'une suggestion de DS (Le Havre)
|
# Adapté à partir d'une suggestion de DS (Le Havre)
|
||||||
# Liens saisies absences seulement si permission et date courante dans le semestre
|
# Liens saisies absences seulement si permission et date courante dans le semestre
|
||||||
if authuser.has_permission(
|
if current_user.has_permission(
|
||||||
Permission.ScoAbsChange
|
Permission.ScoAbsChange
|
||||||
) and sco_formsemestre.sem_est_courant(context, sem):
|
) and sco_formsemestre.sem_est_courant(context, sem):
|
||||||
datelundi = sco_abs.ddmmyyyy(time.strftime("%d/%m/%Y")).prev_monday()
|
datelundi = sco_abs.ddmmyyyy(time.strftime("%d/%m/%Y")).prev_monday()
|
||||||
|
@ -574,7 +574,6 @@ class SituationEtudParcoursGeneric(object):
|
|||||||
decision.formsemestre_id_utilise_pour_compenser,
|
decision.formsemestre_id_utilise_pour_compenser,
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="validate_sem",
|
method="validate_sem",
|
||||||
etudid=self.etudid,
|
etudid=self.etudid,
|
||||||
@ -607,7 +606,6 @@ class SituationEtudParcoursGeneric(object):
|
|||||||
formsemestre_id_utilise_pour_compenser=fsid,
|
formsemestre_id_utilise_pour_compenser=fsid,
|
||||||
)
|
)
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="validate_sem",
|
method="validate_sem",
|
||||||
etudid=self.etudid,
|
etudid=self.etudid,
|
||||||
@ -932,7 +930,6 @@ def formsemestre_validate_ues(
|
|||||||
|
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="validate_ue",
|
method="validate_ue",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
|
@ -14,7 +14,7 @@ from app.scodoc import sco_exceptions
|
|||||||
from app.scodoc import sco_moduleimpl
|
from app.scodoc import sco_moduleimpl
|
||||||
|
|
||||||
|
|
||||||
def can_edit_notes(context, authuser, moduleimpl_id, allow_ens=True):
|
def can_edit_notes(authuser, moduleimpl_id, allow_ens=True):
|
||||||
"""True if authuser can enter or edit notes in this module.
|
"""True if authuser can enter or edit notes in this module.
|
||||||
If allow_ens, grant access to all ens in this module
|
If allow_ens, grant access to all ens in this module
|
||||||
|
|
||||||
@ -24,6 +24,7 @@ def can_edit_notes(context, authuser, moduleimpl_id, allow_ens=True):
|
|||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
from app.scodoc import sco_parcours_dut
|
from app.scodoc import sco_parcours_dut
|
||||||
|
|
||||||
|
context = None # XXX #context
|
||||||
uid = str(authuser)
|
uid = str(authuser)
|
||||||
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
|
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
|
||||||
sem = sco_formsemestre.get_formsemestre(context, M["formsemestre_id"])
|
sem = sco_formsemestre.get_formsemestre(context, M["formsemestre_id"])
|
||||||
@ -139,14 +140,14 @@ def is_chef_or_diretud(sem):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check_access_diretud(
|
def check_access_diretud(formsemestre_id, required_permission=Permission.ScoImplement):
|
||||||
context, formsemestre_id, REQUEST, required_permission=Permission.ScoImplement
|
|
||||||
):
|
|
||||||
"""Check if access granted: responsable or ScoImplement
|
"""Check if access granted: responsable or ScoImplement
|
||||||
Return True|False, HTML_error_page
|
Return True|False, HTML_error_page
|
||||||
"""
|
"""
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
|
|
||||||
|
context = None # XXX #context
|
||||||
|
|
||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
header = html_sco_header.sco_header(page_title="Accès interdit")
|
header = html_sco_header.sco_header(page_title="Accès interdit")
|
||||||
footer = html_sco_header.sco_footer()
|
footer = html_sco_header.sco_footer()
|
||||||
|
@ -257,8 +257,7 @@ def store_photo(context, etud, data, REQUEST=None):
|
|||||||
sco_etud.identite_edit_nocheck(cnx, etud)
|
sco_etud.identite_edit_nocheck(cnx, etud)
|
||||||
cnx.commit()
|
cnx.commit()
|
||||||
#
|
#
|
||||||
if REQUEST:
|
logdb(cnx, method="changePhoto", msg=filename, etudid=etud["etudid"])
|
||||||
logdb(REQUEST, cnx, method="changePhoto", msg=filename, etudid=etud["etudid"])
|
|
||||||
#
|
#
|
||||||
return 1, "ok"
|
return 1, "ok"
|
||||||
|
|
||||||
@ -282,9 +281,7 @@ def suppress_photo(context, etud, REQUEST=None):
|
|||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
# 3- log
|
# 3- log
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
logdb(
|
logdb(cnx, method="changePhoto", msg="suppression", etudid=etud["etudid"])
|
||||||
REQUEST, cnx, method="changePhoto", msg="suppression", etudid=etud["etudid"]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
@ -195,7 +195,7 @@ def do_placement_selectetuds(context, REQUEST):
|
|||||||
H.append("""<div class="saisienote_etape1">""")
|
H.append("""<div class="saisienote_etape1">""")
|
||||||
return "\n".join(H) + "\n" + tf[1] + "\n</div>"
|
return "\n".join(H) + "\n" + tf[1] + "\n</div>"
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"%s/Notes/moduleimpl_status?moduleimpl_id=%s"
|
"%s/Notes/moduleimpl_status?moduleimpl_id=%s"
|
||||||
% (scu.ScoURL(), E["moduleimpl_id"])
|
% (scu.ScoURL(), E["moduleimpl_id"])
|
||||||
)
|
)
|
||||||
@ -225,7 +225,7 @@ def do_placement_selectetuds(context, REQUEST):
|
|||||||
)
|
)
|
||||||
+ "&".join(gs)
|
+ "&".join(gs)
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(scu.NotesURL() + "/do_placement?" + query)
|
return flask.redirect(scu.NotesURL() + "/do_placement?" + query)
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"invalid placement_method (%s)" % tf[2]["placement_method"]
|
"invalid placement_method (%s)" % tf[2]["placement_method"]
|
||||||
@ -248,7 +248,7 @@ def do_placement(context, REQUEST):
|
|||||||
|
|
||||||
# Check access
|
# Check access
|
||||||
# (admin, respformation, and responsable_id)
|
# (admin, respformation, and responsable_id)
|
||||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||||
return (
|
return (
|
||||||
"<h2>Génération du placement impossible pour %s</h2>" % authusername
|
"<h2>Génération du placement impossible pour %s</h2>" % authusername
|
||||||
+ """<p>(vérifiez que le semestre n'est pas verrouillé et que vous
|
+ """<p>(vérifiez que le semestre n'est pas verrouillé et que vous
|
||||||
|
@ -1975,14 +1975,12 @@ class BasePreferences(object):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.ScoURL()) # cancel
|
return flask.redirect(scu.ScoURL()) # cancel
|
||||||
else:
|
else:
|
||||||
for pref in self.prefs_definition:
|
for pref in self.prefs_definition:
|
||||||
self.prefs[None][pref[0]] = tf[2][pref[0]]
|
self.prefs[None][pref[0]] = tf[2][pref[0]]
|
||||||
self.save()
|
self.save()
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(scu.ScoURL() + "?head_message=Préférences modifiées")
|
||||||
scu.ScoURL() + "?head_message=Préférences modifiées"
|
|
||||||
)
|
|
||||||
|
|
||||||
def build_tf_form(self, categories=[], formsemestre_id=None):
|
def build_tf_form(self, categories=[], formsemestre_id=None):
|
||||||
"""Build list of elements for TrivialFormulator.
|
"""Build list of elements for TrivialFormulator.
|
||||||
@ -2151,9 +2149,7 @@ function set_global_pref(el, pref_name) {
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(dest_url + "&head_message=Annulé") # cancel
|
||||||
dest_url + "&head_message=Annulé"
|
|
||||||
) # cancel
|
|
||||||
else:
|
else:
|
||||||
# Supprime pref locale du semestre (retour à la valeur globale)
|
# Supprime pref locale du semestre (retour à la valeur globale)
|
||||||
if tf[2]["suppress"]:
|
if tf[2]["suppress"]:
|
||||||
@ -2187,15 +2183,13 @@ function set_global_pref(el, pref_name) {
|
|||||||
# done: change prefs and redirect to semestre status
|
# done: change prefs and redirect to semestre status
|
||||||
destination = tf[2]["destination"]
|
destination = tf[2]["destination"]
|
||||||
if destination == "done" or destination == "":
|
if destination == "done" or destination == "":
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(dest_url + "&head_message=Préférences modifiées")
|
||||||
dest_url + "&head_message=Préférences modifiées"
|
|
||||||
)
|
|
||||||
elif destination == "again":
|
elif destination == "again":
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
REQUEST.URL0 + "?formsemestre_id=" + self.formsemestre_id
|
REQUEST.URL0 + "?formsemestre_id=" + self.formsemestre_id
|
||||||
)
|
)
|
||||||
elif destination == "global":
|
elif destination == "global":
|
||||||
return REQUEST.RESPONSE.redirect(scu.ScoURL() + "/edit_preferences")
|
return flask.redirect(scu.ScoURL() + "/edit_preferences")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -687,7 +687,7 @@ def formsemestre_pvjury_pdf(
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + "\n".join(F)
|
return "\n".join(H) + "\n" + tf[1] + "\n".join(F)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_pvjury?formsemestre_id=%s" % (formsemestre_id)
|
"formsemestre_pvjury?formsemestre_id=%s" % (formsemestre_id)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -861,7 +861,7 @@ def formsemestre_lettres_individuelles(
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + F
|
return "\n".join(H) + "\n" + tf[1] + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_pvjury?formsemestre_id=%s" % (formsemestre_id)
|
"formsemestre_pvjury?formsemestre_id=%s" % (formsemestre_id)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -881,7 +881,7 @@ def formsemestre_lettres_individuelles(
|
|||||||
finally:
|
finally:
|
||||||
PDFLOCK.release()
|
PDFLOCK.release()
|
||||||
if not pdfdoc:
|
if not pdfdoc:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id={}&head_message=Aucun%20%C3%A9tudiant%20n%27a%20de%20d%C3%A9cision%20de%20jury".format(
|
"formsemestre_status?formsemestre_id={}&head_message=Aucun%20%C3%A9tudiant%20n%27a%20de%20d%C3%A9cision%20de%20jury".format(
|
||||||
formsemestre_id
|
formsemestre_id
|
||||||
)
|
)
|
||||||
|
@ -33,6 +33,8 @@ import time
|
|||||||
import datetime
|
import datetime
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
|
from flask_login import current_user
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import log
|
from app.scodoc.notes_log import log
|
||||||
@ -171,7 +173,7 @@ def do_evaluation_upload_xls(context, REQUEST):
|
|||||||
)[0]
|
)[0]
|
||||||
# Check access
|
# Check access
|
||||||
# (admin, respformation, and responsable_id)
|
# (admin, respformation, and responsable_id)
|
||||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||||
# XXX imaginer un redirect + msg erreur
|
# XXX imaginer un redirect + msg erreur
|
||||||
raise AccessDenied("Modification des notes impossible pour %s" % authuser)
|
raise AccessDenied("Modification des notes impossible pour %s" % authuser)
|
||||||
#
|
#
|
||||||
@ -280,21 +282,19 @@ def do_evaluation_upload_xls(context, REQUEST):
|
|||||||
return 0, msg + "<p>(pas de notes modifiées)</p>"
|
return 0, msg + "<p>(pas de notes modifiées)</p>"
|
||||||
|
|
||||||
|
|
||||||
def do_evaluation_set_missing(
|
def do_evaluation_set_missing(evaluation_id, value, dialog_confirmed=False):
|
||||||
context, evaluation_id, value, REQUEST=None, dialog_confirmed=False
|
|
||||||
):
|
|
||||||
"""Initialisation des notes manquantes"""
|
"""Initialisation des notes manquantes"""
|
||||||
authuser = REQUEST.AUTHENTICATED_USER
|
# ? evaluation_id = REQUEST.form["evaluation_id"]
|
||||||
evaluation_id = REQUEST.form["evaluation_id"]
|
context = None # XXX #context
|
||||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||||
M = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
M = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||||
context, moduleimpl_id=E["moduleimpl_id"]
|
context, moduleimpl_id=E["moduleimpl_id"]
|
||||||
)[0]
|
)[0]
|
||||||
# Check access
|
# Check access
|
||||||
# (admin, respformation, and responsable_id)
|
# (admin, respformation, and responsable_id)
|
||||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
if not sco_permissions_check.can_edit_notes(current_user, E["moduleimpl_id"]):
|
||||||
# XXX imaginer un redirect + msg erreur
|
# XXX imaginer un redirect + msg erreur
|
||||||
raise AccessDenied("Modification des notes impossible pour %s" % authuser)
|
raise AccessDenied("Modification des notes impossible pour %s" % current_user)
|
||||||
#
|
#
|
||||||
NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
|
NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
|
||||||
etudids = sco_groups.do_evaluation_listeetuds_groups(
|
etudids = sco_groups.do_evaluation_listeetuds_groups(
|
||||||
@ -319,7 +319,6 @@ def do_evaluation_set_missing(
|
|||||||
# Confirm action
|
# Confirm action
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Mettre toutes les notes manquantes de l'évaluation
|
"""<h2>Mettre toutes les notes manquantes de l'évaluation
|
||||||
à la valeur %s ?</h2>
|
à la valeur %s ?</h2>
|
||||||
<p>Seuls les étudiants pour lesquels aucune note (ni valeur, ni ABS, ni EXC)
|
<p>Seuls les étudiants pour lesquels aucune note (ni valeur, ni ABS, ni EXC)
|
||||||
@ -329,13 +328,12 @@ def do_evaluation_set_missing(
|
|||||||
"""
|
"""
|
||||||
% (value, len(L)),
|
% (value, len(L)),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="saisie_notes?evaluation_id=%s" % evaluation_id,
|
cancel_url="saisie_notes?evaluation_id=%s" % evaluation_id,
|
||||||
parameters={"evaluation_id": evaluation_id, "value": value},
|
parameters={"evaluation_id": evaluation_id, "value": value},
|
||||||
)
|
)
|
||||||
# ok
|
# ok
|
||||||
comment = "Initialisation notes manquantes"
|
comment = "Initialisation notes manquantes"
|
||||||
nb_changed, _, _ = _notes_add(context, authuser, evaluation_id, L, comment)
|
nb_changed, _, _ = _notes_add(context, current_user, evaluation_id, L, comment)
|
||||||
# news
|
# news
|
||||||
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
|
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
|
||||||
mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
|
mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
|
||||||
@ -362,41 +360,39 @@ def do_evaluation_set_missing(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=False):
|
def evaluation_suppress_alln(evaluation_id, dialog_confirmed=False):
|
||||||
"suppress all notes in this eval"
|
"suppress all notes in this eval"
|
||||||
authuser = REQUEST.AUTHENTICATED_USER
|
context = None # XXX #context
|
||||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||||
|
|
||||||
if sco_permissions_check.can_edit_notes(
|
if sco_permissions_check.can_edit_notes(
|
||||||
context, authuser, E["moduleimpl_id"], allow_ens=False
|
current_user, E["moduleimpl_id"], allow_ens=False
|
||||||
):
|
):
|
||||||
# On a le droit de modifier toutes les notes
|
# On a le droit de modifier toutes les notes
|
||||||
# recupere les etuds ayant une note
|
# recupere les etuds ayant une note
|
||||||
NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
|
NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
|
||||||
elif sco_permissions_check.can_edit_notes(
|
elif sco_permissions_check.can_edit_notes(
|
||||||
context, authuser, E["moduleimpl_id"], allow_ens=True
|
current_user, E["moduleimpl_id"], allow_ens=True
|
||||||
):
|
):
|
||||||
# Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi
|
# Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi
|
||||||
NotesDB = sco_evaluations.do_evaluation_get_all_notes(
|
NotesDB = sco_evaluations.do_evaluation_get_all_notes(
|
||||||
evaluation_id, by_uid=str(authuser)
|
evaluation_id, by_uid=current_user.user_name
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise AccessDenied("Modification des notes impossible pour %s" % authuser)
|
raise AccessDenied("Modification des notes impossible pour %s" % current_user)
|
||||||
|
|
||||||
notes = [(etudid, scu.NOTES_SUPPRESS) for etudid in NotesDB.keys()]
|
notes = [(etudid, scu.NOTES_SUPPRESS) for etudid in NotesDB.keys()]
|
||||||
|
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
nb_changed, nb_suppress, existing_decisions = _notes_add(
|
nb_changed, nb_suppress, existing_decisions = _notes_add(
|
||||||
context, authuser, evaluation_id, notes, do_it=False
|
context, current_user, evaluation_id, notes, do_it=False
|
||||||
)
|
)
|
||||||
msg = "<p>Confirmer la suppression des %d notes ?</p>" % nb_suppress
|
msg = "<p>Confirmer la suppression des %d notes ?</p>" % nb_suppress
|
||||||
if existing_decisions:
|
if existing_decisions:
|
||||||
msg += """<p class="warning">Important: il y a déjà des décisions de jury enregistrées, qui seront potentiellement à revoir suite à cette modification !</p>"""
|
msg += """<p class="warning">Important: il y a déjà des décisions de jury enregistrées, qui seront potentiellement à revoir suite à cette modification !</p>"""
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
msg,
|
msg,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
OK="Supprimer les notes",
|
OK="Supprimer les notes",
|
||||||
cancel_url="moduleimpl_status?moduleimpl_id=%s" % E["moduleimpl_id"],
|
cancel_url="moduleimpl_status?moduleimpl_id=%s" % E["moduleimpl_id"],
|
||||||
parameters={"evaluation_id": evaluation_id},
|
parameters={"evaluation_id": evaluation_id},
|
||||||
@ -404,7 +400,7 @@ def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=F
|
|||||||
|
|
||||||
# modif
|
# modif
|
||||||
nb_changed, nb_suppress, existing_decisions = _notes_add(
|
nb_changed, nb_suppress, existing_decisions = _notes_add(
|
||||||
context, authuser, evaluation_id, notes, comment="effacer tout"
|
context, current_user, evaluation_id, notes, comment="effacer tout"
|
||||||
)
|
)
|
||||||
assert nb_changed == nb_suppress
|
assert nb_changed == nb_suppress
|
||||||
H = ["<p>%s notes supprimées</p>" % nb_suppress]
|
H = ["<p>%s notes supprimées</p>" % nb_suppress]
|
||||||
@ -572,7 +568,7 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
|
|||||||
E = evals[0]
|
E = evals[0]
|
||||||
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
|
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
|
||||||
formsemestre_id = M["formsemestre_id"]
|
formsemestre_id = M["formsemestre_id"]
|
||||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||||
return (
|
return (
|
||||||
html_sco_header.sco_header()
|
html_sco_header.sco_header()
|
||||||
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
||||||
@ -690,12 +686,12 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
|
|||||||
#
|
#
|
||||||
H.append("""</div><h3>Autres opérations</h3><ul>""")
|
H.append("""</div><h3>Autres opérations</h3><ul>""")
|
||||||
if sco_permissions_check.can_edit_notes(
|
if sco_permissions_check.can_edit_notes(
|
||||||
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
|
||||||
):
|
):
|
||||||
H.append(
|
H.append(
|
||||||
"""
|
"""
|
||||||
<li>
|
<li>
|
||||||
<form action="do_evaluation_set_missing" method="get">
|
<form action="do_evaluation_set_missing" method="GET">
|
||||||
Mettre toutes les notes manquantes à <input type="text" size="5" name="value"/>
|
Mettre toutes les notes manquantes à <input type="text" size="5" name="value"/>
|
||||||
<input type="submit" value="OK"/>
|
<input type="submit" value="OK"/>
|
||||||
<input type="hidden" name="evaluation_id" value="%s"/>
|
<input type="hidden" name="evaluation_id" value="%s"/>
|
||||||
@ -851,7 +847,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
|
|||||||
formsemestre_id = M["formsemestre_id"]
|
formsemestre_id = M["formsemestre_id"]
|
||||||
# Check access
|
# Check access
|
||||||
# (admin, respformation, and responsable_id)
|
# (admin, respformation, and responsable_id)
|
||||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||||
return (
|
return (
|
||||||
html_sco_header.sco_header()
|
html_sco_header.sco_header()
|
||||||
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
||||||
@ -932,7 +928,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
|
|||||||
context, E, M, groups_infos.group_ids, destination=destination, REQUEST=REQUEST
|
context, E, M, groups_infos.group_ids, destination=destination, REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
if form is None:
|
if form is None:
|
||||||
return REQUEST.RESPONSE.redirect(destination)
|
return flask.redirect(destination)
|
||||||
H.append(form)
|
H.append(form)
|
||||||
#
|
#
|
||||||
H.append("</div>") # /saisie_notes
|
H.append("</div>") # /saisie_notes
|
||||||
@ -1178,7 +1174,7 @@ def _form_saisie_notes(context, E, M, group_ids, destination="", REQUEST=None):
|
|||||||
H.append(
|
H.append(
|
||||||
"""
|
"""
|
||||||
<div>
|
<div>
|
||||||
<form action="do_evaluation_set_missing" method="get">
|
<form action="do_evaluation_set_missing" method="GET">
|
||||||
Mettre <em>toutes</em> les notes manquantes à <input type="text" size="5" name="value"/>
|
Mettre <em>toutes</em> les notes manquantes à <input type="text" size="5" name="value"/>
|
||||||
<input type="submit" value="OK"/>
|
<input type="submit" value="OK"/>
|
||||||
<input type="hidden" name="evaluation_id" value="%s"/>
|
<input type="hidden" name="evaluation_id" value="%s"/>
|
||||||
@ -1211,7 +1207,7 @@ def save_note(
|
|||||||
Mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % M
|
Mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % M
|
||||||
result = {"nbchanged": 0} # JSON
|
result = {"nbchanged": 0} # JSON
|
||||||
# Check access: admin, respformation, or responsable_id
|
# Check access: admin, respformation, or responsable_id
|
||||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||||
result["status"] = "unauthorized"
|
result["status"] = "unauthorized"
|
||||||
else:
|
else:
|
||||||
L, _, _, _, _ = _check_notes([(etudid, value)], E, Mod)
|
L, _, _, _, _ = _check_notes([(etudid, value)], E, Mod)
|
||||||
|
@ -353,7 +353,7 @@ def do_semset_create(context, title="", annee_scolaire=None, sem_id=None, REQUES
|
|||||||
% (title, annee_scolaire, sem_id)
|
% (title, annee_scolaire, sem_id)
|
||||||
)
|
)
|
||||||
SemSet(context, title=title, annee_scolaire=annee_scolaire, sem_id=sem_id)
|
SemSet(context, title=title, annee_scolaire=annee_scolaire, sem_id=sem_id)
|
||||||
return REQUEST.RESPONSE.redirect("semset_page")
|
return flask.redirect("semset_page")
|
||||||
|
|
||||||
|
|
||||||
def do_semset_delete(context, semset_id, dialog_confirmed=False, REQUEST=None):
|
def do_semset_delete(context, semset_id, dialog_confirmed=False, REQUEST=None):
|
||||||
@ -363,15 +363,13 @@ def do_semset_delete(context, semset_id, dialog_confirmed=False, REQUEST=None):
|
|||||||
s = SemSet(context, semset_id=semset_id)
|
s = SemSet(context, semset_id=semset_id)
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<h2>Suppression de l'ensemble %(title)s ?</h2>" % s,
|
"<h2>Suppression de l'ensemble %(title)s ?</h2>" % s,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
parameters={"semset_id": semset_id},
|
parameters={"semset_id": semset_id},
|
||||||
cancel_url="semset_page",
|
cancel_url="semset_page",
|
||||||
)
|
)
|
||||||
s.delete()
|
s.delete()
|
||||||
return REQUEST.RESPONSE.redirect("semset_page")
|
return flask.redirect("semset_page")
|
||||||
|
|
||||||
|
|
||||||
def edit_semset_set_title(context, id=None, value=None, REQUEST=None):
|
def edit_semset_set_title(context, id=None, value=None, REQUEST=None):
|
||||||
@ -395,7 +393,7 @@ def do_semset_add_sem(context, semset_id, formsemestre_id, REQUEST=None):
|
|||||||
|
|
||||||
s.add(formsemestre_id)
|
s.add(formsemestre_id)
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect("apo_semset_maq_status?semset_id=%s" % semset_id)
|
return flask.redirect("apo_semset_maq_status?semset_id=%s" % semset_id)
|
||||||
|
|
||||||
|
|
||||||
def do_semset_remove_sem(context, semset_id, formsemestre_id, REQUEST=None):
|
def do_semset_remove_sem(context, semset_id, formsemestre_id, REQUEST=None):
|
||||||
@ -406,7 +404,7 @@ def do_semset_remove_sem(context, semset_id, formsemestre_id, REQUEST=None):
|
|||||||
|
|
||||||
s.remove(formsemestre_id)
|
s.remove(formsemestre_id)
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect("apo_semset_maq_status?semset_id=%s" % semset_id)
|
return flask.redirect("apo_semset_maq_status?semset_id=%s" % semset_id)
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
|
@ -208,13 +208,11 @@ def formsemestre_synchro_etuds(
|
|||||||
|
|
||||||
H.append(
|
H.append(
|
||||||
scu.confirm_dialog(
|
scu.confirm_dialog(
|
||||||
context,
|
|
||||||
dest_url="formsemestre_synchro_etuds",
|
dest_url="formsemestre_synchro_etuds",
|
||||||
add_headers=False,
|
add_headers=False,
|
||||||
cancel_url="formsemestre_synchro_etuds?formsemestre_id="
|
cancel_url="formsemestre_synchro_etuds?formsemestre_id="
|
||||||
+ formsemestre_id,
|
+ formsemestre_id,
|
||||||
OK="Effectuer l'opération",
|
OK="Effectuer l'opération",
|
||||||
REQUEST=REQUEST,
|
|
||||||
parameters={
|
parameters={
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre_id,
|
||||||
"etuds": ",".join(etuds),
|
"etuds": ",".join(etuds),
|
||||||
|
@ -201,7 +201,6 @@ def check_local_photos_availability(context, groups_infos, REQUEST, format=""):
|
|||||||
return (
|
return (
|
||||||
False,
|
False,
|
||||||
scu.confirm_dialog(
|
scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<p>Attention: %d photos ne sont pas disponibles et ne peuvent pas être exportées.</p><p>Vous pouvez <a class="stdlink" href="%s">exporter seulement les photos existantes</a>"""
|
"""<p>Attention: %d photos ne sont pas disponibles et ne peuvent pas être exportées.</p><p>Vous pouvez <a class="stdlink" href="%s">exporter seulement les photos existantes</a>"""
|
||||||
% (
|
% (
|
||||||
nb_missing,
|
nb_missing,
|
||||||
@ -211,7 +210,6 @@ def check_local_photos_availability(context, groups_infos, REQUEST, format=""):
|
|||||||
OK="Exporter seulement les photos existantes",
|
OK="Exporter seulement les photos existantes",
|
||||||
cancel_url="groups_view?curtab=tab-photos&"
|
cancel_url="groups_view?curtab=tab-photos&"
|
||||||
+ groups_infos.groups_query_args,
|
+ groups_infos.groups_query_args,
|
||||||
REQUEST=REQUEST,
|
|
||||||
parameters=parameters,
|
parameters=parameters,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -268,14 +266,12 @@ def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=F
|
|||||||
)
|
)
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Copier les photos du portail vers ScoDoc ?</h2>
|
"""<h2>Copier les photos du portail vers ScoDoc ?</h2>
|
||||||
<p>Les photos du groupe %s présentes dans ScoDoc seront remplacées par celles du portail (si elles existent).</p>
|
<p>Les photos du groupe %s présentes dans ScoDoc seront remplacées par celles du portail (si elles existent).</p>
|
||||||
<p>(les photos sont normalement automatiquement copiées lors de leur première utilisation, l'usage de cette fonction n'est nécessaire que si les photos du portail ont été modifiées)</p>
|
<p>(les photos sont normalement automatiquement copiées lors de leur première utilisation, l'usage de cette fonction n'est nécessaire que si les photos du portail ont été modifiées)</p>
|
||||||
"""
|
"""
|
||||||
% (groups_infos.groups_titles),
|
% (groups_infos.groups_titles),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=back_url,
|
cancel_url=back_url,
|
||||||
parameters={"group_ids": group_ids},
|
parameters={"group_ids": group_ids},
|
||||||
)
|
)
|
||||||
@ -538,7 +534,7 @@ def photos_import_files_form(context, group_ids=[], REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + "</li></ol>" + F
|
return "\n".join(H) + tf[1] + "</li></ol>" + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(back_url)
|
return flask.redirect(back_url)
|
||||||
else:
|
else:
|
||||||
return photos_import_files(
|
return photos_import_files(
|
||||||
context,
|
context,
|
||||||
@ -566,7 +562,7 @@ def photos_import_files(
|
|||||||
zip_excel_import_files(
|
zip_excel_import_files(
|
||||||
context, xlsfile, zipfile, REQUEST, callback, filename_title, page_title
|
context, xlsfile, zipfile, REQUEST, callback, filename_title, page_title
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(back_url + "&head_message=photos%20 importees")
|
return flask.redirect(back_url + "&head_message=photos%20 importees")
|
||||||
|
|
||||||
|
|
||||||
def zip_excel_import_files(
|
def zip_excel_import_files(
|
||||||
|
@ -108,11 +108,10 @@ def external_ue_create(
|
|||||||
"ects": ects,
|
"ects": ects,
|
||||||
"is_external": 1,
|
"is_external": 1,
|
||||||
},
|
},
|
||||||
REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
matiere_id = sco_edit_matiere.do_matiere_create(
|
matiere_id = sco_edit_matiere.do_matiere_create(
|
||||||
context, {"ue_id": ue_id, "titre": titre or acronyme, "numero": 1}, REQUEST
|
context, {"ue_id": ue_id, "titre": titre or acronyme, "numero": 1}
|
||||||
)
|
)
|
||||||
|
|
||||||
module_id = sco_edit_module.do_module_create(
|
module_id = sco_edit_module.do_module_create(
|
||||||
@ -126,7 +125,6 @@ def external_ue_create(
|
|||||||
"formation_id": formation_id,
|
"formation_id": formation_id,
|
||||||
"semestre_id": sem["semestre_id"],
|
"semestre_id": sem["semestre_id"],
|
||||||
},
|
},
|
||||||
REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
moduleimpl_id = sco_moduleimpl.do_moduleimpl_create(
|
moduleimpl_id = sco_moduleimpl.do_moduleimpl_create(
|
||||||
@ -343,7 +341,7 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + html_footer
|
return "\n".join(H) + "\n" + tf[1] + html_footer
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(bull_url)
|
return flask.redirect(bull_url)
|
||||||
else:
|
else:
|
||||||
note = tf[2]["note"].strip().upper()
|
note = tf[2]["note"].strip().upper()
|
||||||
note_value, invalid = sco_saisie_notes.convert_note_from_string(note, 20.0)
|
note_value, invalid = sco_saisie_notes.convert_note_from_string(note, 20.0)
|
||||||
@ -385,4 +383,4 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
|
|||||||
{etudid: note_value},
|
{etudid: note_value},
|
||||||
REQUEST=REQUEST,
|
REQUEST=REQUEST,
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(bull_url + "&head_message=Ajout%20effectué")
|
return flask.redirect(bull_url + "&head_message=Ajout%20effectué")
|
||||||
|
@ -52,7 +52,7 @@ STRING_TYPES = six.string_types
|
|||||||
|
|
||||||
from PIL import Image as PILImage
|
from PIL import Image as PILImage
|
||||||
|
|
||||||
from flask import g, url_for
|
from flask import g, url_for, request
|
||||||
|
|
||||||
from scodoc_manager import sco_mgr
|
from scodoc_manager import sco_mgr
|
||||||
|
|
||||||
@ -819,7 +819,6 @@ def return_text_if_published(val, REQUEST):
|
|||||||
|
|
||||||
|
|
||||||
def confirm_dialog(
|
def confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Confirmer ?</p>",
|
message="<p>Confirmer ?</p>",
|
||||||
OK="OK",
|
OK="OK",
|
||||||
Cancel="Annuler",
|
Cancel="Annuler",
|
||||||
@ -828,7 +827,6 @@ def confirm_dialog(
|
|||||||
target_variable="dialog_confirmed",
|
target_variable="dialog_confirmed",
|
||||||
parameters={},
|
parameters={},
|
||||||
add_headers=True, # complete page
|
add_headers=True, # complete page
|
||||||
REQUEST=None, # required
|
|
||||||
helpmsg=None,
|
helpmsg=None,
|
||||||
):
|
):
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
@ -838,7 +836,7 @@ def confirm_dialog(
|
|||||||
# Attention: la page a pu etre servie en GET avec des parametres
|
# Attention: la page a pu etre servie en GET avec des parametres
|
||||||
# si on laisse l'url "action" vide, les parametres restent alors que l'on passe en POST...
|
# si on laisse l'url "action" vide, les parametres restent alors que l'on passe en POST...
|
||||||
if not dest_url:
|
if not dest_url:
|
||||||
dest_url = REQUEST.URL
|
dest_url = request.base_url
|
||||||
# strip remaining parameters from destination url:
|
# strip remaining parameters from destination url:
|
||||||
dest_url = six.moves.urllib.parse.splitquery(dest_url)[0]
|
dest_url = six.moves.urllib.parse.splitquery(dest_url)[0]
|
||||||
H = [
|
H = [
|
||||||
@ -866,7 +864,7 @@ def confirm_dialog(
|
|||||||
H.append("</form>")
|
H.append("</form>")
|
||||||
if helpmsg:
|
if helpmsg:
|
||||||
H.append('<p class="help">' + helpmsg + "</p>")
|
H.append('<p class="help">' + helpmsg + "</p>")
|
||||||
if add_headers and REQUEST:
|
if add_headers:
|
||||||
return (
|
return (
|
||||||
html_sco_header.sco_header() + "\n".join(H) + html_sco_header.sco_footer()
|
html_sco_header.sco_header() + "\n".join(H) + html_sco_header.sco_footer()
|
||||||
)
|
)
|
||||||
|
@ -28,23 +28,21 @@
|
|||||||
"""Logging des opérations en base de données
|
"""Logging des opérations en base de données
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from flask import request
|
||||||
|
from flask_login import current_user
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc.notes_log import retreive_request
|
|
||||||
|
|
||||||
|
|
||||||
def logdb(REQUEST=None, cnx=None, method=None, etudid=None, msg=None, commit=True):
|
def logdb(cnx=None, method=None, etudid=None, msg=None, commit=True):
|
||||||
"Add entry"
|
"Add entry"
|
||||||
if not cnx:
|
if not cnx:
|
||||||
raise ValueError("logdb: cnx is None")
|
raise ValueError("logdb: cnx is None")
|
||||||
if not REQUEST:
|
|
||||||
REQUEST = retreive_request(skip=1)
|
|
||||||
if REQUEST:
|
|
||||||
args = {
|
args = {
|
||||||
"authenticated_user": str(REQUEST.AUTHENTICATED_USER),
|
"authenticated_user": current_user.user_name,
|
||||||
"remote_addr": REQUEST.REMOTE_ADDR,
|
"remote_addr": request.remote_addr,
|
||||||
}
|
}
|
||||||
else:
|
|
||||||
args = {"authenticated_user": None, "remote_addr": None}
|
|
||||||
args.update({"method": method, "etudid": etudid, "msg": msg})
|
args.update({"method": method, "etudid": etudid, "msg": msg})
|
||||||
ndb.quote_dict(args)
|
ndb.quote_dict(args)
|
||||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||||
|
@ -1155,7 +1155,7 @@ def AddBilletAbsenceForm(context, etudid, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.ScoURL())
|
return flask.redirect(scu.ScoURL())
|
||||||
else:
|
else:
|
||||||
e = tf[2]["begin"].split("/")
|
e = tf[2]["begin"].split("/")
|
||||||
begin = e[2] + "-" + e[1] + "-" + e[0] + " 00:00:00"
|
begin = e[2] + "-" + e[1] + "-" + e[0] + " 00:00:00"
|
||||||
@ -1172,7 +1172,7 @@ def AddBilletAbsenceForm(context, etudid, REQUEST=None):
|
|||||||
justified=tf[2]["justified"],
|
justified=tf[2]["justified"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect("listeBilletsEtud?etudid=" + etudid)
|
return flask.redirect("listeBilletsEtud?etudid=" + etudid)
|
||||||
|
|
||||||
|
|
||||||
def _tableBillets(context, billets, etud=None, title=""):
|
def _tableBillets(context, billets, etud=None, title=""):
|
||||||
@ -1289,7 +1289,7 @@ def listeBillets(context, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + T + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + T + html_sco_header.sco_footer()
|
||||||
else:
|
else:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"ProcessBilletAbsenceForm?billet_id=" + tf[2]["billet_id"]
|
"ProcessBilletAbsenceForm?billet_id=" + tf[2]["billet_id"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1302,23 +1302,21 @@ def deleteBilletAbsence(context, billet_id, REQUEST=None, dialog_confirmed=False
|
|||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
billets = sco_abs.billet_absence_list(cnx, {"billet_id": billet_id})
|
billets = sco_abs.billet_absence_list(cnx, {"billet_id": billet_id})
|
||||||
if not billets:
|
if not billets:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"listeBillets?head_message=Billet%%20%s%%20inexistant !" % billet_id
|
"listeBillets?head_message=Billet%%20%s%%20inexistant !" % billet_id
|
||||||
)
|
)
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
tab = _tableBillets(context, billets)
|
tab = _tableBillets(context, billets)
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Supprimer ce billet ?</h2>""" + tab.html(),
|
"""<h2>Supprimer ce billet ?</h2>""" + tab.html(),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="listeBillets",
|
cancel_url="listeBillets",
|
||||||
parameters={"billet_id": billet_id},
|
parameters={"billet_id": billet_id},
|
||||||
)
|
)
|
||||||
|
|
||||||
sco_abs.billet_absence_delete(cnx, billet_id)
|
sco_abs.billet_absence_delete(cnx, billet_id)
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect("listeBillets?head_message=Billet%20supprimé")
|
return flask.redirect("listeBillets?head_message=Billet%20supprimé")
|
||||||
|
|
||||||
|
|
||||||
def _ProcessBilletAbsence(context, billet, estjust, description, REQUEST):
|
def _ProcessBilletAbsence(context, billet, estjust, description, REQUEST):
|
||||||
@ -1398,7 +1396,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
|
|||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
billets = sco_abs.billet_absence_list(cnx, {"billet_id": billet_id})
|
billets = sco_abs.billet_absence_list(cnx, {"billet_id": billet_id})
|
||||||
if not billets:
|
if not billets:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"listeBillets?head_message=Billet%%20%s%%20inexistant !" % billet_id
|
"listeBillets?head_message=Billet%%20%s%%20inexistant !" % billet_id
|
||||||
)
|
)
|
||||||
billet = billets[0]
|
billet = billets[0]
|
||||||
@ -1454,7 +1452,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
|
|||||||
|
|
||||||
return "\n".join(H) + "<br/>" + tf[1] + F + html_sco_header.sco_footer()
|
return "\n".join(H) + "<br/>" + tf[1] + F + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.ScoURL())
|
return flask.redirect(scu.ScoURL())
|
||||||
else:
|
else:
|
||||||
n = _ProcessBilletAbsence(
|
n = _ProcessBilletAbsence(
|
||||||
context, billet, tf[2]["estjust"], tf[2]["description"], REQUEST
|
context, billet, tf[2]["estjust"], tf[2]["description"], REQUEST
|
||||||
|
@ -551,7 +551,7 @@ def entreprise_contact_edit(context, entreprise_contact_id, REQUEST=None):
|
|||||||
% entreprise_contact_id
|
% entreprise_contact_id
|
||||||
)
|
)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context))
|
return flask.redirect(scu.EntreprisesURL(context))
|
||||||
else:
|
else:
|
||||||
etudok = sco_entreprises.do_entreprise_check_etudiant(
|
etudok = sco_entreprises.do_entreprise_check_etudiant(
|
||||||
context, tf[2]["etudiant"]
|
context, tf[2]["etudiant"]
|
||||||
@ -561,7 +561,7 @@ def entreprise_contact_edit(context, entreprise_contact_id, REQUEST=None):
|
|||||||
else:
|
else:
|
||||||
tf[2].update({"etudid": etudok[1]})
|
tf[2].update({"etudid": etudok[1]})
|
||||||
sco_entreprises.do_entreprise_contact_edit(context, tf[2])
|
sco_entreprises.do_entreprise_contact_edit(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.EntreprisesURL(context, )
|
scu.EntreprisesURL(context, )
|
||||||
+ "/entreprise_contact_list?entreprise_id="
|
+ "/entreprise_contact_list?entreprise_id="
|
||||||
+ str(c["entreprise_id"])
|
+ str(c["entreprise_id"])
|
||||||
@ -671,13 +671,13 @@ def entreprise_correspondant_edit(context, entreprise_corresp_id, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"%s/entreprise_correspondant_list?entreprise_id=%s"
|
"%s/entreprise_correspondant_list?entreprise_id=%s"
|
||||||
% (scu.EntreprisesURL(context, ), c["entreprise_id"])
|
% (scu.EntreprisesURL(context, ), c["entreprise_id"])
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_correspondant_edit(context, tf[2])
|
sco_entreprises.do_entreprise_correspondant_edit(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"%s/entreprise_correspondant_list?entreprise_id=%s"
|
"%s/entreprise_correspondant_list?entreprise_id=%s"
|
||||||
% (scu.EntreprisesURL(context, ), c["entreprise_id"])
|
% (scu.EntreprisesURL(context, ), c["entreprise_id"])
|
||||||
)
|
)
|
||||||
@ -782,7 +782,7 @@ def entreprise_contact_create(context, entreprise_id, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context))
|
return flask.redirect(scu.EntreprisesURL(context))
|
||||||
else:
|
else:
|
||||||
etudok = sco_entreprises.do_entreprise_check_etudiant(
|
etudok = sco_entreprises.do_entreprise_check_etudiant(
|
||||||
context, tf[2]["etudiant"]
|
context, tf[2]["etudiant"]
|
||||||
@ -792,7 +792,7 @@ def entreprise_contact_create(context, entreprise_id, REQUEST=None):
|
|||||||
else:
|
else:
|
||||||
tf[2].update({"etudid": etudok[1]})
|
tf[2].update({"etudid": etudok[1]})
|
||||||
sco_entreprises.do_entreprise_contact_create(context, tf[2])
|
sco_entreprises.do_entreprise_contact_create(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
H.append(entreprise_footer(context, REQUEST))
|
H.append(entreprise_footer(context, REQUEST))
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
@ -823,12 +823,12 @@ def entreprise_contact_delete(context, entreprise_contact_id, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context))
|
return flask.redirect(scu.EntreprisesURL(context))
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_contact_delete(
|
sco_entreprises.do_entreprise_contact_delete(
|
||||||
context, c["entreprise_contact_id"]
|
context, c["entreprise_contact_id"]
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context))
|
return flask.redirect(scu.EntreprisesURL(context))
|
||||||
H.append(entreprise_footer(context, REQUEST))
|
H.append(entreprise_footer(context, REQUEST))
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
@ -932,10 +932,10 @@ def entreprise_correspondant_create(context, entreprise_id, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context))
|
return flask.redirect(scu.EntreprisesURL(context))
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_correspondant_create(context, tf[2])
|
sco_entreprises.do_entreprise_correspondant_create(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context))
|
return flask.redirect(scu.EntreprisesURL(context))
|
||||||
H.append(entreprise_footer(context, REQUEST))
|
H.append(entreprise_footer(context, REQUEST))
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
@ -966,12 +966,12 @@ def entreprise_correspondant_delete(context, entreprise_corresp_id, REQUEST=None
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_correspondant_delete(
|
sco_entreprises.do_entreprise_correspondant_delete(
|
||||||
context, c["entreprise_corresp_id"]
|
context, c["entreprise_corresp_id"]
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
H.append(entreprise_footer(context, REQUEST))
|
H.append(entreprise_footer(context, REQUEST))
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
@ -1026,10 +1026,10 @@ def entreprise_delete(context, entreprise_id, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
H.append(tf[1])
|
H.append(tf[1])
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_delete(context, E["entreprise_id"])
|
sco_entreprises.do_entreprise_delete(context, E["entreprise_id"])
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
H.append(entreprise_footer(context, REQUEST))
|
H.append(entreprise_footer(context, REQUEST))
|
||||||
return "\n".join(H)
|
return "\n".join(H)
|
||||||
|
|
||||||
@ -1123,10 +1123,10 @@ def entreprise_create(context, REQUEST=None):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + entreprise_footer(context, REQUEST)
|
return "\n".join(H) + tf[1] + entreprise_footer(context, REQUEST)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_create(context, tf[2])
|
sco_entreprises.do_entreprise_create(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ))
|
return flask.redirect(scu.EntreprisesURL(context, ))
|
||||||
|
|
||||||
|
|
||||||
security.declareProtected(ScoEntrepriseView, "entreprise_edit")
|
security.declareProtected(ScoEntrepriseView, "entreprise_edit")
|
||||||
@ -1298,7 +1298,7 @@ def entreprise_edit(context, entreprise_id, REQUEST=None, start=1):
|
|||||||
H.append("</ul>")
|
H.append("</ul>")
|
||||||
return "\n".join(H) + entreprise_footer(context, REQUEST)
|
return "\n".join(H) + entreprise_footer(context, REQUEST)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ) + "?start=" + start)
|
return flask.redirect(scu.EntreprisesURL(context, ) + "?start=" + start)
|
||||||
else:
|
else:
|
||||||
sco_entreprises.do_entreprise_edit(context, tf[2])
|
sco_entreprises.do_entreprise_edit(context, tf[2])
|
||||||
return REQUEST.RESPONSE.redirect(scu.EntreprisesURL(context, ) + "?start=" + start)
|
return flask.redirect(scu.EntreprisesURL(context, ) + "?start=" + start)
|
||||||
|
@ -479,7 +479,7 @@ def formation_import_xml_form(context, REQUEST):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + footer
|
return "\n".join(H) + tf[1] + footer
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.NotesURL())
|
return flask.redirect(scu.NotesURL())
|
||||||
else:
|
else:
|
||||||
formation_id, _, _ = sco_formations.formation_import_xml(
|
formation_id, _, _ = sco_formations.formation_import_xml(
|
||||||
context, tf[2]["xmlfile"], REQUEST
|
context, tf[2]["xmlfile"], REQUEST
|
||||||
@ -742,9 +742,7 @@ def edit_enseignants_form(context, REQUEST, moduleimpl_id):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return header + "\n".join(H) + tf[1] + F + footer
|
return header + "\n".join(H) + tf[1] + F + footer
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
|
||||||
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
ens_id = User.get_user_name_from_nomplogin(tf[2]["ens_id"])
|
ens_id = User.get_user_name_from_nomplogin(tf[2]["ens_id"])
|
||||||
if not ens_id:
|
if not ens_id:
|
||||||
@ -764,7 +762,7 @@ def edit_enseignants_form(context, REQUEST, moduleimpl_id):
|
|||||||
sco_moduleimpl.do_ens_create(
|
sco_moduleimpl.do_ens_create(
|
||||||
context, {"moduleimpl_id": moduleimpl_id, "ens_id": ens_id}
|
context, {"moduleimpl_id": moduleimpl_id, "ens_id": ens_id}
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"edit_enseignants_form?moduleimpl_id=%s" % moduleimpl_id
|
"edit_enseignants_form?moduleimpl_id=%s" % moduleimpl_id
|
||||||
)
|
)
|
||||||
return header + "\n".join(H) + tf[1] + F + footer
|
return header + "\n".join(H) + tf[1] + F + footer
|
||||||
@ -836,23 +834,19 @@ def edit_moduleimpl_resp(context, REQUEST, moduleimpl_id):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + help_str + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + help_str + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
|
||||||
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
responsable_id = User.get_user_name_from_nomplogin(tf[2]["responsable_id"])
|
responsable_id = User.get_user_name_from_nomplogin(tf[2]["responsable_id"])
|
||||||
if (
|
if (
|
||||||
not responsable_id
|
not responsable_id
|
||||||
): # presque impossible: tf verifie les valeurs (mais qui peuvent changer entre temps)
|
): # presque impossible: tf verifie les valeurs (mais qui peuvent changer entre temps)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
|
||||||
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id
|
|
||||||
)
|
|
||||||
sco_moduleimpl.do_moduleimpl_edit(
|
sco_moduleimpl.do_moduleimpl_edit(
|
||||||
context,
|
context,
|
||||||
{"moduleimpl_id": moduleimpl_id, "responsable_id": responsable_id},
|
{"moduleimpl_id": moduleimpl_id, "responsable_id": responsable_id},
|
||||||
formsemestre_id=sem["formsemestre_id"],
|
formsemestre_id=sem["formsemestre_id"],
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"moduleimpl_status?moduleimpl_id="
|
"moduleimpl_status?moduleimpl_id="
|
||||||
+ moduleimpl_id
|
+ moduleimpl_id
|
||||||
+ "&head_message=responsable%20modifié"
|
+ "&head_message=responsable%20modifié"
|
||||||
@ -929,9 +923,7 @@ def edit_moduleimpl_expr(context, REQUEST, moduleimpl_id):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("moduleimpl_status?moduleimpl_id=" + moduleimpl_id)
|
||||||
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
sco_moduleimpl.do_moduleimpl_edit(
|
sco_moduleimpl.do_moduleimpl_edit(
|
||||||
context,
|
context,
|
||||||
@ -944,7 +936,7 @@ def edit_moduleimpl_expr(context, REQUEST, moduleimpl_id):
|
|||||||
sco_cache.invalidate_formsemestre(
|
sco_cache.invalidate_formsemestre(
|
||||||
formsemestre_id=sem["formsemestre_id"]
|
formsemestre_id=sem["formsemestre_id"]
|
||||||
) # > modif regle calcul
|
) # > modif regle calcul
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"moduleimpl_status?moduleimpl_id="
|
"moduleimpl_status?moduleimpl_id="
|
||||||
+ moduleimpl_id
|
+ moduleimpl_id
|
||||||
+ "&head_message=règle%20de%20calcul%20modifiée"
|
+ "&head_message=règle%20de%20calcul%20modifiée"
|
||||||
@ -1085,9 +1077,7 @@ def edit_ue_expr(context, REQUEST, formsemestre_id, ue_id):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("formsemestre_status?formsemestre_id=" + formsemestre_id)
|
||||||
"formsemestre_status?formsemestre_id=" + formsemestre_id
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
if el:
|
if el:
|
||||||
el[0]["computation_expr"] = tf[2]["computation_expr"]
|
el[0]["computation_expr"] = tf[2]["computation_expr"]
|
||||||
@ -1098,7 +1088,7 @@ def edit_ue_expr(context, REQUEST, formsemestre_id, ue_id):
|
|||||||
sco_cache.invalidate_formsemestre(
|
sco_cache.invalidate_formsemestre(
|
||||||
formsemestre_id=formsemestre_id
|
formsemestre_id=formsemestre_id
|
||||||
) # > modif regle calcul
|
) # > modif regle calcul
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"formsemestre_status?formsemestre_id="
|
"formsemestre_status?formsemestre_id="
|
||||||
+ formsemestre_id
|
+ formsemestre_id
|
||||||
+ "&head_message=règle%20de%20calcul%20modifiée"
|
+ "&head_message=règle%20de%20calcul%20modifiée"
|
||||||
@ -1204,9 +1194,7 @@ def edit_enseignants_form_delete(context, REQUEST, moduleimpl_id, ens_id):
|
|||||||
if not ok:
|
if not ok:
|
||||||
raise ScoValueError("invalid ens_id (%s)" % ens_id)
|
raise ScoValueError("invalid ens_id (%s)" % ens_id)
|
||||||
sco_moduleimpl.do_ens_delete(context, ens["modules_enseignants_id"])
|
sco_moduleimpl.do_ens_delete(context, ens["modules_enseignants_id"])
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect("edit_enseignants_form?moduleimpl_id=%s" % moduleimpl_id)
|
||||||
"edit_enseignants_form?moduleimpl_id=%s" % moduleimpl_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# --- Gestion des inscriptions aux semestres
|
# --- Gestion des inscriptions aux semestres
|
||||||
@ -1304,10 +1292,8 @@ def formsemestre_desinscription(
|
|||||||
</p>
|
</p>
|
||||||
"""
|
"""
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la demande de desinscription ?</h2>""" + msg_ext,
|
"""<h2>Confirmer la demande de desinscription ?</h2>""" + msg_ext,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
|
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
@ -1339,7 +1325,7 @@ def etud_desinscrit_ue(context, etudid, formsemestre_id, ue_id, REQUEST=None):
|
|||||||
sco_moduleimpl_inscriptions.do_etud_desinscrit_ue(
|
sco_moduleimpl_inscriptions.do_etud_desinscrit_ue(
|
||||||
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL()
|
scu.ScoURL()
|
||||||
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
||||||
+ formsemestre_id
|
+ formsemestre_id
|
||||||
@ -1354,7 +1340,7 @@ def etud_inscrit_ue(context, etudid, formsemestre_id, ue_id, REQUEST=None):
|
|||||||
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(
|
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(
|
||||||
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL()
|
scu.ScoURL()
|
||||||
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
||||||
+ formsemestre_id
|
+ formsemestre_id
|
||||||
@ -1465,7 +1451,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL()
|
scu.ScoURL()
|
||||||
+ "/Notes/moduleimpl_status?moduleimpl_id="
|
+ "/Notes/moduleimpl_status?moduleimpl_id="
|
||||||
+ E["moduleimpl_id"]
|
+ E["moduleimpl_id"]
|
||||||
@ -1725,10 +1711,8 @@ def formsemestre_bulletins_mailetuds(
|
|||||||
# Confirmation dialog
|
# Confirmation dialog
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<h2>Envoyer les %d bulletins par e-mail aux étudiants ?" % len(etudids),
|
"<h2>Envoyer les %d bulletins par e-mail aux étudiants ?" % len(etudids),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
cancel_url="formsemestre_status?formsemestre_id=%s" % formsemestre_id,
|
||||||
parameters={
|
parameters={
|
||||||
"version": version,
|
"version": version,
|
||||||
@ -1810,8 +1794,8 @@ def appreciation_add_form(
|
|||||||
)
|
)
|
||||||
if suppress:
|
if suppress:
|
||||||
sco_etud.appreciations_delete(cnx, id)
|
sco_etud.appreciations_delete(cnx, id)
|
||||||
logdb(REQUEST, cnx, method="appreciation_suppress", etudid=etudid, msg="")
|
logdb(cnx, method="appreciation_suppress", etudid=etudid, msg="")
|
||||||
return REQUEST.RESPONSE.redirect(bull_url)
|
return flask.redirect(bull_url)
|
||||||
#
|
#
|
||||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
|
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
|
||||||
if id:
|
if id:
|
||||||
@ -1849,7 +1833,7 @@ def appreciation_add_form(
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + F
|
return "\n".join(H) + "\n" + tf[1] + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(bull_url)
|
return flask.redirect(bull_url)
|
||||||
else:
|
else:
|
||||||
args = {
|
args = {
|
||||||
"etudid": etudid,
|
"etudid": etudid,
|
||||||
@ -1866,7 +1850,6 @@ def appreciation_add_form(
|
|||||||
sco_etud.appreciations_create(cnx, args, has_uniq_values=False)
|
sco_etud.appreciations_create(cnx, args, has_uniq_values=False)
|
||||||
# log
|
# log
|
||||||
logdb(
|
logdb(
|
||||||
REQUEST,
|
|
||||||
cnx,
|
cnx,
|
||||||
method="appreciation_add",
|
method="appreciation_add",
|
||||||
etudid=etudid,
|
etudid=etudid,
|
||||||
@ -1876,7 +1859,7 @@ def appreciation_add_form(
|
|||||||
sco_cache.invalidate_formsemestre(
|
sco_cache.invalidate_formsemestre(
|
||||||
pdfonly=True, formsemestre_id=formsemestre_id
|
pdfonly=True, formsemestre_id=formsemestre_id
|
||||||
) # > appreciation_add
|
) # > appreciation_add
|
||||||
return REQUEST.RESPONSE.redirect(bull_url)
|
return flask.redirect(bull_url)
|
||||||
|
|
||||||
|
|
||||||
# --- FORMULAIRE POUR VALIDATION DES UE ET SEMESTRES
|
# --- FORMULAIRE POUR VALIDATION DES UE ET SEMESTRES
|
||||||
@ -1925,11 +1908,9 @@ def formsemestre_validation_etud(
|
|||||||
"Enregistre choix jury pour un étudiant"
|
"Enregistre choix jury pour un étudiant"
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return sco_formsemestre_validation.formsemestre_validation_etud(
|
return sco_formsemestre_validation.formsemestre_validation_etud(
|
||||||
@ -1961,11 +1942,9 @@ def formsemestre_validation_etud_manu(
|
|||||||
"Enregistre choix jury pour un étudiant"
|
"Enregistre choix jury pour un étudiant"
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return sco_formsemestre_validation.formsemestre_validation_etud_manu(
|
return sco_formsemestre_validation.formsemestre_validation_etud_manu(
|
||||||
@ -1991,11 +1970,9 @@ def formsemestre_validate_previous_ue(
|
|||||||
"Form. saisie UE validée hors ScoDoc "
|
"Form. saisie UE validée hors ScoDoc "
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
return sco_formsemestre_validation.formsemestre_validate_previous_ue(
|
return sco_formsemestre_validation.formsemestre_validate_previous_ue(
|
||||||
context, formsemestre_id, etudid, REQUEST=REQUEST
|
context, formsemestre_id, etudid, REQUEST=REQUEST
|
||||||
@ -2019,11 +1996,9 @@ def formsemestre_ext_edit_ue_validations(
|
|||||||
"Form. edition UE semestre extérieur"
|
"Form. edition UE semestre extérieur"
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
return sco_formsemestre_exterieurs.formsemestre_ext_edit_ue_validations(
|
return sco_formsemestre_exterieurs.formsemestre_ext_edit_ue_validations(
|
||||||
context, formsemestre_id, etudid, REQUEST=REQUEST
|
context, formsemestre_id, etudid, REQUEST=REQUEST
|
||||||
@ -2044,11 +2019,9 @@ def etud_ue_suppress_validation(context, etudid, formsemestre_id, ue_id, REQUEST
|
|||||||
"""Suppress a validation (ue_id, etudid) and redirect to formsemestre"""
|
"""Suppress a validation (ue_id, etudid) and redirect to formsemestre"""
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
return sco_formsemestre_validation.etud_ue_suppress_validation(
|
return sco_formsemestre_validation.etud_ue_suppress_validation(
|
||||||
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
||||||
@ -2062,11 +2035,9 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
|
|||||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return sco_formsemestre_validation.formsemestre_validation_auto(
|
return sco_formsemestre_validation.formsemestre_validation_auto(
|
||||||
@ -2081,11 +2052,9 @@ def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
|
|||||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return sco_formsemestre_validation.do_formsemestre_validation_auto(
|
return sco_formsemestre_validation.do_formsemestre_validation_auto(
|
||||||
@ -2102,11 +2071,9 @@ def formsemestre_validation_suppress_etud(
|
|||||||
"""Suppression des decisions de jury pour un etudiant."""
|
"""Suppression des decisions de jury pour un etudiant."""
|
||||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
message="<p>Opération non autorisée pour %s</h2>"
|
message="<p>Opération non autorisée pour %s</h2>"
|
||||||
% REQUEST.AUTHENTICATED_USER,
|
% REQUEST.AUTHENTICATED_USER,
|
||||||
dest_url=scu.ScoURL(),
|
dest_url=scu.ScoURL(),
|
||||||
REQUEST=REQUEST,
|
|
||||||
)
|
)
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||||
@ -2120,7 +2087,6 @@ def formsemestre_validation_suppress_etud(
|
|||||||
else:
|
else:
|
||||||
existing = ""
|
existing = ""
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression des décisions du semestre %s (%s - %s) pour %s ?</h2>%s
|
"""<h2>Confirmer la suppression des décisions du semestre %s (%s - %s) pour %s ?</h2>%s
|
||||||
<p>Cette opération est irréversible.
|
<p>Cette opération est irréversible.
|
||||||
</p>
|
</p>
|
||||||
@ -2134,7 +2100,6 @@ def formsemestre_validation_suppress_etud(
|
|||||||
),
|
),
|
||||||
OK="Supprimer",
|
OK="Supprimer",
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url="formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s"
|
cancel_url="formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s"
|
||||||
% (formsemestre_id, etudid),
|
% (formsemestre_id, etudid),
|
||||||
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
|
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
|
||||||
@ -2143,7 +2108,7 @@ def formsemestre_validation_suppress_etud(
|
|||||||
sco_formsemestre_validation.formsemestre_validation_suppress_etud(
|
sco_formsemestre_validation.formsemestre_validation_suppress_etud(
|
||||||
context, formsemestre_id, etudid
|
context, formsemestre_id, etudid
|
||||||
)
|
)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL()
|
scu.ScoURL()
|
||||||
+ "/Notes/formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&head_message=Décision%%20supprimée"
|
+ "/Notes/formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&head_message=Décision%%20supprimée"
|
||||||
% (formsemestre_id, etudid)
|
% (formsemestre_id, etudid)
|
||||||
|
@ -505,8 +505,8 @@ def doAddAnnotation(context, etudid, comment, REQUEST):
|
|||||||
"zope_remote_addr": REQUEST.REMOTE_ADDR,
|
"zope_remote_addr": REQUEST.REMOTE_ADDR,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
logdb(REQUEST, cnx, method="addAnnotation", etudid=etudid)
|
logdb(cnx, method="addAnnotation", etudid=etudid)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -525,10 +525,10 @@ def doSuppressAnnotation(context, etudid, annotation_id, REQUEST):
|
|||||||
raise ScoValueError("annotation inexistante !")
|
raise ScoValueError("annotation inexistante !")
|
||||||
anno = annos[0]
|
anno = annos[0]
|
||||||
log("suppress annotation: %s" % str(anno))
|
log("suppress annotation: %s" % str(anno))
|
||||||
logdb(REQUEST, cnx, method="SuppressAnnotation", etudid=etudid)
|
logdb(cnx, method="SuppressAnnotation", etudid=etudid)
|
||||||
sco_etud.etud_annotations_delete(cnx, annotation_id)
|
sco_etud.etud_annotations_delete(cnx, annotation_id)
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for(
|
url_for(
|
||||||
"scolar.ficheEtud",
|
"scolar.ficheEtud",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
@ -598,14 +598,14 @@ def formChangeCoordonnees(context, etudid, REQUEST):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
if adrs:
|
if adrs:
|
||||||
sco_etud.adresse_edit(cnx, args=tf[2], context=context)
|
sco_etud.adresse_edit(cnx, args=tf[2], context=context)
|
||||||
else:
|
else:
|
||||||
sco_etud.adresse_create(cnx, args=tf[2])
|
sco_etud.adresse_create(cnx, args=tf[2])
|
||||||
logdb(REQUEST, cnx, method="changeCoordonnees", etudid=etudid)
|
logdb(cnx, method="changeCoordonnees", etudid=etudid)
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
|
|
||||||
|
|
||||||
# --- Gestion des groupes:
|
# --- Gestion des groupes:
|
||||||
@ -776,12 +776,12 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
|
|||||||
+ html_sco_header.sco_footer()
|
+ html_sco_header.sco_footer()
|
||||||
)
|
)
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
data = tf[2]["photofile"].read()
|
data = tf[2]["photofile"].read()
|
||||||
status, diag = sco_photos.store_photo(context, etud, data, REQUEST=REQUEST)
|
status, diag = sco_photos.store_photo(context, etud, data, REQUEST=REQUEST)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
H.append('<p class="warning">Erreur:' + diag + "</p>")
|
H.append('<p class="warning">Erreur:' + diag + "</p>")
|
||||||
return "\n".join(H) + html_sco_header.sco_footer()
|
return "\n".join(H) + html_sco_header.sco_footer()
|
||||||
@ -795,10 +795,8 @@ def formSuppressPhoto(context, etudid=None, REQUEST=None, dialog_confirmed=False
|
|||||||
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
|
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<p>Confirmer la suppression de la photo de %(nomprenom)s ?</p>" % etud,
|
"<p>Confirmer la suppression de la photo de %(nomprenom)s ?</p>" % etud,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=url_for(
|
cancel_url=url_for(
|
||||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
|
||||||
),
|
),
|
||||||
@ -807,7 +805,7 @@ def formSuppressPhoto(context, etudid=None, REQUEST=None, dialog_confirmed=False
|
|||||||
|
|
||||||
sco_photos.suppress_photo(context, etud, REQUEST=REQUEST)
|
sco_photos.suppress_photo(context, etud, REQUEST=REQUEST)
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -951,7 +949,7 @@ def _do_dem_or_def_etud(
|
|||||||
sco_formsemestre_inscriptions.do_formsemestre_inscription_edit(
|
sco_formsemestre_inscriptions.do_formsemestre_inscription_edit(
|
||||||
context, args=ins, formsemestre_id=formsemestre_id
|
context, args=ins, formsemestre_id=formsemestre_id
|
||||||
)
|
)
|
||||||
logdb(REQUEST, cnx, method=operation_method, etudid=etudid)
|
logdb(cnx, method=operation_method, etudid=etudid)
|
||||||
sco_etud.scolar_events_create(
|
sco_etud.scolar_events_create(
|
||||||
cnx,
|
cnx,
|
||||||
args={
|
args={
|
||||||
@ -962,7 +960,7 @@ def _do_dem_or_def_etud(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
if REQUEST:
|
if REQUEST:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1042,10 +1040,8 @@ def _do_cancel_dem_or_def(
|
|||||||
raise ScoValueError("etudiant non inscrit ???")
|
raise ScoValueError("etudiant non inscrit ???")
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"<p>Confirmer l'annulation de la %s ?</p>" % operation_name,
|
"<p>Confirmer l'annulation de la %s ?</p>" % operation_name,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=url_for(
|
cancel_url=url_for(
|
||||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
|
||||||
),
|
),
|
||||||
@ -1062,7 +1058,7 @@ def _do_cancel_dem_or_def(
|
|||||||
sco_formsemestre_inscriptions.do_formsemestre_inscription_edit(
|
sco_formsemestre_inscriptions.do_formsemestre_inscription_edit(
|
||||||
context, args=ins, formsemestre_id=formsemestre_id
|
context, args=ins, formsemestre_id=formsemestre_id
|
||||||
)
|
)
|
||||||
logdb(REQUEST, cnx, method=operation_method, etudid=etudid)
|
logdb(cnx, method=operation_method, etudid=etudid)
|
||||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"delete from scolar_events where etudid=%(etudid)s and formsemestre_id=%(formsemestre_id)s and event_type='"
|
"delete from scolar_events where etudid=%(etudid)s and formsemestre_id=%(formsemestre_id)s and event_type='"
|
||||||
@ -1071,7 +1067,7 @@ def _do_cancel_dem_or_def(
|
|||||||
{"etudid": etudid, "formsemestre_id": formsemestre_id},
|
{"etudid": etudid, "formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
cnx.commit()
|
cnx.commit()
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1487,7 +1483,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
|
|||||||
formsemestre_id=formsemestre_id
|
formsemestre_id=formsemestre_id
|
||||||
) # > etudident_create_or_edit
|
) # > etudident_create_or_edit
|
||||||
#
|
#
|
||||||
return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid)
|
return flask.redirect("ficheEtud?etudid=" + etudid)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/etudident_delete", methods=["GET", "POST"])
|
@bp.route("/etudident_delete", methods=["GET", "POST"])
|
||||||
@ -1504,7 +1500,6 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
|
|||||||
sco_etud.fill_etuds_info([etud])
|
sco_etud.fill_etuds_info([etud])
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression de l'étudiant <b>{e[nomprenom]}</b> ?</h2>
|
"""<h2>Confirmer la suppression de l'étudiant <b>{e[nomprenom]}</b> ?</h2>
|
||||||
</p>
|
</p>
|
||||||
<p style="top-margin: 2ex; bottom-margin: 2ex;">Prenez le temps de vérifier
|
<p style="top-margin: 2ex; bottom-margin: 2ex;">Prenez le temps de vérifier
|
||||||
@ -1525,7 +1520,6 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=url_for(
|
cancel_url=url_for(
|
||||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
|
||||||
),
|
),
|
||||||
@ -1561,9 +1555,7 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
|
|||||||
to_inval = [s["formsemestre_id"] for s in etud["sems"]]
|
to_inval = [s["formsemestre_id"] for s in etud["sems"]]
|
||||||
for formsemestre_id in to_inval:
|
for formsemestre_id in to_inval:
|
||||||
sco_cache.invalidate_formsemestre(formsemestre_id=formsemestre_id) # >
|
sco_cache.invalidate_formsemestre(formsemestre_id=formsemestre_id) # >
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(scu.ScoURL() + r"?head_message=Etudiant%20supprimé")
|
||||||
scu.ScoURL() + r"?head_message=Etudiant%20supprimé"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/check_group_apogee")
|
@bp.route("/check_group_apogee")
|
||||||
@ -1845,7 +1837,7 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + "</li></ol>" + "\n".join(S) + F
|
return "\n".join(H) + tf[1] + "</li></ol>" + "\n".join(S) + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(dest_url)
|
return flask.redirect(dest_url)
|
||||||
else:
|
else:
|
||||||
return sco_import_etuds.students_import_excel(
|
return sco_import_etuds.students_import_excel(
|
||||||
context,
|
context,
|
||||||
@ -1985,7 +1977,7 @@ def form_students_import_infos_admissions(context, REQUEST, formsemestre_id=None
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + tf[1] + help_text + F
|
return "\n".join(H) + tf[1] + help_text + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
scu.ScoURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
|
scu.ScoURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -336,7 +336,7 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
|
|||||||
if tf[0] == 0:
|
if tf[0] == 0:
|
||||||
return "\n".join(H) + "\n" + tf[1] + F
|
return "\n".join(H) + "\n" + tf[1] + F
|
||||||
elif tf[0] == -1:
|
elif tf[0] == -1:
|
||||||
return REQUEST.RESPONSE.redirect(scu.UsersURL())
|
return flask.redirect(scu.UsersURL())
|
||||||
else:
|
else:
|
||||||
vals = tf[2]
|
vals = tf[2]
|
||||||
roles = set(vals["roles"]).intersection(editable_roles_strings)
|
roles = set(vals["roles"]).intersection(editable_roles_strings)
|
||||||
@ -417,7 +417,7 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
|
|||||||
log("sco_users: previous_values=%s" % initvalues)
|
log("sco_users: previous_values=%s" % initvalues)
|
||||||
log("sco_users: new_values=%s" % vals)
|
log("sco_users: new_values=%s" % vals)
|
||||||
sco_users.user_edit(user_name, vals)
|
sco_users.user_edit(user_name, vals)
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"user_info_page?user_name=%s&head_message=Utilisateur %s modifié"
|
"user_info_page?user_name=%s&head_message=Utilisateur %s modifié"
|
||||||
% (user_name, user_name)
|
% (user_name, user_name)
|
||||||
)
|
)
|
||||||
@ -449,7 +449,7 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
|
|||||||
u.from_dict(vals, new_user=True)
|
u.from_dict(vals, new_user=True)
|
||||||
db.session.add(u)
|
db.session.add(u)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(
|
||||||
"user_info_page?user_name=%s&head_message=Nouvel utilisateur créé"
|
"user_info_page?user_name=%s&head_message=Nouvel utilisateur créé"
|
||||||
% (user_name)
|
% (user_name)
|
||||||
)
|
)
|
||||||
@ -605,7 +605,6 @@ def delete_user_form(REQUEST, user_name, dialog_confirmed=False):
|
|||||||
)
|
)
|
||||||
if not dialog_confirmed:
|
if not dialog_confirmed:
|
||||||
return scu.confirm_dialog(
|
return scu.confirm_dialog(
|
||||||
context,
|
|
||||||
"""<h2>Confirmer la suppression de l\'utilisateur %s ?</h2>
|
"""<h2>Confirmer la suppression de l\'utilisateur %s ?</h2>
|
||||||
<p class="warning">En général, il est <b>déconseillé de supprimer un utilisateur</b>, son
|
<p class="warning">En général, il est <b>déconseillé de supprimer un utilisateur</b>, son
|
||||||
identité étant référencé dans les modules de formation. N'utilisez
|
identité étant référencé dans les modules de formation. N'utilisez
|
||||||
@ -614,7 +613,6 @@ def delete_user_form(REQUEST, user_name, dialog_confirmed=False):
|
|||||||
"""
|
"""
|
||||||
% user_name,
|
% user_name,
|
||||||
dest_url="",
|
dest_url="",
|
||||||
REQUEST=REQUEST,
|
|
||||||
cancel_url=scu.UsersURL(),
|
cancel_url=scu.UsersURL(),
|
||||||
parameters={"user_name": user_name},
|
parameters={"user_name": user_name},
|
||||||
)
|
)
|
||||||
@ -622,6 +620,4 @@ def delete_user_form(REQUEST, user_name, dialog_confirmed=False):
|
|||||||
db.session.delete(u)
|
db.session.delete(u)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return REQUEST.RESPONSE.redirect(
|
return flask.redirect(scu.UsersURL() + r"?head_message=Utilisateur%20supprimé")
|
||||||
scu.UsersURL() + r"?head_message=Utilisateur%20supprimé"
|
|
||||||
)
|
|
||||||
|
@ -19,6 +19,7 @@ Fonction de l'API utilisé :
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
|
|
||||||
# La variable context est définie par le script de lancement
|
# La variable context est définie par le script de lancement
|
||||||
# l'affecte ainsi pour évietr les warnins pylint:
|
# l'affecte ainsi pour évietr les warnins pylint:
|
||||||
context = context # pylint: disable=undefined-variable
|
context = context # pylint: disable=undefined-variable
|
||||||
@ -104,7 +105,6 @@ e2 = G.create_evaluation(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# création d'éval avec evaluation_create
|
# création d'éval avec evaluation_create
|
||||||
# e3 = context.Notes.evaluation_create(mi["moduleimpl_id"], REQUEST)
|
# e3 = context.Notes.evaluation_create(mi["moduleimpl_id"], REQUEST)
|
||||||
# e4 = context.Notes.evaluation_create(mi2["moduleimpl_id"], REQUEST) # rien ne se passe
|
# e4 = context.Notes.evaluation_create(mi2["moduleimpl_id"], REQUEST) # rien ne se passe
|
||||||
@ -118,7 +118,7 @@ e5 = context.Notes.do_evaluation_create(
|
|||||||
description="evaluation test 5",
|
description="evaluation test 5",
|
||||||
note_max="20.0",
|
note_max="20.0",
|
||||||
coefficient="1",
|
coefficient="1",
|
||||||
REQUEST=REQUEST
|
REQUEST=REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
e6 = context.Notes.do_evaluation_create(
|
e6 = context.Notes.do_evaluation_create(
|
||||||
@ -129,14 +129,15 @@ e6 = context.Notes.do_evaluation_create(
|
|||||||
description="evaluation test 6",
|
description="evaluation test 6",
|
||||||
note_max="20.0",
|
note_max="20.0",
|
||||||
coefficient="1",
|
coefficient="1",
|
||||||
REQUEST=REQUEST
|
REQUEST=REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# --- Liste des évaluations dans le semestre
|
# --- Liste des évaluations dans le semestre
|
||||||
|
|
||||||
lie = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem["formsemestre_id"])
|
lie = context.Notes.do_evaluation_list_in_formsemestre(
|
||||||
|
formsemestre_id=sem["formsemestre_id"]
|
||||||
|
)
|
||||||
assert len(lie) == 4
|
assert len(lie) == 4
|
||||||
""" print(lie[0])
|
""" print(lie[0])
|
||||||
print(" ")
|
print(" ")
|
||||||
@ -190,21 +191,34 @@ for eval in evals :
|
|||||||
|
|
||||||
# --- Check abs
|
# --- Check abs
|
||||||
|
|
||||||
check = sco_liste_notes.evaluation_check_absences(context.Notes, evaluation_id=e["evaluation_id"])
|
check = sco_liste_notes.evaluation_check_absences(
|
||||||
|
context.Notes, evaluation_id=e["evaluation_id"]
|
||||||
|
)
|
||||||
|
|
||||||
check2 = sco_liste_notes.evaluation_check_absences(context.Notes, evaluation_id=e2["evaluation_id"])
|
check2 = sco_liste_notes.evaluation_check_absences(
|
||||||
|
context.Notes, evaluation_id=e2["evaluation_id"]
|
||||||
|
)
|
||||||
|
|
||||||
# --- Liste de note d'une évaluation
|
# --- Liste de note d'une évaluation
|
||||||
|
|
||||||
# lien = sco_liste_notes.do_evaluation_listenotes(context=context.Notes, REQUEST=REQUEST)
|
# 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)
|
cal = sco_evaluations.formsemestre_evaluations_cal(
|
||||||
|
context.Notes, formsemestre_id=sem["formsemestre_id"], REQUEST=REQUEST
|
||||||
|
)
|
||||||
# html
|
# html
|
||||||
|
|
||||||
delai = sco_evaluations.formsemestre_evaluations_delai_correction(context.Notes, formsemestre_id=sem["formsemestre_id"], format="json", REQUEST=REQUEST)
|
delai = sco_evaluations.formsemestre_evaluations_delai_correction(
|
||||||
|
context.Notes,
|
||||||
|
formsemestre_id=sem["formsemestre_id"],
|
||||||
|
format="json",
|
||||||
|
REQUEST=REQUEST,
|
||||||
|
)
|
||||||
# html
|
# html
|
||||||
|
|
||||||
lio = sco_undo_notes.evaluation_list_operations(context.Notes, evaluation_id=e["evaluation_id"], REQUEST=REQUEST)
|
lio = sco_undo_notes.evaluation_list_operations(
|
||||||
|
context.Notes, evaluation_id=e["evaluation_id"], REQUEST=REQUEST
|
||||||
|
)
|
||||||
# html
|
# html
|
||||||
|
|
||||||
|
|
||||||
@ -212,16 +226,25 @@ lio = sco_undo_notes.evaluation_list_operations(context.Notes, evaluation_id=e["
|
|||||||
|
|
||||||
etat = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
etat = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
||||||
assert etat["evalcomplete"]
|
assert etat["evalcomplete"]
|
||||||
sco_saisie_notes.evaluation_suppress_alln(context.Notes, e2["evaluation_id"], REQUEST=REQUEST)
|
sco_saisie_notes.evaluation_suppress_alln(e2["evaluation_id"])
|
||||||
etat2 = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
etat2 = sco_evaluations.do_evaluation_etat(context.Notes, e2["evaluation_id"])
|
||||||
|
|
||||||
# assert not etat2["evalcomplete"] rien ne se passe...
|
# assert not etat2["evalcomplete"] rien ne se passe...
|
||||||
|
|
||||||
# --- Modification d'une évaluation
|
# --- Modification d'une évaluation
|
||||||
|
|
||||||
context.Notes.do_evaluation_edit(REQUEST=REQUEST, args={"evaluation_id" : e5, "coefficient": 2.0 ,
|
context.Notes.do_evaluation_edit(
|
||||||
"description" : "modification", "note_max" : 20,
|
REQUEST=REQUEST,
|
||||||
"heure_debut" : "8h0", "heure_fin" : "10h0", "jour" : "03/02/2021"})
|
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]
|
new_eval5 = context.Notes.do_evaluation_list({"evaluation_id": e5})[0]
|
||||||
|
|
||||||
assert new_eval5["description"] == "modification"
|
assert new_eval5["description"] == "modification"
|
||||||
@ -239,12 +262,18 @@ e7 = G.create_evaluation(
|
|||||||
coefficient=1.0,
|
coefficient=1.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
lie = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem["formsemestre_id"])
|
lie = context.Notes.do_evaluation_list_in_formsemestre(
|
||||||
|
formsemestre_id=sem["formsemestre_id"]
|
||||||
|
)
|
||||||
assert len(lie) == 5
|
assert len(lie) == 5
|
||||||
|
|
||||||
# context.Notes.evaluation_delete(REQUEST=REQUEST, evaluation_id=e7) rien ne se passe
|
# 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"])
|
sco_evaluations.do_evaluation_delete(
|
||||||
lie2 = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem["formsemestre_id"])
|
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
|
assert len(lie2) == 4
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
""" Création d'une évaluation, saisie des notes et supressions de toutes les notes """
|
|
||||||
|
|
||||||
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_saisie_notes
|
|
||||||
import sco_evaluations
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# --- 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'une évaluation
|
|
||||||
e = G.create_evaluation(
|
|
||||||
moduleimpl_id=mi["moduleimpl_id"],
|
|
||||||
jour="7/01/2021",
|
|
||||||
description="evaluation test 1",
|
|
||||||
coefficient=1.0,
|
|
||||||
)
|
|
||||||
|
|
||||||
# --- Saisie des notes
|
|
||||||
for etud in etuds:
|
|
||||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
|
||||||
evaluation=e, etud=etud, note=float(random.randint(0, 20))
|
|
||||||
)
|
|
||||||
|
|
||||||
etat = sco_evaluations.do_evaluation_etat(context.Notes, e["evaluation_id"])
|
|
||||||
assert etat["evalcomplete"]
|
|
||||||
|
|
||||||
# --- Suppression des notes
|
|
||||||
sco_saisie_notes.evaluation_suppress_alln(context.Notes, e["evaluation_id"], REQUEST=REQUEST)
|
|
||||||
etat = sco_evaluations.do_evaluation_etat(context.Notes, e["evaluation_id"])
|
|
||||||
assert not etat["evalcomplete"]
|
|
||||||
|
|
||||||
"""
|
|
||||||
Commentaire : Les notes ne se suppriment pas et l'etat ne change donc pas
|
|
||||||
"""
|
|
@ -1,319 +0,0 @@
|
|||||||
""" Créer 2 formations, une test et une normale. Créer 2 semestres dans la formation normale et un
|
|
||||||
dans la formation test, créer 2 semestres dans la formation normale (un test et un normal),
|
|
||||||
2 ue (un test et un normal), 2 modules (un test et un normal) et 2 matieres (test et normal).
|
|
||||||
Et dans la formations test, un semestre, un module, un ue et une matiere.
|
|
||||||
Afficher la liste de tout ca puis supprimer les ue, mod, mat et sem test ainsi
|
|
||||||
que la formation test. Afficher la liste des UE, formations et modules restante.
|
|
||||||
|
|
||||||
Vérification :
|
|
||||||
|
|
||||||
- Les listes initiales comprennent bien tout les éléments créés avec les bon noms etc
|
|
||||||
- La supression s'est bien effectué au niveau de scodoc web et en python
|
|
||||||
- Vérifier que les fonctions listes font bien la mise à jour après supression
|
|
||||||
|
|
||||||
Fonction de l'API utilisé :
|
|
||||||
|
|
||||||
- create_formation
|
|
||||||
- create_ue
|
|
||||||
- create_matiere
|
|
||||||
- create_module
|
|
||||||
- create_formsemestre
|
|
||||||
- create_moduleimpl
|
|
||||||
- formation_list
|
|
||||||
- formation_export
|
|
||||||
- formsemestre_list
|
|
||||||
- do_moduleimpl_list
|
|
||||||
- do_module_impl_with_module_list
|
|
||||||
- do_formsemestre_delete
|
|
||||||
- do_module_list
|
|
||||||
- do_module_delete
|
|
||||||
- do_matiere_list
|
|
||||||
- do_matiere_delete
|
|
||||||
- do_ue_list
|
|
||||||
- do_ue_delete
|
|
||||||
- do_formation_delete
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
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_formsemestre_status
|
|
||||||
import ZNotes
|
|
||||||
import sco_formations
|
|
||||||
import sco_moduleimpl
|
|
||||||
import sco_edit_ue
|
|
||||||
import sco_edit_matiere
|
|
||||||
import sco_edit_module
|
|
||||||
import sco_formsemestre_edit
|
|
||||||
|
|
||||||
G = sco_fake_gen.ScoFake(context.Notes)
|
|
||||||
G.verbose = False
|
|
||||||
|
|
||||||
# --- Création de formations
|
|
||||||
|
|
||||||
f = G.create_formation(acronyme="F1", titre="Formation 1", titre_officiel="Titre officiel 1")
|
|
||||||
|
|
||||||
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 test",
|
|
||||||
ue_id=ue2["ue_id"], # faiblesse de l'API
|
|
||||||
formation_id=f["formation_id"], # faiblesse de l'API
|
|
||||||
)
|
|
||||||
|
|
||||||
uet = G.create_ue(formation_id=f["formation_id"], acronyme="TSTt", titre="ue testt")
|
|
||||||
matt = G.create_matiere(ue_id=uet["ue_id"], titre="matière testt")
|
|
||||||
modt = G.create_module(
|
|
||||||
matiere_id=matt["matiere_id"],
|
|
||||||
code="TSMt",
|
|
||||||
coefficient=1.0,
|
|
||||||
titre="module test",
|
|
||||||
ue_id=uet["ue_id"], # faiblesse de l'API
|
|
||||||
formation_id=f["formation_id"], # faiblesse de l'API
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
f2 = G.create_formation(acronyme="", titre="Formation test")
|
|
||||||
|
|
||||||
ue3 = G.create_ue(formation_id=f2["formation_id"], acronyme="TST3", titre="ue test3")
|
|
||||||
mat3 = G.create_matiere(ue_id=ue3["ue_id"], titre="matière test3")
|
|
||||||
mod3 = G.create_module(
|
|
||||||
matiere_id=mat3["matiere_id"],
|
|
||||||
code="TSM3",
|
|
||||||
coefficient=1.0,
|
|
||||||
titre="module test3",
|
|
||||||
ue_id=ue3["ue_id"], # faiblesse de l'API
|
|
||||||
formation_id=f2["formation_id"], # faiblesse de l'API
|
|
||||||
)
|
|
||||||
|
|
||||||
# --- Création et implémentation des semestres
|
|
||||||
|
|
||||||
sem1 = G.create_formsemestre(
|
|
||||||
formation_id=f["formation_id"],
|
|
||||||
semestre_id=1,
|
|
||||||
date_debut="01/01/2021",
|
|
||||||
date_fin="30/06/2021",
|
|
||||||
)
|
|
||||||
|
|
||||||
sem2 = G.create_formsemestre(
|
|
||||||
formation_id=f["formation_id"],
|
|
||||||
semestre_id=2,
|
|
||||||
date_debut="01/09/2020",
|
|
||||||
date_fin="31/12/2020",
|
|
||||||
)
|
|
||||||
|
|
||||||
mi = G.create_moduleimpl(
|
|
||||||
module_id=mod["module_id"],
|
|
||||||
formsemestre_id=sem1["formsemestre_id"],
|
|
||||||
responsable_id="bach",
|
|
||||||
)
|
|
||||||
|
|
||||||
mi2 = G.create_moduleimpl(
|
|
||||||
module_id=mod2["module_id"],
|
|
||||||
formsemestre_id=sem1["formsemestre_id"],
|
|
||||||
responsable_id="bach",
|
|
||||||
)
|
|
||||||
|
|
||||||
mit = G.create_moduleimpl(
|
|
||||||
module_id=modt["module_id"],
|
|
||||||
formsemestre_id=sem2["formsemestre_id"],
|
|
||||||
responsable_id="bach",
|
|
||||||
)
|
|
||||||
|
|
||||||
semt = G.create_formsemestre(
|
|
||||||
formation_id=f2["formation_id"],
|
|
||||||
semestre_id=3,
|
|
||||||
date_debut="01/01/2021",
|
|
||||||
date_fin="30/06/2021",
|
|
||||||
)
|
|
||||||
|
|
||||||
mi3 = G.create_moduleimpl(
|
|
||||||
module_id=mod3["module_id"],
|
|
||||||
formsemestre_id=semt["formsemestre_id"],
|
|
||||||
responsable_id="bach",
|
|
||||||
)
|
|
||||||
|
|
||||||
# --- Affichier la liste des formations
|
|
||||||
|
|
||||||
lif = context.Notes.formation_list(format="json", REQUEST=REQUEST, formation_id=f["formation_id"])
|
|
||||||
|
|
||||||
load_lif = json.loads(lif)
|
|
||||||
assert len(load_lif) == 1
|
|
||||||
assert load_lif[0]["acronyme"] == f["acronyme"]
|
|
||||||
assert load_lif[0]["titre_officiel"] == f["titre_officiel"]
|
|
||||||
assert load_lif[0]["formation_id"] == f["formation_id"]
|
|
||||||
assert load_lif[0]["titre"] == f["titre"]
|
|
||||||
|
|
||||||
lif2 = context.Notes.formation_list(format = 'json', REQUEST=REQUEST)
|
|
||||||
|
|
||||||
load_lif2 = json.loads(lif2)
|
|
||||||
assert len(load_lif2) == 2
|
|
||||||
assert load_lif2[0] == load_lif[0]
|
|
||||||
assert load_lif2[1]["titre"] == f2["titre"]
|
|
||||||
|
|
||||||
|
|
||||||
# --- Export de formation_id
|
|
||||||
|
|
||||||
exp = sco_formations.formation_export(context.Notes, formation_id=f["formation_id"], format="json", REQUEST=REQUEST)
|
|
||||||
|
|
||||||
load_exp = json.loads(exp)
|
|
||||||
|
|
||||||
assert load_exp["acronyme"] == "F1"
|
|
||||||
assert load_exp["titre_officiel"] == "Titre officiel 1"
|
|
||||||
assert load_exp["titre"] == "Formation 1"
|
|
||||||
assert load_exp["formation_code"] == f["formation_code"]
|
|
||||||
assert len(load_exp["ue"]) == 3
|
|
||||||
assert load_exp["ue"][0]["acronyme"] == "TST1"
|
|
||||||
assert load_exp["ue"][0]["titre"] == "ue test"
|
|
||||||
assert load_exp["formation_id"] == f["formation_id"]
|
|
||||||
assert load_exp["formation_code"] == f["formation_code"]
|
|
||||||
|
|
||||||
|
|
||||||
# --- Liste des semestres
|
|
||||||
|
|
||||||
li_sem1 = context.Notes.formsemestre_list(formsemestre_id=sem1["formsemestre_id"], format = "json", REQUEST=REQUEST)
|
|
||||||
load_li_sem1 = json.loads(li_sem1) #uniquement le semestre 1 dans la liste
|
|
||||||
|
|
||||||
assert len(load_li_sem1) == 1
|
|
||||||
assert load_li_sem1[0]["date_fin"] == sem1["date_fin"]
|
|
||||||
assert load_li_sem1[0]["semestre_id"] == sem1["semestre_id"]
|
|
||||||
assert load_li_sem1[0]["formation_id"] ==sem1["formation_id"]
|
|
||||||
|
|
||||||
|
|
||||||
li_semf = context.Notes.formsemestre_list(formation_id=f["formation_id"], format = "json", REQUEST=REQUEST)
|
|
||||||
load_li_semf = json.loads(li_semf)
|
|
||||||
|
|
||||||
assert load_li_sem1[0] in load_li_semf
|
|
||||||
assert len(load_li_semf) == 2
|
|
||||||
assert load_li_semf[1]["semestre_id"] == sem2["semestre_id"]
|
|
||||||
|
|
||||||
|
|
||||||
li_sem = context.Notes.formsemestre_list(format = "json", REQUEST=REQUEST)
|
|
||||||
load_li_sem = json.loads(li_sem)
|
|
||||||
|
|
||||||
assert len(load_li_sem) == 3
|
|
||||||
assert load_li_semf[0] and load_li_semf[1] in load_li_sem
|
|
||||||
assert load_li_sem[0]["semestre_id"] == semt["semestre_id"]
|
|
||||||
|
|
||||||
|
|
||||||
# --- Liste des modules
|
|
||||||
|
|
||||||
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
load_lim_sem1 = json.loads(lim_sem1)
|
|
||||||
|
|
||||||
|
|
||||||
assert len(load_lim_sem1) == 2
|
|
||||||
assert mod["module_id"] == load_lim_sem1[0]["module_id"] or load_lim_sem1[1]["module_id"]
|
|
||||||
assert mod2["module_id"] == load_lim_sem1[0]["module_id"] or load_lim_sem1[1]["module_id"]
|
|
||||||
|
|
||||||
lim_modid = sco_moduleimpl.do_moduleimpl_list(context.Notes, module_id=mod["module_id"], REQUEST=REQUEST)
|
|
||||||
load_lim_modid = json.loads(lim_modid) #Liste avec seulement mod
|
|
||||||
|
|
||||||
assert len(load_lim_modid) == 1
|
|
||||||
|
|
||||||
lim_modimpl_id = sco_moduleimpl.do_moduleimpl_list(context.Notes, moduleimpl_id=mi["moduleimpl_id"], REQUEST=REQUEST)
|
|
||||||
print(lim_modimpl_id)
|
|
||||||
|
|
||||||
# ---- Test de do_moduleimpl_withmodule_list
|
|
||||||
|
|
||||||
assert lim_modid == lim_modimpl_id #doit etre le meme resultat
|
|
||||||
|
|
||||||
liimp_sem1 = sco_moduleimpl.do_moduleimpl_withmodule_list(context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
load_liimp_sem1 = json.loads(liimp_sem1)
|
|
||||||
|
|
||||||
assert len(load_liimp_sem1) == 2
|
|
||||||
assert mod["module_id"] == load_liimp_sem1[0]["module_id"] or load_liimp_sem1[1]["module_id"] or load_liim_sem1[2]["module_id"]
|
|
||||||
assert mod2["module_id"] == load_liimp_sem1[0]["module_id"] or load_liimp_sem1[1]["module_id"] or load_liim_sem1[2]["module_id"]
|
|
||||||
assert modt["module_id"] == load_liimp_sem1[0]["module_id"] or load_liimp_sem1[1]["module_id"] or load_liim_sem1[2]["module_id"]
|
|
||||||
|
|
||||||
liimp_modid = sco_moduleimpl.do_moduleimpl_withmodule_list(context.Notes, module_id=mod["module_id"], REQUEST=REQUEST)
|
|
||||||
|
|
||||||
load_liimp_modid = json.loads(liimp_modid)
|
|
||||||
assert len(load_liimp_modid) == 1
|
|
||||||
|
|
||||||
liimp_modimplid = sco_moduleimpl.do_moduleimpl_withmodule_list(context.Notes, moduleimpl_id=mi["moduleimpl_id"], REQUEST=REQUEST)
|
|
||||||
|
|
||||||
assert liimp_modid == liimp_modimplid
|
|
||||||
|
|
||||||
|
|
||||||
# --- Suppression du module, matiere et ue test du semestre 2
|
|
||||||
|
|
||||||
#on doit d'abbord supprimer le semestre
|
|
||||||
|
|
||||||
#sco_formsemestre_edit.formsemestre_delete(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
#sco_formsemestre_edit.formsemestre_delete2(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
|
|
||||||
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
|
||||||
|
|
||||||
sco_formsemestre_edit.do_formsemestre_delete(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
|
|
||||||
#sco_edit_module.module_delete(context.Notes, module_id=modt["module_id"], REQUEST=REQUEST)
|
|
||||||
#sco_edit_matiere.matiere_delete(context.Notes, matiere_id=matt["matiere_id"], REQUEST=REQUEST)
|
|
||||||
#sco_edit_ue.ue_delete(context.Notes, ue_id=uet["ue_id"], REQUEST=REQUEST)
|
|
||||||
|
|
||||||
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
|
||||||
|
|
||||||
|
|
||||||
li_module = context.Notes.do_module_list()
|
|
||||||
assert len(li_module) == 4
|
|
||||||
context.Notes.do_module_delete(oid=modt["module_id"], REQUEST=REQUEST) #on supprime le semestre
|
|
||||||
#sco_formsemestre_edit.formsemestre_delete_moduleimpls(context.Notes, formsemestre_id=sem2["formsemestre_id"], module_ids_to_del=[modt["module_id"]])
|
|
||||||
#deuxieme methode de supression d'un module
|
|
||||||
li_module2 = context.Notes.do_module_list()
|
|
||||||
|
|
||||||
assert len(li_module2) == 3 #verification de la suppression du module
|
|
||||||
|
|
||||||
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
load_lim_sem2 = json.loads(lim_sem2)
|
|
||||||
|
|
||||||
assert len(load_lim_sem2) == 0 #deuxieme vérification si le module s'est bien sup
|
|
||||||
|
|
||||||
|
|
||||||
li_mat = context.Notes.do_matiere_list()
|
|
||||||
assert len(li_mat) == 4
|
|
||||||
context.Notes.do_matiere_delete(oid=matt["matiere_id"], REQUEST=REQUEST) #on supprime la matiere
|
|
||||||
li_mat2 = context.Notes.do_matiere_list()
|
|
||||||
assert len(li_mat2) == 3 #verification de la suppression de la matiere
|
|
||||||
|
|
||||||
|
|
||||||
li_ue = context.Notes.do_ue_list()
|
|
||||||
assert len(li_ue) == 4
|
|
||||||
sco_edit_ue.ue_delete(context.Notes, ue_id=uet["ue_id"], REQUEST=REQUEST)
|
|
||||||
li_ue2 = context.Notes.do_ue_list()
|
|
||||||
#assert len(li_ue) == 3 #verification de la suppression de l'UE #comment supprimer un ue?
|
|
||||||
|
|
||||||
|
|
||||||
# --- Suppression d'une formation
|
|
||||||
|
|
||||||
|
|
||||||
#Il faut d'abbord supprimer le semestre aussi.
|
|
||||||
|
|
||||||
sco_formsemestre_edit.do_formsemestre_delete(context.Notes, formsemestre_id=semt["formsemestre_id"], REQUEST=REQUEST)
|
|
||||||
|
|
||||||
|
|
||||||
context.Notes.do_formation_delete(oid=f2["formation_id"], REQUEST=REQUEST)
|
|
||||||
lif3 = context.Notes.formation_list(format = 'json', REQUEST=REQUEST)
|
|
||||||
|
|
||||||
load_lif3 = json.loads(lif3)
|
|
||||||
assert len(load_lif3) == 1
|
|
@ -24,13 +24,13 @@ def test_client():
|
|||||||
db.create_all()
|
db.create_all()
|
||||||
Role.insert_roles()
|
Role.insert_roles()
|
||||||
u = User(user_name="admin")
|
u = User(user_name="admin")
|
||||||
admin_role = Role.query.filter_by(name="Admin").first()
|
admin_role = Role.query.filter_by(name="SuperAdmin").first()
|
||||||
u.add_role(admin_role, "TEST00")
|
u.add_role(admin_role, "TEST00")
|
||||||
# u.set_password("admin")
|
# u.set_password("admin")
|
||||||
login_user(u)
|
login_user(u)
|
||||||
# db.session.add(u)
|
# db.session.add(u)
|
||||||
|
|
||||||
g.scodoc_dept = "RT"
|
g.scodoc_dept = "TEST00"
|
||||||
g.db_conn = ndb.open_dept_connection()
|
g.db_conn = ndb.open_dept_connection()
|
||||||
yield client
|
yield client
|
||||||
# ndb.close_dept_connection()
|
# ndb.close_dept_connection()
|
||||||
|
@ -149,7 +149,7 @@ class ScoFake(object):
|
|||||||
"""Crée une formation"""
|
"""Crée une formation"""
|
||||||
if not acronyme:
|
if not acronyme:
|
||||||
acronyme = "TEST" + str(random.randint(100000, 999999))
|
acronyme = "TEST" + str(random.randint(100000, 999999))
|
||||||
oid = sco_edit_formation.do_formation_create(context, locals(), REQUEST=REQUEST)
|
oid = sco_edit_formation.do_formation_create(context, locals())
|
||||||
oids = sco_formations.formation_list(context, formation_id=oid)
|
oids = sco_formations.formation_list(context, formation_id=oid)
|
||||||
if not oids:
|
if not oids:
|
||||||
raise ScoValueError("formation not created !")
|
raise ScoValueError("formation not created !")
|
||||||
@ -172,7 +172,7 @@ class ScoFake(object):
|
|||||||
"""Crée une UE"""
|
"""Crée une UE"""
|
||||||
if numero is None:
|
if numero is None:
|
||||||
numero = sco_edit_ue.next_ue_numero(context, formation_id, 0)
|
numero = sco_edit_ue.next_ue_numero(context, formation_id, 0)
|
||||||
oid = sco_edit_ue.do_ue_create(context, locals(), REQUEST)
|
oid = sco_edit_ue.do_ue_create(context, locals())
|
||||||
oids = sco_edit_ue.do_ue_list(context, args={"ue_id": oid})
|
oids = sco_edit_ue.do_ue_list(context, args={"ue_id": oid})
|
||||||
if not oids:
|
if not oids:
|
||||||
raise ScoValueError("ue not created !")
|
raise ScoValueError("ue not created !")
|
||||||
@ -180,7 +180,7 @@ class ScoFake(object):
|
|||||||
|
|
||||||
@logging_meth
|
@logging_meth
|
||||||
def create_matiere(self, ue_id=None, titre=None, numero=None):
|
def create_matiere(self, ue_id=None, titre=None, numero=None):
|
||||||
oid = sco_edit_matiere.do_matiere_create(context, locals(), REQUEST)
|
oid = sco_edit_matiere.do_matiere_create(context, locals())
|
||||||
oids = sco_edit_matiere.do_matiere_list(context, args={"matiere_id": oid})
|
oids = sco_edit_matiere.do_matiere_list(context, args={"matiere_id": oid})
|
||||||
if not oids:
|
if not oids:
|
||||||
raise ScoValueError("matiere not created !")
|
raise ScoValueError("matiere not created !")
|
||||||
@ -205,7 +205,7 @@ class ScoFake(object):
|
|||||||
code_apogee=None,
|
code_apogee=None,
|
||||||
module_type=None,
|
module_type=None,
|
||||||
):
|
):
|
||||||
oid = sco_edit_module.do_module_create(context, locals(), REQUEST)
|
oid = sco_edit_module.do_module_create(context, locals())
|
||||||
oids = sco_edit_module.do_module_list(context, args={"module_id": oid})
|
oids = sco_edit_module.do_module_list(context, args={"module_id": oid})
|
||||||
if not oids:
|
if not oids:
|
||||||
raise ScoValueError("module not created ! (oid=%s)" % oid)
|
raise ScoValueError("module not created ! (oid=%s)" % oid)
|
||||||
|
@ -9,12 +9,13 @@ Usage: pytest tests/unit/test_caches.py
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app, g
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.scodoc import sco_cache
|
from app.scodoc import sco_cache
|
||||||
from app.scodoc import sco_evaluations
|
from app.scodoc import sco_evaluations
|
||||||
from app.scodoc import sco_formsemestre
|
from app.scodoc import sco_formsemestre
|
||||||
|
from app.scodoc import notesdb as ndb
|
||||||
|
|
||||||
DEPT = "RT" # ce département (BD) doit exister
|
DEPT = "RT" # ce département (BD) doit exister
|
||||||
context = None # #context
|
context = None # #context
|
||||||
@ -22,6 +23,8 @@ context = None # #context
|
|||||||
|
|
||||||
def test_notes_table(test_client):
|
def test_notes_table(test_client):
|
||||||
"""Test construction et cache de NotesTable"""
|
"""Test construction et cache de NotesTable"""
|
||||||
|
ndb.set_sco_dept(DEPT)
|
||||||
|
assert g.scodoc_dept == DEPT
|
||||||
sems = sco_formsemestre.do_formsemestre_list(context)
|
sems = sco_formsemestre.do_formsemestre_list(context)
|
||||||
assert len(sems)
|
assert len(sems)
|
||||||
sem = sems[0]
|
sem = sems[0]
|
||||||
@ -41,6 +44,7 @@ def test_notes_table(test_client):
|
|||||||
def test_cache_evaluations(test_client):
|
def test_cache_evaluations(test_client):
|
||||||
""""""
|
""""""
|
||||||
# cherche un semestre ayant des evaluations
|
# cherche un semestre ayant des evaluations
|
||||||
|
ndb.set_sco_dept(DEPT)
|
||||||
sems = sco_formsemestre.do_formsemestre_list(None)
|
sems = sco_formsemestre.do_formsemestre_list(None)
|
||||||
assert len(sems)
|
assert len(sems)
|
||||||
sem_evals = []
|
sem_evals = []
|
||||||
|
346
tests/unit/test_formations.py
Normal file
346
tests/unit/test_formations.py
Normal file
@ -0,0 +1,346 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
""" Test creation/edition/import/export formations
|
||||||
|
"""
|
||||||
|
|
||||||
|
# test écrit par Fares Amer, mai 2021 et porté sur ScoDoc 8 en juillet 2021
|
||||||
|
|
||||||
|
# Créer 2 formations, une test et une normale. Créer 2 semestres dans la formation normale et un
|
||||||
|
# dans la formation test, créer 2 semestres dans la formation normale (un test et un normal),
|
||||||
|
# 2 ue (un test et un normal), 2 modules (un test et un normal) et 2 matieres (test et normal).
|
||||||
|
# Et dans la formations test, un semestre, un module, un ue et une matiere.
|
||||||
|
# Afficher la liste de tout ca puis supprimer les ue, mod, mat et sem test ainsi
|
||||||
|
# que la formation test. Afficher la liste des UE, formations et modules restante.
|
||||||
|
#
|
||||||
|
# Vérification :
|
||||||
|
#
|
||||||
|
# - Les listes initiales comprennent bien tout les éléments créés avec les bon noms etc
|
||||||
|
# - La supression s'est bien effectué au niveau de scodoc web et en python
|
||||||
|
# - Vérifier que les fonctions listes font bien la mise à jour après supression
|
||||||
|
#
|
||||||
|
# Fonction de l'API utilisé :
|
||||||
|
#
|
||||||
|
# - create_formation
|
||||||
|
# - create_ue
|
||||||
|
# - create_matiere
|
||||||
|
# - create_module
|
||||||
|
# - create_formsemestre
|
||||||
|
# - create_moduleimpl
|
||||||
|
# - formation_list
|
||||||
|
# - formation_export
|
||||||
|
# - formsemestre_list
|
||||||
|
# - do_moduleimpl_list
|
||||||
|
# - do_module_impl_with_module_list
|
||||||
|
# - do_formsemestre_delete
|
||||||
|
# - do_module_list
|
||||||
|
# - do_module_delete
|
||||||
|
# - do_matiere_list
|
||||||
|
# - do_matiere_delete
|
||||||
|
# - do_ue_list
|
||||||
|
# - do_ue_delete
|
||||||
|
# - do_formation_delete
|
||||||
|
|
||||||
|
import json
|
||||||
|
import flask
|
||||||
|
from flask import g
|
||||||
|
|
||||||
|
from tests.unit import sco_fake_gen
|
||||||
|
|
||||||
|
from app.scodoc import sco_edit_formation
|
||||||
|
from app.scodoc import sco_edit_matiere
|
||||||
|
from app.scodoc import sco_edit_module
|
||||||
|
from app.scodoc import sco_edit_ue
|
||||||
|
from app.scodoc import sco_formations
|
||||||
|
from app.scodoc import sco_formsemestre_edit
|
||||||
|
from app.scodoc import sco_formsemestre_status
|
||||||
|
from app.scodoc import sco_moduleimpl
|
||||||
|
from app.views import notes
|
||||||
|
|
||||||
|
context = None # #context
|
||||||
|
|
||||||
|
|
||||||
|
def test_formations(test_client):
|
||||||
|
"""Test création/édition/import/export formations"""
|
||||||
|
G = sco_fake_gen.ScoFake(verbose=False)
|
||||||
|
|
||||||
|
# --- Création de formations
|
||||||
|
|
||||||
|
f = G.create_formation(
|
||||||
|
acronyme="F1", titre="Formation 1", titre_officiel="Titre officiel 1"
|
||||||
|
)
|
||||||
|
|
||||||
|
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 test",
|
||||||
|
ue_id=ue2["ue_id"], # faiblesse de l'API
|
||||||
|
formation_id=f["formation_id"], # faiblesse de l'API
|
||||||
|
)
|
||||||
|
|
||||||
|
uet = G.create_ue(formation_id=f["formation_id"], acronyme="TSTt", titre="ue testt")
|
||||||
|
matt = G.create_matiere(ue_id=uet["ue_id"], titre="matière testt")
|
||||||
|
modt = G.create_module(
|
||||||
|
matiere_id=matt["matiere_id"],
|
||||||
|
code="TSMt",
|
||||||
|
coefficient=1.0,
|
||||||
|
titre="module test",
|
||||||
|
ue_id=uet["ue_id"], # faiblesse de l'API
|
||||||
|
formation_id=f["formation_id"], # faiblesse de l'API
|
||||||
|
)
|
||||||
|
|
||||||
|
f2 = G.create_formation(acronyme="", titre="Formation test")
|
||||||
|
|
||||||
|
ue3 = G.create_ue(
|
||||||
|
formation_id=f2["formation_id"], acronyme="TST3", titre="ue test3"
|
||||||
|
)
|
||||||
|
mat3 = G.create_matiere(ue_id=ue3["ue_id"], titre="matière test3")
|
||||||
|
mod3 = G.create_module(
|
||||||
|
matiere_id=mat3["matiere_id"],
|
||||||
|
code="TSM3",
|
||||||
|
coefficient=1.0,
|
||||||
|
titre="module test3",
|
||||||
|
ue_id=ue3["ue_id"], # faiblesse de l'API
|
||||||
|
formation_id=f2["formation_id"], # faiblesse de l'API
|
||||||
|
)
|
||||||
|
|
||||||
|
# --- Création et implémentation des semestres
|
||||||
|
|
||||||
|
sem1 = G.create_formsemestre(
|
||||||
|
formation_id=f["formation_id"],
|
||||||
|
semestre_id=1,
|
||||||
|
date_debut="01/01/2021",
|
||||||
|
date_fin="30/06/2021",
|
||||||
|
)
|
||||||
|
|
||||||
|
sem2 = G.create_formsemestre(
|
||||||
|
formation_id=f["formation_id"],
|
||||||
|
semestre_id=2,
|
||||||
|
date_debut="01/09/2020",
|
||||||
|
date_fin="31/12/2020",
|
||||||
|
)
|
||||||
|
|
||||||
|
mi = G.create_moduleimpl(
|
||||||
|
module_id=mod["module_id"],
|
||||||
|
formsemestre_id=sem1["formsemestre_id"],
|
||||||
|
responsable_id="bach",
|
||||||
|
)
|
||||||
|
|
||||||
|
mi2 = G.create_moduleimpl(
|
||||||
|
module_id=mod2["module_id"],
|
||||||
|
formsemestre_id=sem1["formsemestre_id"],
|
||||||
|
responsable_id="bach",
|
||||||
|
)
|
||||||
|
|
||||||
|
mit = G.create_moduleimpl(
|
||||||
|
module_id=modt["module_id"],
|
||||||
|
formsemestre_id=sem2["formsemestre_id"],
|
||||||
|
responsable_id="bach",
|
||||||
|
)
|
||||||
|
|
||||||
|
semt = G.create_formsemestre(
|
||||||
|
formation_id=f2["formation_id"],
|
||||||
|
semestre_id=3,
|
||||||
|
date_debut="01/01/2021",
|
||||||
|
date_fin="30/06/2021",
|
||||||
|
)
|
||||||
|
|
||||||
|
mi3 = G.create_moduleimpl(
|
||||||
|
module_id=mod3["module_id"],
|
||||||
|
formsemestre_id=semt["formsemestre_id"],
|
||||||
|
responsable_id="bach",
|
||||||
|
)
|
||||||
|
|
||||||
|
# --- Afficher la liste des formations
|
||||||
|
|
||||||
|
lif = notes.formation_list(context, format="json", formation_id=f["formation_id"])
|
||||||
|
# lif est une Response car on a appelé une vue (1er appel)
|
||||||
|
assert isinstance(lif, flask.Response)
|
||||||
|
load_lif = json.loads(lif.get_data().decode("utf-8"))
|
||||||
|
assert len(load_lif) == 1
|
||||||
|
assert load_lif[0]["acronyme"] == f["acronyme"]
|
||||||
|
assert load_lif[0]["titre_officiel"] == f["titre_officiel"]
|
||||||
|
assert load_lif[0]["formation_id"] == f["formation_id"]
|
||||||
|
assert load_lif[0]["titre"] == f["titre"]
|
||||||
|
|
||||||
|
lif2 = notes.formation_list(context, format="json")
|
||||||
|
# lif2 est un chaine
|
||||||
|
assert isinstance(lif2, str)
|
||||||
|
load_lif2 = json.loads(lif2)
|
||||||
|
assert len(load_lif2) == 2
|
||||||
|
assert load_lif2[0] == load_lif[0]
|
||||||
|
assert load_lif2[1]["titre"] == f2["titre"]
|
||||||
|
|
||||||
|
# --- Export de formation_id
|
||||||
|
|
||||||
|
exp = sco_formations.formation_export(
|
||||||
|
context, formation_id=f["formation_id"], format="json"
|
||||||
|
)
|
||||||
|
assert isinstance(exp, str)
|
||||||
|
load_exp = json.loads(exp)
|
||||||
|
|
||||||
|
assert load_exp["acronyme"] == "F1"
|
||||||
|
assert load_exp["titre_officiel"] == "Titre officiel 1"
|
||||||
|
assert load_exp["titre"] == "Formation 1"
|
||||||
|
assert load_exp["formation_code"] == f["formation_code"]
|
||||||
|
assert len(load_exp["ue"]) == 3
|
||||||
|
assert load_exp["ue"][0]["acronyme"] == "TST1"
|
||||||
|
assert load_exp["ue"][0]["titre"] == "ue test"
|
||||||
|
assert load_exp["formation_id"] == f["formation_id"]
|
||||||
|
assert load_exp["formation_code"] == f["formation_code"]
|
||||||
|
|
||||||
|
# --- Liste des semestres
|
||||||
|
|
||||||
|
li_sem1 = notes.formsemestre_list(
|
||||||
|
context, formsemestre_id=sem1["formsemestre_id"], format="json"
|
||||||
|
)
|
||||||
|
assert isinstance(li_sem1, str)
|
||||||
|
load_li_sem1 = json.loads(li_sem1) # uniquement le semestre 1 dans la liste
|
||||||
|
|
||||||
|
assert len(load_li_sem1) == 1
|
||||||
|
assert load_li_sem1[0]["date_fin"] == sem1["date_fin"]
|
||||||
|
assert load_li_sem1[0]["semestre_id"] == sem1["semestre_id"]
|
||||||
|
assert load_li_sem1[0]["formation_id"] == sem1["formation_id"]
|
||||||
|
|
||||||
|
li_semf = notes.formsemestre_list(
|
||||||
|
context,
|
||||||
|
formation_id=f["formation_id"],
|
||||||
|
format="json",
|
||||||
|
)
|
||||||
|
assert isinstance(li_semf, str)
|
||||||
|
load_li_semf = json.loads(li_semf)
|
||||||
|
|
||||||
|
assert load_li_sem1[0] in load_li_semf
|
||||||
|
assert len(load_li_semf) == 2
|
||||||
|
assert load_li_semf[1]["semestre_id"] == sem2["semestre_id"]
|
||||||
|
|
||||||
|
li_sem = notes.formsemestre_list(context, format="json")
|
||||||
|
load_li_sem = json.loads(li_sem)
|
||||||
|
|
||||||
|
assert len(load_li_sem) == 3
|
||||||
|
assert load_li_semf[0] and load_li_semf[1] in load_li_sem
|
||||||
|
assert load_li_sem[0]["semestre_id"] == semt["semestre_id"]
|
||||||
|
|
||||||
|
# --- Liste des modules
|
||||||
|
|
||||||
|
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(
|
||||||
|
context, formsemestre_id=sem1["formsemestre_id"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(lim_sem1) == 2
|
||||||
|
assert mod["module_id"] in (lim_sem1[0]["module_id"], lim_sem1[1]["module_id"])
|
||||||
|
assert mod2["module_id"] in (lim_sem1[0]["module_id"], lim_sem1[1]["module_id"])
|
||||||
|
|
||||||
|
lim_modid = sco_moduleimpl.do_moduleimpl_list(context, module_id=mod["module_id"])
|
||||||
|
|
||||||
|
assert len(lim_modid) == 1
|
||||||
|
|
||||||
|
lim_modimpl_id = sco_moduleimpl.do_moduleimpl_list(
|
||||||
|
context, moduleimpl_id=mi["moduleimpl_id"]
|
||||||
|
)
|
||||||
|
# print(lim_modimpl_id)
|
||||||
|
|
||||||
|
# ---- Test de do_moduleimpl_withmodule_list
|
||||||
|
|
||||||
|
assert lim_modid == lim_modimpl_id # doit etre le meme resultat
|
||||||
|
|
||||||
|
liimp_sem1 = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||||
|
context, formsemestre_id=sem1["formsemestre_id"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(liimp_sem1) == 2
|
||||||
|
assert mod["module_id"] in (liimp_sem1[0]["module_id"], liimp_sem1[1]["module_id"])
|
||||||
|
assert mod2["module_id"] in (
|
||||||
|
liimp_sem1[0]["module_id"],
|
||||||
|
liimp_sem1[1]["module_id"],
|
||||||
|
)
|
||||||
|
liimp_sem2 = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||||
|
context, formsemestre_id=sem2["formsemestre_id"]
|
||||||
|
)
|
||||||
|
assert modt["module_id"] == liimp_sem2[0]["module_id"]
|
||||||
|
liimp_modid = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||||
|
context, module_id=mod["module_id"]
|
||||||
|
)
|
||||||
|
assert len(liimp_modid) == 1
|
||||||
|
|
||||||
|
liimp_modimplid = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||||
|
context, moduleimpl_id=mi["moduleimpl_id"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert liimp_modid == liimp_modimplid
|
||||||
|
|
||||||
|
# --- Suppression du module, matiere et ue test du semestre 2
|
||||||
|
|
||||||
|
# on doit d'abbord supprimer le semestre
|
||||||
|
|
||||||
|
# sco_formsemestre_edit.formsemestre_delete(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
||||||
|
# sco_formsemestre_edit.formsemestre_delete2(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
||||||
|
|
||||||
|
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
||||||
|
|
||||||
|
sco_formsemestre_edit.do_formsemestre_delete(
|
||||||
|
context, formsemestre_id=sem2["formsemestre_id"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# sco_edit_module.module_delete(context.Notes, module_id=modt["module_id"], REQUEST=REQUEST)
|
||||||
|
# sco_edit_matiere.matiere_delete(context.Notes, matiere_id=matt["matiere_id"], REQUEST=REQUEST)
|
||||||
|
# sco_edit_ue.ue_delete(context.Notes, ue_id=uet["ue_id"], REQUEST=REQUEST)
|
||||||
|
|
||||||
|
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
||||||
|
|
||||||
|
li_module = sco_edit_module.do_module_list(context)
|
||||||
|
assert len(li_module) == 4
|
||||||
|
sco_edit_module.do_module_delete(
|
||||||
|
context, oid=modt["module_id"]
|
||||||
|
) # on supprime le semestre
|
||||||
|
# sco_formsemestre_edit.formsemestre_delete_moduleimpls(context.Notes, formsemestre_id=sem2["formsemestre_id"], module_ids_to_del=[modt["module_id"]])
|
||||||
|
# deuxieme methode de supression d'un module
|
||||||
|
li_module2 = sco_edit_module.do_module_list(context)
|
||||||
|
|
||||||
|
assert len(li_module2) == 3 # verification de la suppression du module
|
||||||
|
|
||||||
|
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(
|
||||||
|
context, formsemestre_id=sem2["formsemestre_id"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(lim_sem2) == 0 # deuxieme vérification si le module s'est bien sup
|
||||||
|
|
||||||
|
li_mat = sco_edit_matiere.do_matiere_list(context)
|
||||||
|
assert len(li_mat) == 4
|
||||||
|
sco_edit_matiere.do_matiere_delete(
|
||||||
|
context, oid=matt["matiere_id"]
|
||||||
|
) # on supprime la matiere
|
||||||
|
li_mat2 = sco_edit_matiere.do_matiere_list(context)
|
||||||
|
assert len(li_mat2) == 3 # verification de la suppression de la matiere
|
||||||
|
|
||||||
|
li_ue = sco_edit_ue.do_ue_list(context)
|
||||||
|
assert len(li_ue) == 4
|
||||||
|
sco_edit_ue.ue_delete(context, ue_id=uet["ue_id"], dialog_confirmed=True)
|
||||||
|
li_ue2 = sco_edit_ue.do_ue_list(context)
|
||||||
|
assert len(li_ue2) == 3 # verification de la suppression de l'UE
|
||||||
|
|
||||||
|
# --- Suppression d'une formation
|
||||||
|
# Il faut d'abbord supprimer le semestre aussi.
|
||||||
|
sco_formsemestre_edit.do_formsemestre_delete(
|
||||||
|
context, formsemestre_id=semt["formsemestre_id"]
|
||||||
|
)
|
||||||
|
|
||||||
|
sco_edit_formation.do_formation_delete(context, oid=f2["formation_id"])
|
||||||
|
lif3 = notes.formation_list(context, format="json")
|
||||||
|
assert isinstance(lif3, str)
|
||||||
|
load_lif3 = json.loads(lif3)
|
||||||
|
assert len(load_lif3) == 1
|
@ -7,6 +7,9 @@
|
|||||||
Utiliser comme:
|
Utiliser comme:
|
||||||
pytest tests/unit/test_sco_basic.py
|
pytest tests/unit/test_sco_basic.py
|
||||||
|
|
||||||
|
Au préalable, créer un département de test neuf:
|
||||||
|
flask sco-delete-dept TEST00 && flask sco-create-dept TEST00
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import random
|
import random
|
||||||
|
|
||||||
@ -16,14 +19,15 @@ from tests.unit import sco_fake_gen
|
|||||||
|
|
||||||
from app import decorators
|
from app import decorators
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc import sco_utils as scu
|
|
||||||
from app.scodoc import sco_abs
|
from app.scodoc import sco_abs
|
||||||
from app.scodoc import sco_abs_views
|
from app.scodoc import sco_abs_views
|
||||||
from app.scodoc import sco_bulletins
|
from app.scodoc import sco_bulletins
|
||||||
from app.scodoc import sco_evaluations
|
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_parcours_dut
|
from app.scodoc import sco_evaluations
|
||||||
from app.scodoc import sco_formsemestre_validation
|
from app.scodoc import sco_formsemestre_validation
|
||||||
|
from app.scodoc import sco_parcours_dut
|
||||||
|
from app.scodoc import sco_saisie_notes
|
||||||
|
from app.scodoc import sco_utils as scu
|
||||||
|
|
||||||
context = None # #context
|
context = None # #context
|
||||||
|
|
||||||
@ -92,6 +96,8 @@ def test_sco_basic(test_client):
|
|||||||
# Toute les notes sont saisies, donc eval complète
|
# Toute les notes sont saisies, donc eval complète
|
||||||
etat = sco_evaluations.do_evaluation_etat(e["evaluation_id"])
|
etat = sco_evaluations.do_evaluation_etat(e["evaluation_id"])
|
||||||
assert etat["evalcomplete"]
|
assert etat["evalcomplete"]
|
||||||
|
assert etat["nb_inscrits"] == len(etuds)
|
||||||
|
assert etat["nb_notes"] == len(etuds)
|
||||||
# Un seul module, donc moy gen == note module
|
# Un seul module, donc moy gen == note module
|
||||||
assert b["ues"][0]["cur_moy_ue_txt"] == b["ues"][0]["modules"][0]["mod_moy_txt"]
|
assert b["ues"][0]["cur_moy_ue_txt"] == b["ues"][0]["modules"][0]["mod_moy_txt"]
|
||||||
# Note au module égale à celle de l'éval
|
# Note au module égale à celle de l'éval
|
||||||
@ -137,6 +143,18 @@ def test_sco_basic(test_client):
|
|||||||
assert etat["nb_att"] == 0
|
assert etat["nb_att"] == 0
|
||||||
assert not etat["evalattente"] # toutes les notes sont présentes
|
assert not etat["evalattente"] # toutes les notes sont présentes
|
||||||
|
|
||||||
|
# --- Suppression des notes
|
||||||
|
sco_saisie_notes.evaluation_suppress_alln(e["evaluation_id"], dialog_confirmed=True)
|
||||||
|
etat = sco_evaluations.do_evaluation_etat(e["evaluation_id"])
|
||||||
|
assert etat["nb_notes"] == 0
|
||||||
|
assert not etat["evalcomplete"]
|
||||||
|
# --- Saisie des notes manquantes
|
||||||
|
ans = sco_saisie_notes.do_evaluation_set_missing(
|
||||||
|
e["evaluation_id"], 12.34, dialog_confirmed=True
|
||||||
|
)
|
||||||
|
assert f'{etat["nb_inscrits"]} notes changées' in ans
|
||||||
|
etat = sco_evaluations.do_evaluation_etat(e["evaluation_id"])
|
||||||
|
assert etat["evalcomplete"]
|
||||||
# --- Saisie absences
|
# --- Saisie absences
|
||||||
etudid = etuds[0]["etudid"]
|
etudid = etuds[0]["etudid"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user