by Damyon Wiese.
The problem is that all submission plugins are keyed on the submission - but feedback plugins are keyed on the grade. grade !== submission
The assignfeedback_file table does not even have a submission column.
I guess this would work:
But it probably won't give you what you expect. You will get multiple grades per student (because they have multiple attempts).
To get all the current feedback files for an assignment - my pseudo code would go the other way:
The assignfeedback_file table does not even have a submission column.
I guess this would work:
$records2 = $DB->get_records('assignfeedback_file', array('assignment' => $this->get_instance()->importfrom));
foreach ($records2 as $record)
{
$files = $fs->get_area_files($assigncontext->id,
"assignfeedback_file",
"feedback_files",
$record->grade,
"id",
false);
$grade = $DB->get_record('assign_grade', array('id' => $record->grade));
...
}
But it probably won't give you what you expect. You will get multiple grades per student (because they have multiple attempts).
To get all the current feedback files for an assignment - my pseudo code would go the other way:
1. Get all the enrolled students for this assignment: assign->list_participants()
2. For each student
3. Get their latest grade record: assign->get_user_grade($userid, false, -1)
4. Get the feedback files: assign->get_feedback_plugin_by_type('file')->get_files($grade->id, $student)