Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31433

Gradebook scale type item, FINALGRADE = 0/(null)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0.7
    • Fix Version/s: None
    • Component/s: Gradebook
    • Labels:
      None
    • Environment:
      2.0.7, ORACLE
    • Database:
      Oracle
    • Workaround:
      Hide

      Anyway, I have a little work around to show "-" for those records with 0, when turn gradebook editing off.

      In the lib/gradelib.php:

      function grade_format_gradevalue_real($value, $grade_item, $decimals, $localized) {
      if ($grade_item->gradetype == GRADE_TYPE_SCALE) {
      if (!$scale = $grade_item->load_scale())

      { return get_string('error'); }

      + //Longfei-OIT, 1/30/2012; Jira 393; weird value "0", should be "(null)" in DB
      + if ($value == 0)
      + return '-';
      $value = $grade_item->bounded_grade($value);
      return format_string($scale->scale_items[$value-1]);

      } else

      { return format_float($value, $decimals, $localized); }

      }

      Show
      Anyway, I have a little work around to show "-" for those records with 0, when turn gradebook editing off. In the lib/gradelib.php: function grade_format_gradevalue_real($value, $grade_item, $decimals, $localized) { if ($grade_item->gradetype == GRADE_TYPE_SCALE) { if (!$scale = $grade_item->load_scale()) { return get_string('error'); } + //Longfei-OIT, 1/30/2012; Jira 393; weird value "0", should be "(null)" in DB + if ($value == 0) + return '-'; $value = $grade_item->bounded_grade($value); return format_string($scale->scale_items [$value-1] ); } else { return format_float($value, $decimals, $localized); } }
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      The FINALGRADE in the GRADE_GRADES table is 0.

      Last Friday, one instructor created about 20 manual grade items in her gradebook, and the type was SCALE (Absent, Excused, Present). From what I learned (not sure if it's correct or not), in the GRADE_GRADES table, all of the FINALGRADE for the SCALE type of items should be 1, 2, 3. However, today, in our database (ORACLE) I found most of them are "0", and some are "(null)". When I made the gradebook editable, the ones with value "0" and "(null)" show as "No garde". When I turned the editing off, the ones with "0" show as "Absent", and the ones with "(null)" show as "-".

      I have no idea why there are records with "0" in the database tables, I thought either should be 1, 2, 3 or just no record for those students (still not graded yet). Also, I have no idea where the "Absent" comes from for those records with FINALGRADE as 0 in the GRADE_GRADES table when editing off. I think there is something to do with the lib/grade/grade_scale.php.

      I am wondering how those records (with FINALGRADE as 0/(null) for manual SCALE type of homework).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              longfeiyu Longfei Yu
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: