Ignore:
Timestamp:
May 2, 2016, 12:09:23 PM (3 years ago)
Author:
jrpelegrina
Message:

Updated to moodle 3.0.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • moodle/trunk/fuentes/grade/import/csv/classes/load_data.php

    r136 r1331  
    181181     * @param int $key Current row identifier.
    182182     * @param string $value The value for this row (final grade).
    183      * @return array new grades that are ready for commiting to the gradebook.
     183     * @return stdClass new grade that is ready for commiting to the gradebook.
    184184     */
    185185    protected function import_new_grade_item($header, $key, $value) {
     
    200200        $newgrade->newgradeitem = $this->newgradeitems[$key];
    201201
    202         // If the user has a grade for this grade item.
    203         if (trim($value) != '-') {
    204             // Instead of omitting the grade we could insert one with finalgrade set to 0.
    205             // We do not have access to grade item min grade.
     202        $trimmed = trim($value);
     203        if ($trimmed === '' or $trimmed == '-') {
     204            // Blank or dash grade means null, ie "no grade".
     205            $newgrade->finalgrade = null;
     206        } else {
     207            // We have an actual grade.
    206208            $newgrade->finalgrade = $value;
    207             $newgrades[] = $newgrade;
    208         }
    209         return $newgrades;
     209        }
     210        $this->newgrades[] = $newgrade;
     211        return $newgrade;
    210212    }
    211213
     
    386388            break;
    387389            case 'new':
    388                 $this->newgrades = $this->import_new_grade_item($header, $key, $value);
     390                $this->import_new_grade_item($header, $key, $value);
    389391            break;
    390392            case 'feedback':
     
    576578                    } else {
    577579                        // The grade item for this is not updated.
     580                        $newfeedback->importonlyfeedback = true;
    578581                        $insertid = self::insert_grade_record($newfeedback, $this->studentid);
    579582                        // Check to see if the insert was successful.
Note: See TracChangeset for help on using the changeset viewer.