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

View File

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

View File

@ -22,7 +22,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$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 = 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->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
$plugin->release = "1.1.0"; $plugin->release = "1.1.0";