diff --git a/main/gradebook/gradebook_edit_result.php b/main/gradebook/gradebook_edit_result.php index e92f5e8ec4..cfc5b39373 100755 --- a/main/gradebook/gradebook_edit_result.php +++ b/main/gradebook/gradebook_edit_result.php @@ -28,13 +28,18 @@ $edit_result_form = new EvalForm( if ($edit_result_form->validate()) { $values = $edit_result_form->exportValues(); $scores = $values['score']; - foreach ($scores as $row) { - $resultedit = Result:: load(key($scores)); - $row_value = $row; - if ($row_value != '') { - $resultedit[0]->set_score(api_number_format($row_value, api_get_setting('gradebook_number_decimals'))); - $resultedit[0]->save(); + foreach ($scores as $userId => $score) { + /** @var array $resultedit */ + $resultedit = Result::load($userId); + /** @var Result $result */ + $result = $resultedit[0]; + + if ('' == $score) { + continue; } + + $result->set_score(api_number_format($score, api_get_setting('gradebook_number_decimals'))); + $result->save(); } Display::addFlash(Display::return_message(get_lang('AllResultsEdited'))); header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq());