This commit is contained in:
PMKuipers 2023-11-27 20:55:08 +01:00
parent 1becee9a6d
commit 848457e7cc

View File

@ -50,56 +50,7 @@ let strings = load_strings({
el: '#block_mytreestudyplan',
data: {
"studyplans": [],
<<<<<<< HEAD
"type" : type,
=======
},
mounted() {
let call_method;
let call_args;
if(type == "teacher"){
call_method = 'local_treestudyplan_get_teacher_studyplan';
call_args = {};
}
else if(type == "teaching"){
call_method = 'local_treestudyplan_get_teaching_studyplans';
call_args = {};
}
else{
call_method = 'local_treestudyplan_get_own_studyplan';
call_args = {};
}
call([{
methodname: call_method,
args: call_args
}])[0].done(function(response){
debug.info("Studyplans:",response);
const timingval = { future: 0, present: 1, past: 2, };
response.sort((a,b) => {
const timinga = TSComponents.studyplanTiming(a);
const timingb = TSComponents.studyplanTiming(b);
let t = timingval[timinga] - timingval[timingb];
if(t == 0){
// sort by start date if timing is equal
t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();
if (t == 0) {
// sort by name if timing is equal
t = a.name.localeCompare(b.name);
}
}
return t;
});
app.studyplans = ProcessStudyplans(response);
}).fail(notification.exception);
},
created() {
},
updated() {
>>>>>>> 449618ef9ae1767120a083f3bd263448c5957fb1
},
methods: {