Skip to content

Commit

Permalink
MDL-42526 mod_assignment : fix record insert with assigment.id 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiepratt committed May 22, 2014
1 parent a929fd5 commit fdb6811
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6781,14 +6781,13 @@ public static function allocate_unique_ids($assignid) {
// Shuffle the users.
shuffle($users);

$record = new stdClass();
$record->assignment = $assignid;
foreach ($users as $user) {
$record = $DB->get_record('assign_user_mapping',
array('assignment'=>$assignid, 'userid'=>$user->id),
'id');
if (!$record) {
$record = new stdClass();
$record->assignment = $assignid;
$record->userid = $user->id;
$DB->insert_record('assign_user_mapping', $record);
}
Expand Down

0 comments on commit fdb6811

Please sign in to comment.