forked from ScoDoc/ScoDoc
Cache table recap: combinaisons evals/jury
This commit is contained in:
parent
a84a5da836
commit
83e271ad8c
@ -229,6 +229,26 @@ class TableRecapWithEvalsCache(ScoDocCache):
|
|||||||
duration = 12 * 60 * 60 # ttl 12h
|
duration = 12 * 60 * 60 # ttl 12h
|
||||||
|
|
||||||
|
|
||||||
|
class TableJuryCache(ScoDocCache):
|
||||||
|
"""Cache table recap (pour TableRecap)
|
||||||
|
Clé: formsemestre_id
|
||||||
|
Valeur: le html (<div class="table_recap">...</div>)
|
||||||
|
"""
|
||||||
|
|
||||||
|
prefix = "RECAPJURY"
|
||||||
|
duration = 12 * 60 * 60 # ttl 12h
|
||||||
|
|
||||||
|
|
||||||
|
class TableJuryWithEvalsCache(ScoDocCache):
|
||||||
|
"""Cache table recap (pour TableRecap)
|
||||||
|
Clé: formsemestre_id
|
||||||
|
Valeur: le html (<div class="table_recap">...</div>)
|
||||||
|
"""
|
||||||
|
|
||||||
|
prefix = "RECAPJURYWITHEVALS"
|
||||||
|
duration = 12 * 60 * 60 # ttl 12h
|
||||||
|
|
||||||
|
|
||||||
def invalidate_formsemestre( # was inval_cache(formsemestre_id=None, pdfonly=False)
|
def invalidate_formsemestre( # was inval_cache(formsemestre_id=None, pdfonly=False)
|
||||||
formsemestre_id=None, pdfonly=False
|
formsemestre_id=None, pdfonly=False
|
||||||
):
|
):
|
||||||
|
@ -447,11 +447,14 @@ def gen_formsemestre_recapcomplet_html_table(
|
|||||||
"""
|
"""
|
||||||
table = None
|
table = None
|
||||||
table_html = None
|
table_html = None
|
||||||
|
cache_class = {
|
||||||
|
(True, True): sco_cache.TableJuryWithEvalsCache,
|
||||||
|
(True, False): sco_cache.TableJuryCache,
|
||||||
|
(False, True): sco_cache.TableRecapWithEvalsCache,
|
||||||
|
(False, False): sco_cache.TableRecapCache,
|
||||||
|
}[(bool(mode_jury), bool(include_evaluations))]
|
||||||
if not selected_etudid:
|
if not selected_etudid:
|
||||||
if include_evaluations:
|
table_html = cache_class.get(formsemestre.id)
|
||||||
table_html = sco_cache.TableRecapWithEvalsCache.get(formsemestre.id)
|
|
||||||
else:
|
|
||||||
table_html = sco_cache.TableRecapCache.get(formsemestre.id)
|
|
||||||
if table_html is None:
|
if table_html is None:
|
||||||
table = _gen_formsemestre_recapcomplet_table(
|
table = _gen_formsemestre_recapcomplet_table(
|
||||||
formsemestre,
|
formsemestre,
|
||||||
@ -462,10 +465,7 @@ def gen_formsemestre_recapcomplet_html_table(
|
|||||||
selected_etudid=selected_etudid,
|
selected_etudid=selected_etudid,
|
||||||
)
|
)
|
||||||
table_html = table.html()
|
table_html = table.html()
|
||||||
if include_evaluations:
|
cache_class.set(formsemestre.id, table_html)
|
||||||
sco_cache.TableRecapWithEvalsCache.set(formsemestre.id, table_html)
|
|
||||||
else:
|
|
||||||
sco_cache.TableRecapCache.set(formsemestre.id, table_html)
|
|
||||||
|
|
||||||
return table_html, table
|
return table_html, table
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user