diff --git a/amd/src/report-viewer-components.js b/amd/src/report-viewer-components.js index c1da739..83538f8 100644 --- a/amd/src/report-viewer-components.js +++ b/amd/src/report-viewer-components.js @@ -263,7 +263,7 @@ export default { methods: { countLineLayers(line){ let maxLayer = -1; - for(let i = 0; i <= this.value.slots; i++){ + 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){ @@ -279,8 +279,36 @@ export default { } } } - return maxLayer+1; + return (maxLayer >= 0)?(maxLayer+1):1; }, + showslot(line,index, layeridx, type){ + // check if the slot should be hidden because a previous slot has an item with a span + // so big that it hides this slot + const forGradable = (type == 'gradable')?true:false; + const periods = this.page.periods; + let show = true; + for(let i = 0; i < periods; i++){ + if(line.slots[index-i] && line.slots[index-i].competencies){ + const list = line.slots[index-i].competencies; + for(const ix in list){ // Really wish that 'for of' would work with the minifier moodle uses + const item = list[ix]; + if(item.layer == layeridx){ + if(forGradable){ + if(i > 0 && (item.span - i) > 0){ + show = false; + } + } else { + if((item.span - i) > 1){ + show = false; + } + } + } + } + } + } + + return show; + } }, template: `
@@ -311,13 +339,13 @@ export default {