diff --git a/app/models/events.py b/app/models/events.py index ccb6396e50..9725f3c8a7 100644 --- a/app/models/events.py +++ b/app/models/events.py @@ -102,9 +102,15 @@ class ScolarNews(db.Model): } @classmethod - def last_news(cls, n=1) -> list: + def last_news(cls, n=1, dept_id=None, filter_dept=True) -> list: "The most recent n news. Returns list of ScolarNews instances." - return cls.query.order_by(cls.date.desc()).limit(n).all() + query = cls.query + if filter_dept: + if dept_id is None: + dept_id = g.scodoc_dept_id + query = query.filter_by(dept_id=dept_id) + + return query.order_by(cls.date.desc()).limit(n).all() @classmethod def add(cls, typ, obj=None, text="", url=None, max_frequency=0): diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index be2523bbc4..c6811d4547 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -222,7 +222,7 @@ def do_ue_delete(ue_id, delete_validations=False, force=False): ScolarNews.add( typ=ScolarNews.NEWS_FORM, obj=ue.formation_id, - text="Modification de la formation %(acronyme)s" % F, + text=f"Modification de la formation {F['acronyme']}", max_frequency=10 * 60, ) # diff --git a/sco_version.py b/sco_version.py index 0f7ec6c57b..4380a1fa58 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.2.1" +SCOVERSION = "9.2.2" SCONAME = "ScoDoc"