This commit is contained in:
PMKuipers 2023-08-16 23:36:11 +02:00
parent cae51717a9
commit 490a71be3b
4 changed files with 41 additions and 17 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,8 @@ import {load_stringkeys, load_strings, format_date, datespaninfo} from './string
import {objCopy,transportItem} from './studyplan-processor';
import Debugger from './debugger';
import {download,upload} from './downloader';
import {ProcessStudyplan} from './studyplan-processor';
const STUDYPLAN_EDITOR_FIELDS =
['name','shortname','description','idnumber','context_id', 'aggregation','aggregation_config'];
@ -650,10 +652,24 @@ export default {
const moved_to = response.context_id;
const moved = (moved_from != moved_to);
objCopy(self.value,response,STUDYPLAN_EDITOR_FIELDS);
self.$emit('input',self.value);
if(moved){
self.$emit('moved',self.value,moved_from, moved_to);
if(response.pages[0].periods != self.value.pages[0].periods){
// reload the entire model
call([{
methodname: 'local_treestudyplan_get_studyplan_map',
args: { id: self.value.id}
}])[0].done(function(response){
self.value = ProcessStudyplan(response,true);
debug.info('studyplan processed');
self.$emit('input',self.value);
}).fail(function(error){
notification.exception(error);
});
} else {
objCopy(self.value,response,STUDYPLAN_EDITOR_FIELDS);
self.$emit('input',self.value);
if(moved){
self.$emit('moved',self.value,moved_from, moved_to);
}
}
}
}).fail(notification.exception);
@ -1324,19 +1340,22 @@ export default {
{
let maxLayer = -1;
for(let i = 0; i <= this.page.periods; i++){
const slot = line.slots[i];
// Determine the amount of used layers in a studyline slit
for(const ix in line.slots[i].competencies){
const item = line.slots[i].competencies[ix];
if(item.layer > maxLayer){
maxLayer = item.layer;
if(line.slots[i]){
const slot = line.slots[i];
// Determine the amount of used layers in a studyline slit
for(const ix in line.slots[i].competencies){
const item = line.slots[i].competencies[ix];
if(item.layer > maxLayer){
maxLayer = item.layer;
}
}
}
for(const ix in line.slots[i].filters){
const item = line.slots[i].filters[ix];
if(item.layer > maxLayer){
maxLayer = item.layer;
for(const ix in line.slots[i].filters){
const item = line.slots[i].filters[ix];
if(item.layer > maxLayer){
maxLayer = item.layer;
}
}
}
}
this.cache.linelayers[line.id] = {

View File

@ -37,6 +37,10 @@ class studyline {
return $this->studyplan;
}
public function page() : studyplanpage {
return $this->page;
}
public static function findById($id): self {
if(!array_key_exists($id,self::$STUDYLINE_CACHE)){
self::$STUDYLINE_CACHE[$id] = new self($id);
@ -102,6 +106,7 @@ class studyline {
unset($model["sequence"]);
}
// TODO: Make this a little nicer
// Get the number of slots
// As a safety data integrity measure, if there are any items in a higher slot than currently allowed,
// make sure there are enought slots to account for them