Fixed student appearing multiple times in search
This commit is contained in:
parent
7b980405f3
commit
6587200239
|
@ -161,7 +161,7 @@ class associationservice extends \external_api {
|
||||||
|
|
||||||
$params = ["pattern_nm" => $pattern, "pattern_id" => $pattern, ];
|
$params = ["pattern_nm" => $pattern, "pattern_id" => $pattern, ];
|
||||||
|
|
||||||
$sql = "SELECT c.* from {cohort} c LEFT JOIN {local_treestudyplan_cohort} j ON c.id = j.cohort_id
|
$sql = "SELECT DISTINCT c.* from {cohort} c LEFT JOIN {local_treestudyplan_cohort} j ON c.id = j.cohort_id
|
||||||
WHERE c.visible = 1 AND(name LIKE :pattern_nm OR idnumber LIKE :pattern_id)";
|
WHERE c.visible = 1 AND(name LIKE :pattern_nm OR idnumber LIKE :pattern_id)";
|
||||||
if (isset($excludeid) && is_numeric($excludeid)) {
|
if (isset($excludeid) && is_numeric($excludeid)) {
|
||||||
$sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)";
|
$sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)";
|
||||||
|
@ -220,7 +220,7 @@ class associationservice extends \external_api {
|
||||||
"pattern_ln" => $pattern,
|
"pattern_ln" => $pattern,
|
||||||
"pattern_un" => $pattern,
|
"pattern_un" => $pattern,
|
||||||
];
|
];
|
||||||
$sql = "SELECT u.* from {user} u LEFT JOIN {local_treestudyplan_user} j ON u.id = j.user_id
|
$sql = "SELECT DISTINCT u.* from {user} u LEFT JOIN {local_treestudyplan_user} j ON u.id = j.user_id
|
||||||
WHERE u.deleted != 1 AND (firstname LIKE :pattern_fn OR lastname LIKE :pattern_ln OR username LIKE :pattern_un)";
|
WHERE u.deleted != 1 AND (firstname LIKE :pattern_fn OR lastname LIKE :pattern_ln OR username LIKE :pattern_un)";
|
||||||
if (isset($excludeid) && is_numeric($excludeid)) {
|
if (isset($excludeid) && is_numeric($excludeid)) {
|
||||||
$sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)";
|
$sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)";
|
||||||
|
|
|
@ -106,10 +106,10 @@ print $OUTPUT->header();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-cloak>
|
<div v-cloak>
|
||||||
<div v-if='!activestudyplan && usedcontexts' class='ml-3 mb-3'>
|
<div v-if='!activestudyplan && usedcontexts' class='ml-3 mb-3 s-context-selector'>
|
||||||
<b-form-select text='<?php print($contextname);?>' :value="contextid" @change='switchContext'>
|
<b-form-select text='<?php print($contextname);?>' :value="contextid" @change='switchContext'>
|
||||||
<b-form-select-option v-for='ctx in usedcontexts' :key='ctx.id' :value="ctx.context_id"
|
<b-form-select-option v-for='ctx in usedcontexts' :key='ctx.id' :value="ctx.context_id"
|
||||||
:class="(ctx.studyplancount > 0) ? 'font-weight-bold' : '' + (ctx.context_id == contextid)?' active':''"
|
:class="(ctx.studyplancount > 0) ? 'font-weight-bold' : ''"
|
||||||
><span v-for="(p, i) in ctx.category.path"
|
><span v-for="(p, i) in ctx.category.path"
|
||||||
><span v-if="i>0"> / </span>{{ p }}</span> <span>({{ ctx.studyplancount }})</span>
|
><span v-if="i>0"> / </span>{{ p }}</span> <span>({{ ctx.studyplancount }})</span>
|
||||||
</b-form-select-option>
|
</b-form-select-option>
|
||||||
|
|
|
@ -156,8 +156,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -103,10 +103,10 @@ print $OUTPUT->header();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-cloak>
|
<div v-cloak>
|
||||||
<div v-if='!activestudyplan && usedcontexts' class='ml-3 mb-3'>
|
<div v-if='!activestudyplan && usedcontexts' class='ml-3 mb-3 s-context-selector'>
|
||||||
<b-form-select text='<?php print($contextname);?>' :value="contextid" @change='switchContext'>
|
<b-form-select text='<?php print($contextname);?>' :value="contextid" @change='switchContext'>
|
||||||
<b-form-select-option v-for='ctx in usedcontexts' :key='ctx.id' :value="ctx.context_id"
|
<b-form-select-option v-for='ctx in usedcontexts' :key='ctx.id' :value="ctx.context_id"
|
||||||
:class="(ctx.studyplancount > 0) ? 'font-weight-bold' : '' + (ctx.context_id == contextid)?' active':''"
|
:class="(ctx.studyplancount > 0) ? 'font-weight-bold' : ''"
|
||||||
><span v-for="(p, i) in ctx.category.path"><span v-if="i>0"> / </span>{{ p }}</span>
|
><span v-for="(p, i) in ctx.category.path"><span v-if="i>0"> / </span>{{ p }}</span>
|
||||||
<span>({{ ctx.studyplancount }})</span></b-form-select-option>
|
<span>({{ ctx.studyplancount }})</span></b-form-select-option>
|
||||||
</b-form-select>
|
</b-form-select>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user