Added wsfunction to issue or get certificate#713
Draft
indicozy wants to merge 1 commit intomdjnelson:MOODLE_500_STABLEfrom
Draft
Added wsfunction to issue or get certificate#713indicozy wants to merge 1 commit intomdjnelson:MOODLE_500_STABLEfrom
indicozy wants to merge 1 commit intomdjnelson:MOODLE_500_STABLEfrom
Conversation
Author
|
@mdjnelson I created PR for #712, however cURL is not working properly: curl 'https://moodle.dev/webservice/rest/server.php?wstoken=TOKEN_OF_USER&wsfunction=mod_customcert_get_or_create_certificate&moodlewsrestformat=json&cmid=277' \
-H 'accept: */*' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'origin: http://localhost:5173' \
-H 'priority: u=1, i' \
-H 'referer: http://localhost:5173/' \
-H 'sec-ch-ua: "Not;A=Brand";v="24", "Chromium";v="128"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: cross-site' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'Returns: {
"exception": "dml_missing_record_exception",
"errorcode": "invalidrecordunknown",
"message": "Не удается найти данную запись в базе данных"
}I tried to debug it by adding checks and exceptions, however it doesn't change the response's error code. I'm stuck on this stage. DB info: INSERT INTO `mdl_course_modules` (`id`, `course`, `module`, `instance`, `section`, `idnumber`, `added`, `score`, `indent`, `visible`, `visibleoncoursepage`, `visibleold`, `groupmode`, `groupingid`, `completion`, `completiongradeitemnumber`, `completionview`, `completionexpected`, `completionpassgrade`, `showdescription`, `availability`, `deletioninprogress`, `downloadcontent`, `lang`) VALUES ('277', '9', '26', '3', '91', '', '1755916142', '0', '0', '1', '1', '1', '0', '0', '0', NULL, '0', '0', '0', '0', NULL, '0', '1', '')
INSERT INTO `mdl_course` (`id`, `category`, `sortorder`, `fullname`, `shortname`, `idnumber`, `summary`, `summaryformat`, `format`, `showgrades`, `newsitems`, `startdate`, `enddate`, `relativedatesmode`, `marker`, `maxbytes`, `legacyfiles`, `showreports`, `visible`, `visibleold`, `downloadcontent`, `groupmode`, `groupmodeforce`, `defaultgroupingid`, `lang`, `calendartype`, `theme`, `timecreated`, `timemodified`, `requested`, `enablecompletion`, `completionnotify`, `cacherev`, `originalcourseid`, `showactivitydates`, `showcompletionconditions`, `pdfexportfont`) VALUES ('9', '3', '30003', 'СЕРВИС. ПРОФЕССИОНАЛЬНЫЙ ИМИДЖ', 'Профессиональный имидж', '', '<p dir=\"ltr\">Этот курс посвящен самым актуальным стратегиям и современным подходам к раннему выявлению и профилактике онкологических заболеваний в условиях первичной медико-санитарной помощи. Вы изучите современные скрининговые программы, методы консультирования пациентов по факторам риска и принципы онконастороженности в ежедневной практике. Курс предназначен для врачей общей практики, терапевтов и фельдшеров, стремящихся повысить эффективность профилактической работы и снизить онкологическую заболеваемость на своем участке.</p>', '1', 'topics', '1', '5', '1753815600', '0', '0', '0', '0', '0', '0', '1', '1', NULL, '0', '0', '0', '', '', '', '1753805401', '1755594415', '0', '1', '0', '1756011550', NULL, '1', '1', NULL)
INSERT INTO `mdl_customcert` (`id`, `course`, `templateid`, `name`, `intro`, `introformat`, `requiredtime`, `verifyany`, `deliveryoption`, `usecustomfilename`, `customfilenamepattern`, `emailstudents`, `emailteachers`, `emailothers`, `protection`, `language`, `timecreated`, `timemodified`) VALUES ('3', '9', '4', 'Сертификат', '', '1', '0', '1', 'I', '0', NULL, '0', '0', '', '', '', '1755916142', '1755916142')
INSERT INTO `mdl_customcert_issues` (`id`, `userid`, `customcertid`, `code`, `emailed`, `timecreated`) VALUES ('4', '3', '3', '2795-0273-6651', '0', '1755920135') |
0bb6e9d to
0ed68a4
Compare
Owner
|
Please see my suggestions in #712. Easiest way to check it is working is by writing unit tests instead of going through the headache of setting up the webservice and testing it. See https://github.com/mdjnelson/moodle-mod_customcert/blob/MOODLE_500_STABLE/tests/external_test.php. Also, no need to update CHANGES.md, ill do that when I release a new version. Thanks! |
41d9c5d to
a1494a8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since I'm not familiar with PHP, most of the code is AI generated.
I need help to create dev environment and code review.
I want to create wsfunction that issues (if not found) certificate and returns certificate ID as discussed in #712.
However, it's not working properly, more info in the comment below