Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
ac882e9c
Commit
ac882e9c
authored
1 year ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Fix: cache poids evals (invalidation manquante)
parent
000e0169
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/comp/df_cache.py
+25
-0
25 additions, 0 deletions
app/comp/df_cache.py
app/scodoc/sco_cache.py
+4
-1
4 additions, 1 deletion
app/scodoc/sco_cache.py
with
29 additions
and
1 deletion
app/comp/df_cache.py
+
25
−
0
View file @
ac882e9c
...
...
@@ -27,6 +27,7 @@
"""
caches pour tables APC
"""
from
flask
import
g
from
app.scodoc
import
sco_cache
...
...
@@ -47,3 +48,27 @@ class EvaluationsPoidsCache(sco_cache.ScoDocCache):
"""
prefix
=
"
EPC
"
@classmethod
def
invalidate_all
(
cls
):
"
delete all cached evaluations poids (in current dept)
"
from
app.models.formsemestre
import
FormSemestre
from
app.models.moduleimpls
import
ModuleImpl
moduleimpl_ids
=
[
mi
.
id
for
mi
in
ModuleImpl
.
query
.
join
(
FormSemestre
).
filter_by
(
dept_id
=
g
.
scodoc_dept_id
)
]
cls
.
delete_many
(
moduleimpl_ids
)
@classmethod
def
invalidate_sem
(
cls
,
formsemestre_id
):
"
delete cached evaluations poids for this formsemestre from cache
"
from
app.models.moduleimpls
import
ModuleImpl
moduleimpl_ids
=
[
mi
.
id
for
mi
in
ModuleImpl
.
query
.
filter_by
(
formsemestre_id
=
formsemestre_id
)
]
cls
.
delete_many
(
moduleimpl_ids
)
This diff is collapsed.
Click to expand it.
app/scodoc/sco_cache.py
+
4
−
1
View file @
ac882e9c
...
...
@@ -274,6 +274,7 @@ def invalidate_formsemestre( # was inval_cache(formsemestre_id=None, pdfonly=Fa
"""
expire cache pour un semestre (ou tous ceux du département si formsemestre_id non spécifié).
Si pdfonly, n
'
expire que les bulletins pdf cachés.
"""
from
app.comp
import
df_cache
from
app.models.formsemestre
import
FormSemestre
from
app.scodoc
import
sco_cursus
...
...
@@ -315,12 +316,14 @@ def invalidate_formsemestre( # was inval_cache(formsemestre_id=None, pdfonly=Fa
and
fid
in
g
.
formsemestre_results_cache
):
del
g
.
formsemestre_results_cache
[
fid
]
df_cache
.
EvaluationsPoidsCache
.
invalidate_sem
(
formsemestre_id
)
else
:
# optimization when we invalidate all evaluations:
EvaluationCache
.
invalidate_all_sems
()
df_cache
.
EvaluationsPoidsCache
.
invalidate_all
()
if
hasattr
(
g
,
"
formsemestre_results_cache
"
):
del
g
.
formsemestre_results_cache
SemInscriptionsCache
.
delete_many
(
formsemestre_ids
)
ResultatsSemestreCache
.
delete_many
(
formsemestre_ids
)
ValidationsSemestreCache
.
delete_many
(
formsemestre_ids
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment