Skip to content
Snippets Groups Projects
Commit c4e58cd3 authored by DELARUELLE Myriam's avatar DELARUELLE Myriam
Browse files

disable caching for courses with 1000+ students

parent c1caabb5
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
data=calcPercentage(JSON.parse(request));
//initGroupFilter();
changeSection();
localStorage.setItem("groups",request);
if(data.students.length<1000){
localStorage.setItem("groups",request);
}
displayTotalGroupsFilter(false);
}
});
......@@ -296,7 +300,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
}
localStorage.setItem("activities",JSON.stringify(activitiesToStore));
if(data.students.length<1000){
localStorage.setItem("activities",JSON.stringify(activitiesToStore));
}
if(changefilter==true){
reloadTable(data);
}
......
......@@ -348,6 +348,7 @@ if (isset($_POST['groupsid'])) {
}
$countstudents=count_enrolled_users($context);
$cache = cache::make('format_iena', 'students');
//Si le progrès de chacun des groupes existe déjà en cache on va les charger, sinon on les récupère dans la BDD et on les stocke
......@@ -368,7 +369,11 @@ for($i=0; $i<count($activegroupsids); $i++){
'',
$context
);
$cache->set($activegroupsids[$i], $progressrequest);
//On active le cache seulement s'il y a plus de x étudiants
if($countstudents<1000){
$cache->set($activegroupsids[$i], $progressrequest);
}
$progress=$progressrequest;
}
$arrayprogress=(object) array_unique(array_merge((array) $arrayprogress, (array) $progress), SORT_REGULAR);
......@@ -486,7 +491,7 @@ else if (isset($_POST['action']) && !empty($_POST['action'])) {
$data = set_filters($data, $filters, $symbols, $sections, array_values($groups), $groupsall->current_user_groups, $groupsall->othergroups, $activesectionid);
$data = set_data($data, $modules, $arrayprogress, $groups, $activegroupsids, $activesectionid, $listoptions);
$data["countstudents"]=$countstudents;
if (isset($_GET["msg_success"])) {
$msg = $_GET["msg_success"];
$data["msg_success"] = $msg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment