Merge branch 'master' of git.miqra.nl:Miqra-Engineering/moodle-block_mytreestudyplan
This commit is contained in:
commit
1becee9a6d
|
@ -50,7 +50,56 @@ 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: {
|
||||
|
||||
|
@ -58,5 +107,3 @@ let strings = load_strings({
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user