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

Certificate generation requires completion criteria #1351

Open
wants to merge 1 commit into
base: IOMAD_38_STABLE
Choose a base branch
from

Conversation

jackawardls
Copy link

$trackinfo was too loose in the SQL query for retrieving track data. This would cause a cron-generated certificate to show incorrect (0% score, and invalid date) data to appear in the certificate if an attempt to generate the certificate manually was made before the user completed the course. The existing way to avoid this is to manually regenerate the certificate.

This code will check if a record was returned from the iomad_track table that has a 'timecompleted' value and will return true to signify a certificate was generated and false for the opposite.

*** PLEASE DO NOT OPEN PULL REQUESTS VIA GITHUB ***

The moodle.git repository at Github is just a mirror of the official repository. We do not accept pull requests at Github.

See CONTRIBUTING.txt guidelines for how to contribute patches for Moodle. Thank you.

--

$trackinfo was too loose in the SQL query for retrieving track data. This would cause a cron-generated certificate to show incorrect (0% score, and invalid date) data to appear in the certificate if an attempt to generate the certificate manually was made before the user completed the course. The existing way to avoid this is to manually regenerate the certificate.

This code will check if a record was returned from the iomad_track table that has a 'timecompleted' value and will return true to signify a certificate was generated and false for the opposite.
Copy link
Collaborator

@turf212 turf212 left a comment

Choose a reason for hiding this comment

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

Can you please neaten up the DB call in line 173 so that it is passing proper parameters to the $DB class call. Also the SQL you have will only work on certain DBs so that needs to change too.

E.g. can change 173 -175 to be:

if ($trackinfos = $DB->get_records_sql("SELECT * FROM {local_iomad_track}
                                                           WHERE id = :trackid
                                                           AND timecompleted IS NOT NULL",
                                                           array('trackid' => $trackid),
                                                           0, 1))) {

	$trackinfo = current($trackinfos);

@jackawardls
Copy link
Author

Ok no problem, will make the requested PR changes as soon as possible from both PR's.
Apologies for if the web-based PR's are an issue, I have had troubles cloning Iomad to my Windows machine!

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

2 participants