Skip to content

Commit 0fbdc67

Browse files
committed
Merge branch 'MDL-65078-37' of git://github.com/peterRd/moodle into MOODLE_37_STABLE
2 parents 8b44b91 + 916c504 commit 0fbdc67

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

competency/classes/api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ public static function list_course_module_competencies($cmorid) {
12311231
$result = array();
12321232

12331233
// TODO We could improve the performance of this into one single query.
1234-
$coursemodulecompetencies = course_competency::list_course_module_competencies($cm->id);
1234+
$coursemodulecompetencies = course_module_competency::list_course_module_competencies($cm->id);
12351235
$competencies = course_module_competency::list_competencies($cm->id);
12361236

12371237
// Build the return values.

competency/tests/api_test.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,6 +2757,16 @@ public function test_list_course_modules_using_competency() {
27572757
$result = api::list_course_module_competencies_in_course_module($cm->id);
27582758
$this->assertEquals($result[0]->get('competencyid'), $c->get('id'));
27592759
$this->assertEquals($result[1]->get('competencyid'), $c2->get('id'));
2760+
2761+
// Now get the course competency and coursemodule competency together.
2762+
$result = api::list_course_module_competencies($cm->id);
2763+
// Now we should have an array and each element of the array should have a competency and
2764+
// a coursemodulecompetency.
2765+
foreach ($result as $instance) {
2766+
$cmc = $instance['coursemodulecompetency'];
2767+
$c = $instance['competency'];
2768+
$this->assertEquals($cmc->get('competencyid'), $c->get('id'));
2769+
}
27602770
}
27612771

27622772
/**

0 commit comments

Comments
 (0)