Bugfixes in competency display

This commit is contained in:
PMKuipers 2023-12-13 00:13:07 +01:00
parent de97031326
commit a704436564
5 changed files with 22 additions and 13 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

@ -1635,6 +1635,9 @@ export default {
},
competencyurl(c) {
return `/admin/tool/lp/user_competency_in_course.php?courseid=${this.item.course.id}&competencyid=${c.id}`;
},
usercompetencyurl(c) {
return `/admin/tool/lp/user_competency.php?id=${c.ucid}`;
}
},
template: `
@ -1647,10 +1650,10 @@ export default {
<template v-else>
<tr v-for='c in value.competencies'>
<td>
<a href="#" v-b-modal="'modal-competency-id-'+c.id"><span v-html='c.title'></span></a>
<a href="#" v-b-modal="'modal-competency-id-'+c.id" @click.prevent.stop=''><span v-html='c.title' ></span></a>
</td>
<td class='details' >
<a v-if="c.details" href="#" v-b-modal="'modal-competency-id-'+c.id"><span v-html='c.details'></span></a>
<a v-if="c.details" href="#" v-b-modal="'modal-competency-id-'+c.id" @click.prevent.stop='' ><span v-html='c.details'></span></a>
<abbr v-if="c.required" :title="text.required"
:class="'s-required ' + + completion_tag(c)"
><i class='fa fa-asterisk' ></i
@ -1663,19 +1666,21 @@ export default {
{{ (c.proficient === null)?text.unrated:c.grade }}
</template>
<template v-else>
<r-progress-circle
<r-progress-circle v-if='!c.proficient'
:value='c.progress'
:max='c.count'
:min='0'
:class="'r-completion-'+completion_tag(c)"
:title="text['completion_'+completion_tag(c)]"
></r-progress-circle>
<i v-else :class="'fa fa-'+completion_icon(c)" :title="text['completion_'+completion_tag(c)]"></i>
{{ (c.proficient === null)?((c.progress)?text.progress:text.unrated):c.grade }}
</template>
</span>
</td>
<td v-if="c.feedback">
<a v-b-modal="'r-competency-feedback-'+c.id"
@click.prevent.stop=''
href="#"
>{{ text["view_feedback"]}}</a>
<b-modal
@ -1717,10 +1722,10 @@ export default {
</tr>
<tr v-for="cc in c.children">
<td >
<a :href='competencyurl(c)' target="_blank"><span v-html='cc.title'></span></a>
<a :href='usercompetencyurl(cc)' target="_blank"><span v-html='cc.title'></span></a>
</td>
<td class='details'>
<a v-if="cc.details" :href='competencyurl(c)' target="_blank"><span v-html='cc.details'></span></a>
<a v-if="cc.details" :href='usercompetencyurl(cc)' target="_blank"><span v-html='cc.details'></span></a>
<abbr v-if="c.required" :title="text.required"
:class="'s-required ' + + completion_tag(cc)"
><i class='fa fa-asterisk' ></i
@ -2419,7 +2424,7 @@ export default {
},
competencyurl(c) {
return `/admin/tool/lp/user_competency_in_course.php?courseid=${this.item.course.id}&competencyid=${c.id}`;
}
},
},
template: `
<table class="r-item-course-competency-list">
@ -2484,10 +2489,10 @@ export default {
</tr>
<tr v-for="cc in c.children">
<td>
<a :href='competencyurl(c)' target="_blank"><span v-html='cc.title'></span></a>
<a :href='competencyurl(cc)' target="_blank"><span v-html='cc.title'></span></a>
</td>
<td class='details'>
<a v-if="cc.details" :href='competencyurl(c)' target="_blank"><span v-html='cc.details'></span></a>
<a v-if="cc.details" :href='competencyurl(cc)' target="_blank"><span v-html='cc.details'></span></a>
<abbr v-if="c.required" :title="text.required"
:class="'s-required ' + completion_tag(cc)"
><i class='fa fa-asterisk' ></i

View File

@ -106,6 +106,7 @@ class coursecompetencyinfo {
"title" => new \external_value(PARAM_RAW),
"type" => new \external_value(PARAM_TEXT),
]), 'competency path'),
'ucid' => new \external_value(PARAM_INT, 'user competencyid',VALUE_OPTIONAL),
"grade" => new \external_value(PARAM_TEXT, 'competency grade', VALUE_OPTIONAL),
"coursegrade" => new \external_value(PARAM_TEXT, 'course competency grade', VALUE_OPTIONAL),
"proficient" => new \external_value(PARAM_BOOL, 'competency proficiency',VALUE_OPTIONAL),
@ -153,7 +154,7 @@ class coursecompetencyinfo {
* Create basic competency information model from competency
* @param Object $competency
*/
private function competencyinfo_model($competency) : array {
private function competencyinfo_model($competency,$userid=null) : array {
$displayfield = get_config("local_treestudyplan","competency_displayname");
$detailfield = get_config("local_treestudyplan","competency_detailfield");
$headingfield = ($displayfield != 'description')?$displayfield:"shortname";
@ -205,6 +206,9 @@ class coursecompetencyinfo {
'description' => $competency->get('description'),
'path' => $path,
];
if ($userid) {
$model['ucid'] = self::get_user_competency($userid, $competency->get('id'))->get('id');
}
return $model;
}
@ -367,7 +371,7 @@ class coursecompetencyinfo {
$children = [];
foreach($dids as $did) {
$cc = new competency($did);
$cci = $this->competencyinfo_model($cc);
$cci = $this->competencyinfo_model($cc,$userid);
$cp = $p = $this->proficiency($cc,$userid);
// Copy proficiency info to model.
foreach ((array)$cp as $key => $value) {

View File

@ -22,7 +22,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
$plugin->version = 2023121101; // YYYYMMDDHH (year, month, day, iteration).
$plugin->version = 2023121300; // YYYYMMDDHH (year, month, day, iteration).
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
$plugin->release = "1.1.0";