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

Assignment not showing in Grade me block #18

Open
wants to merge 1 commit into
base: MOODLE_31_STABLE
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/assign/assign_plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function block_grade_me_query_assign($gradebookusers) {
LEFT JOIN {assign_grades} ag ON ag.assignment = asgn_sub.assignment AND ag.userid = asgn_sub.userid AND
asgn_sub.attemptnumber = ag.attemptnumber
WHERE asgn_sub.userid $insql AND asgn_sub.status = 'submitted' AND a.grade <> 0
AND (ag.grade = -1 OR asgn_sub.timemodified >= ag.timemodified)";
AND (ag.id IS NULL OR asgn_sub.timemodified >= ag.timemodified)";

return array($query, $inparams);
}
11 changes: 9 additions & 2 deletions tests/grade_me_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,15 @@ public function test_query_assign() {
$rec3->submissionid = '7';
$rec3->userid = $users[0]->id;
$rec3->timesubmitted = '6';

$expected = array($rec->id => $rec, $rec2->id => $rec2, $rec3->id => $rec3);

$rec4 = new stdClass();
$rec4->id = $plugins[1]->id;
$rec4->courseid = $courses[0]->id;
$rec4->submissionid = '1';
$rec4->userid = $users[0]->id;
$rec4->timesubmitted = '1';

$expected = array($rec->id => $rec, $rec2->id => $rec2, $rec3->id => $rec3, $rec4->id => $rec4);
$actual = $DB->get_records_sql($sql, $insqlparams);
$this->assertEquals($expected, $actual);
$this->assertFalse(block_grade_me_query_assign(array()));
Expand Down