Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ewallah issue #4 #5

Merged
merged 17 commits into from Aug 28, 2023
Merged

Ewallah issue #4 #5

merged 17 commits into from Aug 28, 2023

Conversation

ewallah
Copy link
Owner

@ewallah ewallah commented Aug 28, 2023

Improve integration with Moodle Workplace Certificates

@coveralls
Copy link

Coverage Status

coverage: 100.0% (+2.5%) from 97.5% when pulling 9518449 on ewallah-issue-4 into 08410a3 on main.

@ewallah ewallah merged commit 3071db7 into main Aug 28, 2023
20 checks passed
@ewallah ewallah deleted the ewallah-issue-4 branch August 28, 2023 12:28
$sql = "SELECT DISTINCT userid
FROM {course_completions}
WHERE timecompleted IS $cond NULL AND course = ?";
$compusers = $DB->get_records_sql($sql, [$course->id]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not test it but is it possible that a student does not have any records in the 'course_completions' table at all?
In this case the SQL for the "not completed" case would be wrong.

In fact, you check $not again below, so you kind of inverse it?

@ewallah
Copy link
Owner Author

ewallah commented Aug 29, 2023

Why would it be wrong?

The function only removes users (https://github.com/moodle/moodle/blob/master/availability/classes/tree.php#L298), so if there are no records in the course_completions table, they will be removed if the $not parameter is true.

This second $not is needed, first I collect the users who did complete the course or did not (based on what is stored in the condition), next I apply the $not, the same way it happens with availability group:
first: if ($this->groupid)
next: if($not)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants