Code Duplication    Length = 17-17 lines in 2 locations

lib.php 2 locations

@@ 179-195 (lines=17) @@
176
        }
177
    }
178
179
    if ($bigbluebuttonbn->completionengagementchats) {
180
        if (!$logs) {
181
            // As completion by engagement with chat was required, the activity hasn't been completed.
182
            return false;
183
        }
184
        $engagementchatscount = 0;
185
        foreach ($logs as $log) {
186
            $summary = json_decode($log->meta);
187
            $engagementchatscount += $summary->data->engagement->chats;
188
        }
189
        $value = $bigbluebuttonbn->completionengagementchats <= $engagementchatscount;
190
        if ($type == COMPLETION_AND) {
191
            $result = $result && $value;
192
        } else {
193
            $result = $result || $value;
194
        }
195
    }
196
197
    if ($bigbluebuttonbn->completionengagementtalks) {
198
        if (!$logs) {
@@ 197-213 (lines=17) @@
194
        }
195
    }
196
197
    if ($bigbluebuttonbn->completionengagementtalks) {
198
        if (!$logs) {
199
            // As completion by engagement with talk was required, the activity hasn't been completed.
200
            return false;
201
        }
202
        $engagementtalkscount = 0;
203
        foreach ($logs as $log) {
204
            $summary = json_decode($log->meta);
205
            $engagementtalkscount += $summary->data->engagement->talks;
206
        }
207
        $value = $bigbluebuttonbn->completionengagementtalks <= $engagementtalkscount;
208
        if ($type == COMPLETION_AND) {
209
            $result = $result && $value;
210
        } else {
211
            $result = $result || $value;
212
        }
213
    }
214
215
    return $result;
216
}