Bugfix in report view

This commit is contained in:
PMKuipers 2023-08-15 22:52:43 +02:00
parent 5352b64919
commit 9bd0f2002e
4 changed files with 22 additions and 22 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

@ -239,6 +239,9 @@ export default {
} }
}, },
methods: { methods: {
selectstudyplan(plan) {
this.selectedstudyplan = plan;
},
}, },
template: ` template: `
<div class='t-studyplan-container'> <div class='t-studyplan-container'>
@ -249,7 +252,7 @@ export default {
:key="studyplan.id" :key="studyplan.id"
:active="displayedstudyplan && studyplan.id == displayedstudyplan.id" :active="displayedstudyplan && studyplan.id == displayedstudyplan.id"
button button
@click="selectedstudyplan = studyplan" @click="selectstudyplan(studyplan)"
>{{studyplan.name}}</b-list-group-item> >{{studyplan.name}}</b-list-group-item>
</b-list-group> </b-list-group>
<r-studyplan v-if='displayedstudyplan' v-model='displayedstudyplan' :guestmode='guestmode' :teachermode='teachermode'></r-studyplan> <r-studyplan v-if='displayedstudyplan' v-model='displayedstudyplan' :guestmode='guestmode' :teachermode='teachermode'></r-studyplan>
@ -347,6 +350,8 @@ export default {
}, },
updated() { updated() {
scrollCurrentIntoView(this.value.id); scrollCurrentIntoView(this.value.id);
ItemEventBus.$emit('lineHeightChange', null);
}, },
template: ` template: `
<div class='r-studyplan-content'> <div class='r-studyplan-content'>
@ -450,11 +455,11 @@ export default {
}, },
methods: { methods: {
onLineHeightChange(lineid,layerid,newheight){ onLineHeightChange(lineid){
// All layers for this line have the first slot send an update message on layer height change. // All layers for this line have the first slot send an update message on layer height change.
// When one of those updates is received, record the height and recalculate the total height of the // When one of those updates is received, record the height and recalculate the total height of the
// header // header
if(this.$refs.mainEl && lineid == this.value.id){ if(this.$refs.mainEl && (lineid == this.value.id || lineid === null)){
const items = document.querySelectorAll( const items = document.querySelectorAll(
`.r-studyline-slot-0[data-studyline='${this.value.id}']`); `.r-studyline-slot-0[data-studyline='${this.value.id}']`);
// determine the height of all the lines and add them up. // determine the height of all the lines and add them up.
@ -644,12 +649,7 @@ export default {
let lineinfo = this.lines[conn.to_id]; let lineinfo = this.lines[conn.to_id];
if(lineinfo){ if(lineinfo){
if(lineinfo.line){ if(lineinfo.line){
if(lineinfo.lineElm ){ lineinfo.line.remove();
lineinfo.lineElm.parentNode.removeChild(lineinfo.lineElm);
lineinfo.lineElm = undefined;
} else {
lineinfo.line.remove();
}
lineinfo.line = undefined; lineinfo.line = undefined;
} }
} else { } else {
@ -668,16 +668,19 @@ export default {
end: LINE_GRAVITY, end: LINE_GRAVITY,
}, },
}); });
let elmWrapper = (this.plan.id >=0)?document.getElementById('studyplan-linewrapper-'+this.plan.id):null;
if(elmWrapper !== null){
let elmLine = document.querySelector('body > .leader-line:last-child');
elmWrapper.appendChild(elmLine);
lineinfo.lineElm = elmLine; // store line element so it can more easily be removed from the dom
}
} }
}, },
redrawLines(){ redrawLines(){
// Clean all old lines
for(let ix in this.lines){
let lineinfo = this.lines[ix];
if(lineinfo && lineinfo.line){
lineinfo.line.remove();
lineinfo.line = undefined;
}
}
// Create new lines
for(let i in this.value.connections.out){ for(let i in this.value.connections.out){
let conn = this.value.connections.out[i]; let conn = this.value.connections.out[i];
this.redrawLine(conn); this.redrawLine(conn);
@ -1583,10 +1586,7 @@ export default {
return this.determine_grading_icon(this.is_grading_needed(grade)); return this.determine_grading_icon(this.is_grading_needed(grade));
}, },
is_grading_needed(grade){ is_grading_needed(grade){
debug.info("Grade: ", grade.name);
debug.info(grade.grading);
if(grade.grading){ if(grade.grading){
debug.info("Ping");
if(grade.grading.ungraded){ if(grade.grading.ungraded){
return 'ungraded'; return 'ungraded';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494) $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
$plugin->version = 2023081600; // YYYYMMDDHH (year, month, day, iteration) $plugin->version = 2023081602; // YYYYMMDDHH (year, month, day, iteration)
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11) $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
$plugin->dependencies = [ $plugin->dependencies = [