Moodle
  1. Moodle
  2. MDL-25887

Grade import produces a lot of php notices

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Gradebook
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      15796

      Description

      I went into one of my courses, went to the gradebook and did a grade export. I created a second course and attempted to import the grades into that course. The following was output.

      Notice: Undefined property: stdClass::$mapping_1 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_2 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_3 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_4 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_5 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_6 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_7 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_8 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_9 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_10 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_11 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_12 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_13 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_14 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_15 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapping_16 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      ( ! ) Notice: Undefined property: stdClass::$mapping_17 in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 180
      Call Stack

      1. Time Memory Function Location
        1 0.0010 338192 {main}( ) ../index.php:0

        ( ! ) Notice: Undefined property: stdClass::$mapfrom in /home/andrew/Desktop/git/moodle_mygithub/grade/import/csv/index.php on line 184
        Call Stack
        # Time Memory Function Location
        1 0.0010 338192 {main}

        ( ) ../index.php:0

      user mapping error, could not find user!

        Issue Links

          Activity

          Hide
          Andrew Davis added a comment -
          Show
          Andrew Davis added a comment - Discussions about grade import problems. http://moodle.org/mod/forum/discuss.php?d=164984 http://moodle.org/mod/forum/discuss.php?d=165866
          Hide
          Andrew Davis added a comment -

          Fixed a problem that prevented grade import from finding the correct users. Also added some handling for when empty grades are included in the export.

          Ready for peer review.

          repo: git://github.com/andyjdavis/moodle.git
          branch: MDL-25887_grade_import
          diff: https://github.com/andyjdavis/moodle/compare/master...MDL-25887_grade_import

          Show
          Andrew Davis added a comment - Fixed a problem that prevented grade import from finding the correct users. Also added some handling for when empty grades are included in the export. Ready for peer review. repo: git://github.com/andyjdavis/moodle.git branch: MDL-25887 _grade_import diff: https://github.com/andyjdavis/moodle/compare/master...MDL-25887_grade_import
          Hide
          Sam Hemelryk added a comment -

          Hi Andrew,

          The code changes you are making look fine, and after testing before and after the patch seem to do that trick.
          While your changes look great I did not a couple of other things you could fix up while you are in that file if you want.

          1. There should be an fclose($fp); at the end of the if statement starting line 88
          2. Mapping select boxes should proceed activities with the activity type like the label does, e.g. Forum: Blah

          On a side note I found the following two bugs that I'll file issues for:

          1. You can proceed through without uploading a file, this seems to be a bug with the mforms required rule, or filepicker element, not too sure but I'll create an issue for it.
          2. When parsing the CSV file we don't respect quoted fields which is a particular problem if the field contains a separator character.

          Anyway I'll leave it up to you how far down that rabbit hole you go

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Hi Andrew, The code changes you are making look fine, and after testing before and after the patch seem to do that trick. While your changes look great I did not a couple of other things you could fix up while you are in that file if you want. There should be an fclose($fp); at the end of the if statement starting line 88 Mapping select boxes should proceed activities with the activity type like the label does, e.g. Forum: Blah On a side note I found the following two bugs that I'll file issues for: You can proceed through without uploading a file, this seems to be a bug with the mforms required rule, or filepicker element, not too sure but I'll create an issue for it. When parsing the CSV file we don't respect quoted fields which is a particular problem if the field contains a separator character. Anyway I'll leave it up to you how far down that rabbit hole you go Cheers Sam
          Hide
          Sam Hemelryk added a comment -

          Linked to bug I created re: proceeding without uploading a file.

          Show
          Sam Hemelryk added a comment - Linked to bug I created re: proceeding without uploading a file.
          Hide
          Andrew Davis added a comment -

          Ive pushed changes that fix those 2 issues you mentioned (missing fclose and added activity types in the mapping drop down).

          Show
          Andrew Davis added a comment - Ive pushed changes that fix those 2 issues you mentioned (missing fclose and added activity types in the mapping drop down).
          Hide
          Andrew Davis added a comment -

          Ive created PULL-101 to get this integrated.

          Show
          Andrew Davis added a comment - Ive created PULL-101 to get this integrated.
          Hide
          Tieku Bortei-Doku added a comment -

          This is still not fixed. Just tested with the latest build of 2.0

          Show
          Tieku Bortei-Doku added a comment - This is still not fixed. Just tested with the latest build of 2.0
          Hide
          Sam Hemelryk added a comment -

          Hi Tieku,

          Did you apply Andrew's changes to your site before testing?

          While the issue has been marked as fixed it hasn't yet made it through to the stable downloads.
          It first needs to be formally reviewed and tested by our QA team which should be happening today.

          If you did apply the patch and test do you mind elaborating on the problems you experienced, were they the same sort of notifications or something different?

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Hi Tieku, Did you apply Andrew's changes to your site before testing? While the issue has been marked as fixed it hasn't yet made it through to the stable downloads. It first needs to be formally reviewed and tested by our QA team which should be happening today. If you did apply the patch and test do you mind elaborating on the problems you experienced, were they the same sort of notifications or something different? Cheers Sam
          Hide
          Petr Škoda added a comment -

          committed, thanks

          Show
          Petr Škoda added a comment - committed, thanks

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: