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

Error Found more than one record in fetch() after grading assignment #144

Open
thebenkahn opened this issue Oct 23, 2023 · 6 comments
Open
Assignees

Comments

@thebenkahn
Copy link

Describe the bug
After grading as assignment, students who have been graded get an error when viewing the course.

The error only presents for students who have been graded. Switching to another course format resolves the error.

The course only has 12 assignment grade items, and a course grade category, there are no other grade items or grade categories. I have checked for any duplicate items in the mdl_grade_items table and not found any - and can access the grade book normally, or access the course normally using weeks/topics formats so I don't think there are actually any duplicates.

Additionally, if I backup and restore the course to a new shell, I cannot reproduce the error.

I hate the open a bug with no clear replication steps but am at a loss and hoping you might be able to point out what the code is trying to do here if I'm missing something. It seems like it is just checking the course section for assignments and getting the grade info, but is there another table I should be looking in for duplicated records?

Debug info:
Error code: morethanonerecordinfetch

Stack trace:
line 163 of /lib/grade/grade_object.php: moodle_exception thrown
line 367 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
line 155 of /course/format/topcoll/classes/activity.php: call to grade_item::fetch()
line 180 of /course/format/topcoll/classes/activity.php: call to format_topcoll\activity::std_meta()
line ? of unknownfile: call to format_topcoll\activity::assign_meta()
line 78 of /course/format/topcoll/classes/activity.php: call to call_user_func()
line 87 of /course/format/topcoll/classes/output/courseformat/content/cm.php: call to format_topcoll\activity::module_meta()
line 60 of /course/format/topcoll/classes/output/courseformat/content/cm.php: call to format_topcoll\output\courseformat\content\cm->course_section_cm_get_meta()
line 107 of /course/format/classes/output/local/content/section/cmitem.php: call to format_topcoll\output\courseformat\content\cm->export_for_template()
line 122 of /course/format/classes/output/local/content/section/cmlist.php: call to core_courseformat\output\local\content\section\cmitem->export_for_template()
line 504 of /lib/outputrenderers.php: call to core_courseformat\output\local\content\section\cmlist->export_for_template()
line 108 of /course/format/classes/output/section_renderer.php: call to plugin_renderer_base->render()
line 98 of /course/format/topcoll/classes/output/format_renderer_migration_toolbox.php: call to core_courseformat\output\section_renderer->render()
line 510 of /course/format/topcoll/classes/output/renderer.php: call to format_topcoll\output\renderer->course_section_cmlist()
line 956 of /course/format/topcoll/classes/output/renderer.php: call to format_topcoll\output\renderer->topcoll_section()
line 86 of /course/format/topcoll/format.php: call to format_topcoll\output\renderer->multiple_section_page()
line 290 of /course/view.php: call to require()

Versions (please complete the following information):

  • Moodle: [4.1.5 (Build: 20230814)]

  • Format: [e.g. 401.0.1] 401.1.0

  • Browser and version Windows Version 118.0.5993.71 (Official Build) (64-bit), but happens on any browser

Additional context
Add any other context about the problem here.

@gjb2048
Copy link
Collaborator

gjb2048 commented Oct 23, 2023

@thebenkahn I've seen this before with the Adaptable theme ages ago and also thought it had been fixed here - but then I can't remember the exact nature of what happened. Currently snowed under with things. Will look when I get a chance, but might be some time.

@gjb2048
Copy link
Collaborator

gjb2048 commented Oct 23, 2023

@thebenkahn I think its an issue with your site as similar to https://moodle.org/mod/forum/discuss.php?d=440281.

@thebenkahn
Copy link
Author

Hey Gareth

Thank you much for the response. I had already done a check for duplicate grade_items, assignments, course modules, completion criteria....running the query in that thread returns no results.

SELECT courseid, itemmodule, iteminstance, itemnumber, COUNT()
FROM mdl_grade_items
WHERE itemtype='mod'
GROUP BY courseid,itemmodule,iteminstance,itemnumber
HAVING COUNT(
) > 1;

I'll keep poking at it.

@gjb2048 gjb2048 added the Triaged Issue read and is on backlog label Oct 25, 2023
@gjb2048
Copy link
Collaborator

gjb2048 commented Dec 6, 2023

@thebenkahn Any update to this please?

@thebenkahn
Copy link
Author

@gjb2048 - sorry I had meant to come back and comment. It did turn out to be a duplicate grade item. It was tricky because the duplicates were not in the same course as is typically the case. Reviewing the code for grade_object::fetch_helper() we noticed the SQL it used did not filter to the course it is used in.
The client had tried to import a course from a different LMS (who knows what process that entailed) and created a bunch of grade items with ID numbers that existed elsewhere on the site. Thank you again for looking in to it.

@gjb2048
Copy link
Collaborator

gjb2048 commented Dec 7, 2023

Dear @thebenkahn,

Thank you for getting back to me. Please could you ask your client if they would compensate me for my time? As I don't mind looking at issues that could be problems with my code. However in this case they have clearly done something incompetently stupid that has caused me to go on a pointless wild goose chase. I'm self employed, so the time I've spent on this has cost me!

Gareth

@gjb2048 gjb2048 added Not a bug and removed Pending replication Triaged Issue read and is on backlog labels Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants