File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -123,15 +123,28 @@ public static function fetch_marking(stdClass $user): ?array {
123
123
}
124
124
125
125
$ modinfo = get_fast_modinfo ($ course ->id );
126
+ $ mods = $ modinfo ->get_cms ();
127
+ // Mod ids array to check cmid exists.
128
+ $ cmids = [];
129
+ foreach ($ mods as $ mod ) {
130
+ $ cmids [] = $ mod ->id ;
131
+ }
126
132
127
133
// Loop through assessments for this course.
128
134
foreach ($ summatives as $ summative ) {
129
135
130
136
// Check this is a course mod.
131
137
if ($ summative ->cmid != 0 ) {
138
+ // Skip mods where cmid is not in the course.
139
+ if (!in_array ($ summative ->cmid , $ cmids )) {
140
+ continue ;
141
+ }
142
+
143
+ // Begin to build mod data for template.
132
144
$ cmid = $ summative ->cmid ;
133
145
$ mod = $ modinfo ->get_cm ($ cmid );
134
146
147
+
135
148
// Skip hidden mods.
136
149
if (!$ mod ->visible ) {
137
150
continue ;
You can’t perform that action at this time.
0 commit comments