1
0
forked from ScoDoc/ScoDoc

Edition formation / invalidation caches

This commit is contained in:
Emmanuel Viennet 2022-02-14 18:33:36 +01:00
parent 0196d411b4
commit c361ccb362
6 changed files with 24 additions and 13 deletions

View File

@ -365,6 +365,7 @@ def ue_move(ue_id, after=0, redirect=1):
if len({o.numero for o in others}) != len(others):
# il y a des numeros identiques !
scu.objects_renumber(db, others)
ue.formation.invalidate_cached_sems()
if len(others) > 1:
idx = [u.id for u in others].index(ue.id)
neigh = None # object to swap with

View File

@ -88,13 +88,14 @@ def do_matiere_create(args):
r = _matiereEditor.create(cnx, args)
# news
F = sco_formations.formation_list(args={"formation_id": ue["formation_id"]})[0]
formation = Formation.query.get(ue["formation_id"])
sco_news.add(
typ=sco_news.NEWS_FORM,
object=ue["formation_id"],
text="Modification de la formation %(acronyme)s" % F,
text="Modification de la formation {formation.acronyme}",
max_frequency=3,
)
formation.invalidate_cached_sems()
return r
@ -195,13 +196,14 @@ def do_matiere_delete(oid):
_matiereEditor.delete(cnx, oid)
# news
F = sco_formations.formation_list(args={"formation_id": ue["formation_id"]})[0]
formation = Formation.query.get(ue["formation_id"])
sco_news.add(
typ=sco_news.NEWS_FORM,
object=ue["formation_id"],
text="Modification de la formation %(acronyme)s" % F,
text="Modification de la formation {formation.acronyme}",
max_frequency=3,
)
formation.invalidate_cached_sems()
def matiere_delete(matiere_id=None):

View File

@ -104,13 +104,14 @@ def do_module_create(args) -> int:
r = _moduleEditor.create(cnx, args)
# news
F = sco_formations.formation_list(args={"formation_id": args["formation_id"]})[0]
formation = Formation.query.get(args["formation_id"])
sco_news.add(
typ=sco_news.NEWS_FORM,
object=args["formation_id"],
text="Modification de la formation %(acronyme)s" % F,
object=formation.id,
text=f"Modification de la formation {formation.acronyme}",
max_frequency=3,
)
formation.invalidate_cached_sems()
return r
@ -394,13 +395,14 @@ def do_module_delete(oid):
_moduleEditor.delete(cnx, oid)
# news
F = sco_formations.formation_list(args={"formation_id": mod["formation_id"]})[0]
formation = module.formation
sco_news.add(
typ=sco_news.NEWS_FORM,
object=mod["formation_id"],
text="Modification de la formation %(acronyme)s" % F,
text=f"Modification de la formation {formation.acronyme}",
max_frequency=3,
)
formation.invalidate_cached_sems()
def module_delete(module_id=None):

View File

@ -128,13 +128,14 @@ def do_ue_create(args):
formation = Formation.query.get(args["formation_id"])
formation.invalidate_module_coefs()
# news
F = sco_formations.formation_list(args={"formation_id": args["formation_id"]})[0]
formation = Formation.query.get(args["formation_id"])
sco_news.add(
typ=sco_news.NEWS_FORM,
object=args["formation_id"],
text="Modification de la formation %(acronyme)s" % F,
text="Modification de la formation {formation.acronyme}",
max_frequency=3,
)
formation.invalidate_cached_sems()
return ue_id
@ -361,7 +362,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
{
"size": 12,
"title": "Code UE",
"explanation": "code interne (optionnel). Toutes les UE partageant le même code (et le même code de formation) sont compatibles (compensation de semestres, capitalisation d'UE). Voir liste ci-dessous.",
"explanation": "code interne (non vide). Toutes les UE partageant le même code (et le même code de formation) sont compatibles (compensation de semestres, capitalisation d'UE). Voir liste ci-dessous.",
},
),
(

View File

@ -35,6 +35,11 @@
<b>{{ue.acronyme}}</b> <a class="discretelink" href="{{
url_for('notes.ue_infos', scodoc_dept=g.scodoc_dept, ue_id=ue.id)}}"
>{{ue.titre}}</a>
{% set virg = joiner(", ") %}
<span class="ue_code">(
{%- if ue.ue_code -%}{{ virg() }}code {{ue.ue_code}} {%- endif -%}
{{ virg() }}{{ue.ects or 0}} ECTS)
</span>
</span>
{% if editable and not ue.is_locked() %}

View File

@ -12,7 +12,7 @@
<li>{{ue.acronyme}}
<ul>
<li>Semestre: {{ue.semestre_idx}}</li>
<li>Code: {{ue.code}}</li>
<li>Code: <tt>{{ue.ue_code}}</tt></li>
<li>Type: {{ue.type}}</li>
<li>Externe: {{ "oui" if ue.is_external else "non" }}</li>
<li>Code Apogée: {{ue.code_apogee}}</li>