1
0
forked from ScoDoc/ScoDoc
This commit is contained in:
Emmanuel Viennet 2021-06-21 11:22:55 +02:00
parent 6a4d6e5109
commit 597b83e6a4
19 changed files with 83 additions and 76 deletions

View File

@ -133,7 +133,7 @@ class User(UserMixin, db.Model):
Args: Args:
perm: integer, one of the value defined in Permission class. perm: integer, one of the value defined in Permission class.
context: dept: dept id (eg 'RT')
""" """
if dept is False: if dept is False:
dept = g.scodoc_dept dept = g.scodoc_dept

View File

@ -19,7 +19,7 @@ authuser = app.acl_users.getUserById('admin')
authuser = authuser.__of__(app.acl_users) authuser = authuser.__of__(app.acl_users)
Exemple: Exemple:
sems = context.Notes.formsemestre_list() sems = sco_formsemestre.do_formsemestre_list.formsemestre_list(context)
formsemestre_id = sems[0]['formsemestre_id'] formsemestre_id = sems[0]['formsemestre_id']
# Affiche tous les semestres: # Affiche tous les semestres:
@ -27,7 +27,7 @@ for sem in sems:
print sem['formsemestre_id'], sem['titre_num'] print sem['formsemestre_id'], sem['titre_num']
# Recupere la table de notes: # Recupere la table de notes:
nt = sco_core.get_notes_cache(context).get_NotesTable(context.Notes, formsemestre_id) nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
""" """

View File

@ -59,6 +59,7 @@ import app.scodoc.sco_utils as scu
from app.scodoc import sco_codes_parcours # sco_codes_parcours.NEXT -> sem suivant from app.scodoc import sco_codes_parcours # sco_codes_parcours.NEXT -> sem suivant
from app.scodoc import sco_core from app.scodoc import sco_core
from app.scodoc import sco_etud from app.scodoc import sco_etud
from app.scodoc import sco_formsemestre
from app.scodoc import pe_tagtable from app.scodoc import pe_tagtable
from app.scodoc import pe_tools from app.scodoc import pe_tools
from app.scodoc import pe_semestretag from app.scodoc import pe_semestretag
@ -332,7 +333,7 @@ class JuryPE:
nt = self.get_cache_notes_d_un_semestre( nt = self.get_cache_notes_d_un_semestre(
self.context, sem["formsemestre_id"] self.context, sem["formsemestre_id"]
) )
# sco_core.get_notes_cache(context).get_NotesTable(context.Notes, sem['formsemestre_id']) # sco_core.get_notes_cache(context).get_NotesTable(context, sem['formsemestre_id'])
etudiantsDuSemestre = ( etudiantsDuSemestre = (
nt.get_etudids() nt.get_etudids()
) # nt.identdict.keys() # identification des etudiants du semestre ) # nt.identdict.keys() # identification des etudiants du semestre
@ -467,7 +468,7 @@ class JuryPE:
reponse = False reponse = False
etud = self.get_cache_etudInfo_d_un_etudiant(self.context, etudid) etud = self.get_cache_etudInfo_d_un_etudiant(self.context, etudid)
(_, parcours) = sco_report.get_codeparcoursetud(self.context.Notes, etud) (_, parcours) = sco_report.get_codeparcoursetud(self.context, etud)
if ( if (
len(set(sco_codes_parcours.CODES_SEM_REO.keys()) & set(parcours.values())) len(set(sco_codes_parcours.CODES_SEM_REO.keys()) & set(parcours.values()))
> 0 > 0
@ -499,7 +500,7 @@ class JuryPE:
lastdate = max(sesdates) # date de fin de l'inscription la plus récente lastdate = max(sesdates) # date de fin de l'inscription la plus récente
# if PETable.AFFICHAGE_DEBUG_PE == True : pe_tools.pe_print(" derniere inscription = ", lastDateSem) # if PETable.AFFICHAGE_DEBUG_PE == True : pe_tools.pe_print(" derniere inscription = ", lastDateSem)
semestresDeScoDoc = self.context.Notes.formsemestre_list() semestresDeScoDoc = sco_formsemestre.formsemestre_list(self.context)
semestresSuperieurs = [ semestresSuperieurs = [
sem for sem in semestresDeScoDoc if sem["semestre_id"] > sonDernierSidValide sem for sem in semestresDeScoDoc if sem["semestre_id"] > sonDernierSidValide
] # Semestre de rang plus élevé que son dernier sem valide ] # Semestre de rang plus élevé que son dernier sem valide
@ -531,7 +532,7 @@ class JuryPE:
etud = self.get_cache_etudInfo_d_un_etudiant(self.context, etudid) etud = self.get_cache_etudInfo_d_un_etudiant(self.context, etudid)
(code, parcours) = sco_report.get_codeparcoursetud( (code, parcours) = sco_report.get_codeparcoursetud(
self.context.Notes, etud self.context, etud
) # description = '1234:A', parcours = {1:ADM, 2:NAR, ...} ) # description = '1234:A', parcours = {1:ADM, 2:NAR, ...}
sonDernierSemestreValide = max( sonDernierSemestreValide = max(
[ [
@ -1141,7 +1142,7 @@ class JuryPE:
): # inutile en realité ! ): # inutile en realité !
"""Charge la table des notes d'un formsemestre""" """Charge la table des notes d'un formsemestre"""
return sco_core.get_notes_cache(context).get_NotesTable( return sco_core.get_notes_cache(context).get_NotesTable(
context.Notes, formsemestre_id context, formsemestre_id
) )
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
@ -1246,8 +1247,8 @@ def get_cosemestres_diplomants(context, semBase, avec_meme_formation=False):
> dont la formation est la même (optionnel) > dont la formation est la même (optionnel)
> ne prenant en compte que les etudiants sans redoublement > ne prenant en compte que les etudiants sans redoublement
""" """
tousLesSems = ( tousLesSems = sco_formsemestre.formsemestre_list(
context.Notes.formsemestre_list() context
) # tous les semestres memorises dans scodoc ) # tous les semestres memorises dans scodoc
diplome = get_annee_diplome_semestre(semBase) diplome = get_annee_diplome_semestre(semBase)

View File

@ -125,9 +125,7 @@ def doSignaleAbsence(
if moduleimpl_id and moduleimpl_id != "NULL": if moduleimpl_id and moduleimpl_id != "NULL":
mod = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] mod = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
formsemestre_id = mod["formsemestre_id"] formsemestre_id = mod["formsemestre_id"]
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
context.Notes, formsemestre_id
)
ues = nt.get_ues(etudid=etudid) ues = nt.get_ues(etudid=etudid)
for ue in ues: for ue in ues:
modimpls = nt.get_modimpls(ue_id=ue["ue_id"]) modimpls = nt.get_modimpls(ue_id=ue["ue_id"])
@ -186,9 +184,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
require_module = sco_preferences.get_preference( require_module = sco_preferences.get_preference(
context, "abs_require_module", formsemestre_id context, "abs_require_module", formsemestre_id
) )
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
context.Notes, formsemestre_id
)
ues = nt.get_ues(etudid=etudid) ues = nt.get_ues(etudid=etudid)
if require_module: if require_module:
menu_module = """ menu_module = """
@ -968,7 +964,7 @@ def _TablesAbsEtud(
ex = [] ex = []
for ev in a["evals"]: for ev in a["evals"]:
mod = sco_moduleimpl.do_moduleimpl_withmodule_list( mod = sco_moduleimpl.do_moduleimpl_withmodule_list(
context.Notes, moduleimpl_id=ev["moduleimpl_id"] context, moduleimpl_id=ev["moduleimpl_id"]
)[0] )[0]
if format == "html": if format == "html":
ex.append( ex.append(
@ -985,7 +981,7 @@ def _TablesAbsEtud(
ex = [] ex = []
for ev in a.get("absent", []): for ev in a.get("absent", []):
mod = sco_moduleimpl.do_moduleimpl_withmodule_list( mod = sco_moduleimpl.do_moduleimpl_withmodule_list(
context.Notes, moduleimpl_id=ev["moduleimpl_id"] context, moduleimpl_id=ev["moduleimpl_id"]
)[0] )[0]
if format == "html": if format == "html":
ex.append( ex.append(

View File

@ -389,7 +389,7 @@ apo_csv_store(context, csv_data, annee_scolaire, sem_id)
groups_infos = sco_groups_view.DisplayedGroupsInfos(context, [sco_groups.get_default_group(context, formsemestre_id)], formsemestre_id=formsemestre_id, REQUEST=REQUEST) groups_infos = sco_groups_view.DisplayedGroupsInfos(context, [sco_groups.get_default_group(context, formsemestre_id)], formsemestre_id=formsemestre_id, REQUEST=REQUEST)
nt = sco_core.get_notes_cache(context).get_NotesTable(context.Notes, formsemestre_id) nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
# #
s = SemSet(context, 'NSS29902') s = SemSet(context, 'NSS29902')

View File

@ -27,10 +27,11 @@
"""Evaluations """Evaluations
""" """
import datetime
import operator
import pprint
import time import time
import urllib import urllib
import operator
import datetime
from app.scodoc.notes_log import log, logCallStack from app.scodoc.notes_log import log, logCallStack
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -339,7 +340,7 @@ def do_evaluation_edit(context, REQUEST, args):
_check_evaluation_args(context, args) _check_evaluation_args(context, args)
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
context._evaluationEditor.edit(cnx, args) _evaluationEditor.edit(cnx, args)
# inval cache pour ce semestre # inval cache pour ce semestre
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
sco_core.inval_cache( sco_core.inval_cache(
@ -369,7 +370,7 @@ def do_evaluation_delete(context, REQUEST, evaluation_id):
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
context._evaluationEditor.delete(cnx, evaluation_id) _evaluationEditor.delete(cnx, evaluation_id)
# inval cache pour ce semestre # inval cache pour ce semestre
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
sco_core.inval_cache(context, formsemestre_id=M["formsemestre_id"]) # > eval delete sco_core.inval_cache(context, formsemestre_id=M["formsemestre_id"]) # > eval delete

View File

@ -274,8 +274,8 @@ def search_etud_in_accessible_depts(context, expnom=None, code_nip=None, REQUEST
""" """
result = [] result = []
accessible_depts = [] accessible_depts = []
dept_list = sco_mgr.get_dept_ids() depts = sco_mgr.get_dept_ids()
for dept in dept_list: for dept in depts:
# log('%s searching %s' % (str(REQUEST.AUTHENTICATED_USER),dept)) # log('%s searching %s' % (str(REQUEST.AUTHENTICATED_USER),dept))
if REQUEST.AUTHENTICATED_USER.has_permission(Permission.ScoView, dept=dept): if REQUEST.AUTHENTICATED_USER.has_permission(Permission.ScoView, dept=dept):
if expnom or code_nip: if expnom or code_nip:

View File

@ -221,6 +221,9 @@ def etapes_apo_str(etapes):
def do_formsemestre_create(context, args, REQUEST, silent=False): def do_formsemestre_create(context, args, REQUEST, silent=False):
"create a formsemestre" "create a formsemestre"
from app.scodoc import sco_groups
from app.scodoc import sco_news
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
formsemestre_id = _formsemestreEditor.create(cnx, args) formsemestre_id = _formsemestreEditor.create(cnx, args)
if args["etapes"]: if args["etapes"]:

View File

@ -1043,7 +1043,9 @@ def do_formsemestre_clone(
args = e.copy() args = e.copy()
del args["jour"] # erase date del args["jour"] # erase date
args["moduleimpl_id"] = mid args["moduleimpl_id"] = mid
_ = sco_evaluations.do_evaluation_create(context, REQUEST=REQUEST, **args) _ = sco_evaluations.do_evaluation_create(
context, REQUEST=REQUEST, **args
)
# 3- copy uecoefs # 3- copy uecoefs
objs = sco_formsemestre.formsemestre_uecoef_list( objs = sco_formsemestre.formsemestre_uecoef_list(
@ -1345,7 +1347,7 @@ def do_formsemestre_delete(context, formsemestre_id, REQUEST):
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
# --- Destruction des modules de ce semestre # --- Destruction des modules de ce semestre
mods = sco_moduleimpl.do_moduleimpl_list(formsemestre_id=formsemestre_id) mods = sco_moduleimpl.do_moduleimpl_list(context, formsemestre_id=formsemestre_id)
for mod in mods: for mod in mods:
# evaluations # evaluations
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list(
@ -1535,7 +1537,6 @@ 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
context = context.Notes # si appele d'en haut, eg par exception ScoValueError
ok, err = sco_permissions_check.check_access_diretud( ok, err = sco_permissions_check.check_access_diretud(
context, formsemestre_id, REQUEST context, formsemestre_id, REQUEST
) )

View File

@ -346,7 +346,7 @@ def formsemestre_inscription_with_modules(
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer(context, REQUEST)
# Check 1: déjà inscrit ici ? # Check 1: déjà inscrit ici ?
ins = context.Notes.do_formsemestre_inscription_list({"etudid": etudid}) ins = do_formsemestre_inscription_list(context, {"etudid": etudid})
already = False already = False
for i in ins: for i in ins:
if i["formsemestre_id"] == formsemestre_id: if i["formsemestre_id"] == formsemestre_id:

View File

@ -527,10 +527,6 @@ def formsemestre_page_title(context, REQUEST):
"""Element HTML decrivant un semestre (barre de menu et infos) """Element HTML decrivant un semestre (barre de menu et infos)
Cherche dans REQUEST si un semestre est défini (formsemestre_id ou moduleimpl ou evaluation ou group) Cherche dans REQUEST si un semestre est défini (formsemestre_id ou moduleimpl ou evaluation ou group)
""" """
try:
context = context.Notes
except:
pass
formsemestre_id = retreive_formsemestre_from_request(context, REQUEST) formsemestre_id = retreive_formsemestre_from_request(context, REQUEST)
# #
if not formsemestre_id: if not formsemestre_id:

View File

@ -442,7 +442,7 @@ def XMLgetGroupsInPartition(context, partition_id, REQUEST=None): # was XMLgetG
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
groups = get_partition_groups(context, partition) groups = get_partition_groups(context, partition)
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context.Notes, formsemestre_id context, formsemestre_id
) # > inscrdict ) # > inscrdict
etuds_set = set(nt.inscrdict) etuds_set = set(nt.inscrdict)
# XML response: # XML response:
@ -595,7 +595,9 @@ def change_etud_group_in_partition(
) )
cnx.commit() cnx.commit()
# 4- invalidate cache # 4- invalidate cache
context.Notes._inval_cache(formsemestre_id=formsemestre_id) # > change etud group sco_core.inval_cache(
context, formsemestre_id=formsemestre_id
) # > change etud group
def setGroups( def setGroups(
@ -948,8 +950,8 @@ def partition_set_attr(context, partition_id, attr, value, REQUEST=None):
partition[attr] = value partition[attr] = value
partitionEditor.edit(cnx, partition) partitionEditor.edit(cnx, partition)
# invalid bulletin cache # invalid bulletin cache
context.Notes._inval_cache( sco_core.inval_cache(
pdfonly=True, formsemestre_id=partition["formsemestre_id"] context, pdfonly=True, formsemestre_id=partition["formsemestre_id"]
) )
return "enregistré" return "enregistré"
@ -1187,6 +1189,8 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
"""Reparti les etudiants dans des groupes dans une partition, en respectant le niveau """Reparti les etudiants dans des groupes dans une partition, en respectant le niveau
et la mixité. et la mixité.
""" """
from app.scodoc import sco_formsemestre
partition = get_partition(context, partition_id) partition = get_partition(context, partition_id)
formsemestre_id = partition["formsemestre_id"] formsemestre_id = partition["formsemestre_id"]
# renvoie sur page édition groupes # renvoie sur page édition groupes
@ -1260,7 +1264,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
) )
# #
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context.Notes, formsemestre_id context, formsemestre_id
) # > identdict ) # > identdict
identdict = nt.identdict identdict = nt.identdict
# build: { civilite : liste etudids trie par niveau croissant } # build: { civilite : liste etudids trie par niveau croissant }
@ -1268,7 +1272,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
listes = {} listes = {}
for civilite in civilites: for civilite in civilites:
listes[civilite] = [ listes[civilite] = [
(get_prev_moy(context.Notes, x["etudid"], formsemestre_id), x["etudid"]) (get_prev_moy(context, x["etudid"], formsemestre_id), x["etudid"])
for x in identdict.values() for x in identdict.values()
if x["civilite"] == civilite if x["civilite"] == civilite
] ]
@ -1472,6 +1476,8 @@ def form_group_choice(
"""Partie de formulaire pour le choix d'un ou plusieurs groupes. """Partie de formulaire pour le choix d'un ou plusieurs groupes.
Variable : group_ids Variable : group_ids
""" """
from app.scodoc import sco_formsemestre
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if display_sem_title: if display_sem_title:
sem_title = "%s: " % sem["titremois"] sem_title = "%s: " % sem["titremois"]

View File

@ -791,10 +791,10 @@ def groups_table(
sco_etud.etud_add_lycee_infos(etud) sco_etud.etud_add_lycee_infos(etud)
# et ajoute le parcours # et ajoute le parcours
Se = sco_parcours_dut.SituationEtudParcours( Se = sco_parcours_dut.SituationEtudParcours(
context.Notes, etud, groups_infos.formsemestre_id context, etud, groups_infos.formsemestre_id
) )
m["parcours"] = Se.get_parcours_descr() m["parcours"] = Se.get_parcours_descr()
m["codeparcours"], _ = sco_report.get_codeparcoursetud(context.Notes, etud) m["codeparcours"], _ = sco_report.get_codeparcoursetud(context, etud)
def dicttakestr(d, keys): def dicttakestr(d, keys):
r = [] r = []

View File

@ -232,7 +232,7 @@ def students_import_excel(
"import students from Excel file" "import students from Excel file"
diag = scolars_import_excel_file( diag = scolars_import_excel_file(
csvfile, csvfile,
context.Notes, context,
REQUEST, REQUEST,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
check_homonyms=check_homonyms, check_homonyms=check_homonyms,
@ -490,7 +490,7 @@ def scolars_import_excel_file(
cnx.commit() cnx.commit()
# Invalide les caches des semestres dans lesquels on a inscrit des etudiants: # Invalide les caches des semestres dans lesquels on a inscrit des etudiants:
context.Notes._inval_cache(formsemestre_id_list=formsemestre_to_invalidate) sco_core.inval_cache(context, formsemestre_id_list=formsemestre_to_invalidate)
return diag return diag

View File

@ -211,7 +211,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
for sem in info["sems"]: for sem in info["sems"]:
if sem["ins"]["etat"] != "I": if sem["ins"]["etat"] != "I":
descr, _ = etud_descr_situation_semestre( descr, _ = etud_descr_situation_semestre(
context.Notes, context,
etudid, etudid,
sem["formsemestre_id"], sem["formsemestre_id"],
info["ne"], info["ne"],
@ -239,10 +239,10 @@ def ficheEtud(context, etudid=None, REQUEST=None):
if info["sems"]: if info["sems"]:
Se = sco_parcours_dut.SituationEtudParcours( Se = sco_parcours_dut.SituationEtudParcours(
context.Notes, etud, info["last_formsemestre_id"] context, etud, info["last_formsemestre_id"]
) )
info["liste_inscriptions"] = formsemestre_recap_parcours_table( info["liste_inscriptions"] = formsemestre_recap_parcours_table(
context.Notes, context,
Se, Se,
etudid, etudid,
with_links=False, with_links=False,
@ -535,7 +535,7 @@ def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False):
Used for popups information windows. Used for popups information windows.
""" """
try: try:
context = context.Notes context = context
except: except:
pass pass
# log('etud_info_html: %s' % REQUEST.QUERY_STRING) # log('etud_info_html: %s' % REQUEST.QUERY_STRING)
@ -551,7 +551,7 @@ def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False):
) )
# experimental: may be too slow to be here # experimental: may be too slow to be here
etud["codeparcours"], etud["decisions_jury"] = sco_report.get_codeparcoursetud( etud["codeparcours"], etud["decisions_jury"] = sco_report.get_codeparcoursetud(
context.Notes, etud, prefix="S", separator=", " context, etud, prefix="S", separator=", "
) )
bac = sco_bac.Baccalaureat(etud["bac"], etud["specialite"]) bac = sco_bac.Baccalaureat(etud["bac"], etud["specialite"])

View File

@ -112,11 +112,12 @@ get_base_preferences(context, formsemestre_id)
""" """
from flask import g from flask import g
import app.scodoc.sco_utils as scu from app.scodoc import sco_core
import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
from app.scodoc.sco_exceptions import ScoValueError, ScoException from app.scodoc.sco_exceptions import ScoValueError, ScoException
from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.TrivialFormulator import TrivialFormulator
import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu
_SCO_BASE_PREFERENCES = {} # { URL: BasePreferences instance } _SCO_BASE_PREFERENCES = {} # { URL: BasePreferences instance }
@ -1919,7 +1920,7 @@ class BasePreferences(object):
# les preferences peuvent affecter les PDF cachés et les notes calculées: # les preferences peuvent affecter les PDF cachés et les notes calculées:
if modif: if modif:
self.context.Notes._inval_cache(pdfonly=False) # > modif preferences sco_core.inval_cache(self.context, pdfonly=False) # > modif preferences
finally: finally:
scu.GSL.release() scu.GSL.release()
@ -1947,7 +1948,7 @@ class BasePreferences(object):
if pdb: if pdb:
log("deleting pref sem=%s %s" % (formsemestre_id, name)) log("deleting pref sem=%s %s" % (formsemestre_id, name))
self._editor.delete(cnx, pdb[0]["pref_id"]) self._editor.delete(cnx, pdb[0]["pref_id"])
self.context.Notes._inval_cache(pdfonly=False) # > modif preferences sco_core.inval_cache(self.context, pdfonly=False) # > modif preferences
finally: finally:
scu.GSL.release() scu.GSL.release()
@ -2091,7 +2092,9 @@ class SemPreferences(object):
) # a bug ! ) # a bug !
sem = sco_formsemestre.get_formsemestre(self.context, self.formsemestre_id) sem = sco_formsemestre.get_formsemestre(self.context, self.formsemestre_id)
H = [ H = [
self.context.Notes.html_sem_header(REQUEST, "Préférences du semestre", sem), html_sco_header.html_sem_header(
self.context, REQUEST, "Préférences du semestre", sem
),
""" """
<p class="help">Les paramètres définis ici ne s'appliqueront qu'à ce semestre.</p> <p class="help">Les paramètres définis ici ne s'appliqueront qu'à ce semestre.</p>
<p class="msg">Attention: cliquez sur "Enregistrer les modifications" en bas de page pour appliquer vos changements !</p> <p class="msg">Attention: cliquez sur "Enregistrer les modifications" en bas de page pour appliquer vos changements !</p>

View File

@ -10,4 +10,4 @@ essais_bp = Blueprint("essais", __name__)
from app.views import notes, scolar, absences, essais from app.views import notes, scolar, absences, essais
scolar.context.Notes = notes.context scolar.context.Notes = notes.context # XXX transitoire #sco8

View File

@ -240,7 +240,7 @@ def SignaleAbsenceGrHebdo(
[ [
x["etudid"] x["etudid"]
for x in sco_moduleimpl.do_moduleimpl_inscription_list( for x in sco_moduleimpl.do_moduleimpl_inscription_list(
context.Notes, moduleimpl_id=moduleimpl_id context, moduleimpl_id=moduleimpl_id
) )
] ]
) )
@ -250,9 +250,7 @@ def SignaleAbsenceGrHebdo(
else: else:
# Si aucun etudiant n'est inscrit au module choisi... # Si aucun etudiant n'est inscrit au module choisi...
moduleimpl_id = None moduleimpl_id = None
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
context.Notes, formsemestre_id
)
sem = sco_formsemestre.do_formsemestre_list( sem = sco_formsemestre.do_formsemestre_list(
context, {"formsemestre_id": formsemestre_id} context, {"formsemestre_id": formsemestre_id}
)[0] )[0]
@ -406,7 +404,7 @@ def SignaleAbsenceGrSemestre(
[ [
x["etudid"] x["etudid"]
for x in sco_moduleimpl.do_moduleimpl_inscription_list( for x in sco_moduleimpl.do_moduleimpl_inscription_list(
context.Notes, moduleimpl_id=moduleimpl_id context, moduleimpl_id=moduleimpl_id
) )
] ]
) )
@ -425,9 +423,7 @@ def SignaleAbsenceGrSemestre(
base_url = base_url_noweeks + "&nbweeks=%s" % nbweeks # sans le moduleimpl_id base_url = base_url_noweeks + "&nbweeks=%s" % nbweeks # sans le moduleimpl_id
if etuds: if etuds:
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(context, formsemestre_id)
context.Notes, formsemestre_id
)
sem = sco_formsemestre.do_formsemestre_list( sem = sco_formsemestre.do_formsemestre_list(
context, {"formsemestre_id": formsemestre_id} context, {"formsemestre_id": formsemestre_id}
)[0] )[0]
@ -643,7 +639,7 @@ def _gen_form_saisie_groupe(
cap = [] cap = []
if etud["cursem"]: if etud["cursem"]:
nt = sco_core.get_notes_cache(context).get_NotesTable( nt = sco_core.get_notes_cache(context).get_NotesTable(
context.Notes, etud["cursem"]["formsemestre_id"] context, etud["cursem"]["formsemestre_id"]
) # > get_ues, get_etud_ue_status ) # > get_ues, get_etud_ue_status
for ue in nt.get_ues(): for ue in nt.get_ues():
status = nt.get_etud_ue_status(etudid, ue["ue_id"]) status = nt.get_etud_ue_status(etudid, ue["ue_id"])
@ -850,8 +846,8 @@ def EtatAbsencesGr(
init_qtip=True, init_qtip=True,
javascripts=["js/etud_info.js"], javascripts=["js/etud_info.js"],
), ),
html_title=context.Notes.html_sem_header( html_title=html_sco_header.html_sem_header(
REQUEST, "%s" % title, sem, with_page_header=False context, REQUEST, "%s" % title, sem, with_page_header=False
) )
+ "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin), + "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin),
base_url="%s&formsemestre_id=%s&debut=%s&fin=%s" base_url="%s&formsemestre_id=%s&debut=%s&fin=%s"

View File

@ -89,6 +89,7 @@ from app.scodoc import sco_import_etuds
from app.scodoc import sco_abs from app.scodoc import sco_abs
from app.scodoc import sco_archives_etud from app.scodoc import sco_archives_etud
from app.scodoc import sco_codes_parcours from app.scodoc import sco_codes_parcours
from app.scodoc import sco_core
from app.scodoc import sco_debouche from app.scodoc import sco_debouche
from app.scodoc import sco_dept from app.scodoc import sco_dept
from app.scodoc import sco_dump_db from app.scodoc import sco_dump_db
@ -197,7 +198,7 @@ def edit_preferences(context, REQUEST):
def formsemestre_edit_preferences(context, formsemestre_id, REQUEST): def formsemestre_edit_preferences(context, formsemestre_id, REQUEST):
"""Edit preferences for a semestre""" """Edit preferences for a semestre"""
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context.Notes, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
ok = ( ok = (
authuser.has_permission(Permission.ScoImplement) authuser.has_permission(Permission.ScoImplement)
or ((str(authuser) in sem["responsables"]) and sem["resp_can_edit"]) or ((str(authuser) in sem["responsables"]) and sem["resp_can_edit"])
@ -1411,8 +1412,8 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
# Inval semesters with this student: # Inval semesters with this student:
to_inval = [s["formsemestre_id"] for s in etud["sems"]] to_inval = [s["formsemestre_id"] for s in etud["sems"]]
if to_inval: if to_inval:
context.Notes._inval_cache( sco_core.inval_cache(
formsemestre_id_list=to_inval context, formsemestre_id_list=to_inval
) # > etudident_create_or_edit ) # > etudident_create_or_edit
# #
return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid)
@ -1476,7 +1477,7 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
# Inval semestres où il était inscrit: # Inval semestres où il était inscrit:
to_inval = [s["formsemestre_id"] for s in etud["sems"]] to_inval = [s["formsemestre_id"] for s in etud["sems"]]
if to_inval: if to_inval:
context.Notes._inval_cache(formsemestre_id_list=to_inval) # > sco_core.inval_cache(context, formsemestre_id_list=to_inval) # >
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
scu.ScoURL() + r"?head_message=Etudiant%20supprimé" scu.ScoURL() + r"?head_message=Etudiant%20supprimé"
) )
@ -1499,8 +1500,11 @@ def check_group_apogee(
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
H = [ H = [
context.Notes.html_sem_header( html_sco_header.html_sem_header(
REQUEST, "Etudiants du %s" % (group["group_name"] or "semestre"), sem context,
REQUEST,
"Etudiants du %s" % (group["group_name"] or "semestre"),
sem,
), ),
'<table class="sortable" id="listegroupe">', '<table class="sortable" id="listegroupe">',
"<tr><th>Nom</th><th>Nom usuel</th><th>Prénom</th><th>Mail</th><th>NIP (ScoDoc)</th><th>Apogée</th></tr>", "<tr><th>Nom</th><th>Nom usuel</th><th>Prénom</th><th>Mail</th><th>NIP (ScoDoc)</th><th>Apogée</th></tr>",
@ -1628,7 +1632,7 @@ def check_group_apogee(
def form_students_import_excel(context, REQUEST, formsemestre_id=None): def form_students_import_excel(context, REQUEST, formsemestre_id=None):
"formulaire import xls" "formulaire import xls"
if formsemestre_id: if formsemestre_id:
sem = sco_formsemestre.get_formsemestre(context.Notes, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
dest_url = ( dest_url = (
scu.ScoURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id scu.ScoURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
) )
@ -1793,7 +1797,7 @@ def import_generate_admission_sample(context, REQUEST, formsemestre_id):
only_tables=["identite", "admissions", "adresse"], only_tables=["identite", "admissions", "adresse"],
exclude_cols=["nationalite", "foto", "photo_filename"], exclude_cols=["nationalite", "foto", "photo_filename"],
group_ids=[group["group_id"]], group_ids=[group["group_id"]],
context=context.Notes, context=context,
REQUEST=REQUEST, REQUEST=REQUEST,
) )
return sco_excel.sendExcelFile(REQUEST, data, "AdmissionEtudiants.xls") return sco_excel.sendExcelFile(REQUEST, data, "AdmissionEtudiants.xls")
@ -1915,7 +1919,7 @@ def _students_import_admission(
"import donnees admission from Excel file (v2016)" "import donnees admission from Excel file (v2016)"
diag = sco_import_etuds.scolars_import_admission( diag = sco_import_etuds.scolars_import_admission(
csvfile, csvfile,
context.Notes, context,
REQUEST, REQUEST,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
type_admission=type_admission, type_admission=type_admission,
@ -1950,10 +1954,10 @@ def formsemestre_import_etud_admission(
unknowns, unknowns,
changed_mails, changed_mails,
) = sco_synchro_etuds.formsemestre_import_etud_admission( ) = sco_synchro_etuds.formsemestre_import_etud_admission(
context.Notes, formsemestre_id, import_identite=True, import_email=import_email context, formsemestre_id, import_identite=True, import_email=import_email
) )
H = [ H = [
context.Notes.html_sem_header(REQUEST, "Reimport données admission"), html_sco_header.html_sem_header(context, REQUEST, "Reimport données admission"),
"<h3>Opération effectuée</h3>", "<h3>Opération effectuée</h3>",
] ]
if no_nip: if no_nip: