diff --git a/amd/build/suivi.js b/amd/build/suivi.js index a1359261d2ed1882f673daeb6ab2b3c80f09a1fe..c6e6a85a0f5fe9d65aaa0d71dcd24be0493c1c8d 100644 --- a/amd/build/suivi.js +++ b/amd/build/suivi.js @@ -223,14 +223,23 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], if(groupsid.length==0){ groupsid.push(-2); } + + // FAIRE EN JS ? + // OUI : sinon le cache va tout défoncer + // NON : performances + // Pour les gros cours, on mettrait les paramas des activités à envoyer + //var params=[]; + $.ajax({ url: completeUrl, data: {action: 'fetchgroups', groupsid:groupsid}, type: 'post', success: function(request) { - showHideActivities(); parsedrequest=JSON.parse(request); - data=calcPercentage(parsedrequest); + data=parsedrequest; + showHideActivities(); + data=calcPercentage(data); + showHideStudents(); if(data.countstudents<1500){ @@ -239,6 +248,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], localStorage.setItem("groups",JSON.stringify(parsedrequest["groups"])); } + reloadTable(data); updateGroupsFilterLabel(false); } @@ -380,6 +390,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], var arrayActivitiesID=[]; var activitiesToStore=[]; var activities = $('input[name="options[]"]'); + for(var i=0; i<activities.length;i++){ prog=data.modules.find(element => element.id === activities[i].value); @@ -400,7 +411,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], if(data.countstudents<1500){ localStorage.setItem("activities",JSON.stringify(activitiesToStore)); } - + /* if(changefilter==true){ reloadTable(data); }*/ diff --git a/suivi_unit.php b/suivi_unit.php index dee5e10a5ae856c4628b74bb128ec18b954a51ce..74c8d29939f59824f07d8da5a7d7deee2da5455c 100644 --- a/suivi_unit.php +++ b/suivi_unit.php @@ -546,7 +546,7 @@ else if(isset($_POST['action']) && $_POST['action'] == 'search_student' && isset } // If a post is sent trought the page --> Si on change les filtres (de groupes), le template est appelé en JS else if (isset($_POST['action']) && !empty($_POST['action'])) { - + $groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true); $data = []; $modules = get_activities($completion, $activesectionid);