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

Gradebook: Import outcomes error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.2, 2.4
    • Fix Version/s: 2.3.5, 2.4.2
    • Component/s: Gradebook
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      Hide
      • As an admin, Enable outcomes in "Site administration > Advanced features"
      • If don't already have an outcome export file create one. Go to Site Administration > Grades > Outcomes and click "Export all outcomes".
      • As a teacher, try to import outcomes from an export file by going to a course grade book and selecting import outcomes from the gradebook navigation drop down.
        You should be able to import those outcomes
      • As admin, go back to the outcome import screen. You should have the option to import it either a custom or standard outcome.
        The import should proceed without error although you may be told the outcome already exists so no importing was actually done
      Show
      As an admin, Enable outcomes in "Site administration > Advanced features" If don't already have an outcome export file create one. Go to Site Administration > Grades > Outcomes and click "Export all outcomes". As a teacher, try to import outcomes from an export file by going to a course grade book and selecting import outcomes from the gradebook navigation drop down. You should be able to import those outcomes As admin, go back to the outcome import screen. You should have the option to import it either a custom or standard outcome. The import should proceed without error although you may be told the outcome already exists so no importing was actually done
    • Workaround:
      Hide

      Import outcomes as an administrator

      Show
      Import outcomes as an administrator
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:
      MDL-36128-master

      Description

      Attempting to import an outcomes file as a teacher into the latest 2.3.2 fails, with the message:

      "An error occurred, this script wasn't called with the right parameters."

      The file imports without any problem when I'm logged in as an admin.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              lsmith Lesli Smith added a comment -

              Hi. I'm getting this exact error in 2.3, but only when logged in as a teacher. If I'm logged in as an admin, the files import fine. I'm trying to create templates for teachers to import into their courses on their own as custom outcomes (in the pic, it says standards because that is what they want the outcomes called on that site). I looked at permissions and can't figure out if there is some permission amiss. Thanks for any assistance.

              Show
              lsmith Lesli Smith added a comment - Hi. I'm getting this exact error in 2.3, but only when logged in as a teacher. If I'm logged in as an admin, the files import fine. I'm trying to create templates for teachers to import into their courses on their own as custom outcomes (in the pic, it says standards because that is what they want the outcomes called on that site). I looked at permissions and can't figure out if there is some permission amiss. Thanks for any assistance.
              Hide
              lsmith Lesli Smith added a comment -

              Reproduced on my very basic desktop, vanilla install, normal roles version, too.

              Show
              lsmith Lesli Smith added a comment - Reproduced on my very basic desktop, vanilla install, normal roles version, too.
              Hide
              marycooch Mary Cooch added a comment -

              I have just tested this out on my own local install Moodle 2.3.3+ (Build: 20121018) and I have the same error message.

              Show
              marycooch Mary Cooch added a comment - I have just tested this out on my own local install Moodle 2.3.3+ (Build: 20121018) and I have the same error message.
              Hide
              poltawski Dan Poltawski added a comment -

              I think this is the fix, but I have just guessed from code, not tested

              diff --git a/grade/edit/outcome/import.php b/grade/edit/outcome/import.php
              index c10a858..3cb3a39 100644
              --- a/grade/edit/outcome/import.php
              +++ b/grade/edit/outcome/import.php
              @@ -32,7 +32,7 @@ $courseid = optional_param('courseid', 0, PARAM_INT);
               $action   = optional_param('action', '', PARAM_ALPHA);
               $scope    = optional_param('scope', 'global', PARAM_ALPHA);
               
              -$PAGE->set_url('/grade/edit/outcome/import.php', array('courseid' => $courseid));
              +$PAGE->set_url('/grade/edit/outcome/import.php', array('courseid' => $courseid, 'scope' => $scope));
               
               /// Make sure they can even access this course
               if ($courseid) {

              Show
              poltawski Dan Poltawski added a comment - I think this is the fix, but I have just guessed from code, not tested diff --git a/grade/edit/outcome/import.php b/grade/edit/outcome/import.php index c10a858..3cb3a39 100644 --- a/grade/edit/outcome/import.php +++ b/grade/edit/outcome/import.php @@ -32,7 +32,7 @@ $courseid = optional_param('courseid', 0, PARAM_INT); $action = optional_param('action', '', PARAM_ALPHA); $scope = optional_param('scope', 'global', PARAM_ALPHA); -$PAGE->set_url('/grade/edit/outcome/import.php', array('courseid' => $courseid)); +$PAGE->set_url('/grade/edit/outcome/import.php', array('courseid' => $courseid, 'scope' => $scope)); /// Make sure they can even access this course if ($courseid) {
              Hide
              marycooch Mary Cooch added a comment -

              just removing 2.3.3 since we never had it

              Show
              marycooch Mary Cooch added a comment - just removing 2.3.3 since we never had it
              Hide
              bunwich bunwich added a comment -

              Hi Everyone,

              Two possible choices to fix this issue, I'll leave it up to the maintainer to pick the best.

              On the outcomes import page.
              Admins can choose custom scope or global scope.
              Teachers do not have a choice, and should always be uploading outcomes to a course.

              This means that by default the scope should always be 'custom'.

              Option 1:

              change Line 33 ./grade/edit/outcome/import.php
              $scope    = optional_param('scope', 'global', PARAM_ALPHA);
              to 
              $scope    = optional_param('scope', 'custom', PARAM_ALPHA);
               

              Option 2:
              Change the form creation so that scope is always passed in the form. Right now scope is only passed when a user has system wide capabilities. If they only have course capabilities for importing outcomes, no scope is passed hence then confusion.

               
              diff --git a/grade/edit/outcome/import_outcomes_form.php b/grade/edit/outcome/import_outcomes_form.php
              index 4a263c8..978550e 100644
              --- a/grade/edit/outcome/import_outcomes_form.php
              +++ b/grade/edit/outcome/import_outcomes_form.php
              @@ -45,6 +45,8 @@ class import_outcomes_form extends moodleform {
                           $mform->addElement('radio', 'scope', get_string('importcustom', 'grades'), null, 'custom');
                           $mform->addElement('radio', 'scope', get_string('importstandard', 'grades'), null, 'global');
                           $mform->setDefault('scope', 'custom');
              +        } else {
              +               $mform->addElement('hidden', 'scope', 'custom');
                       }
               
                       $mform->addElement('filepicker', 'userfile', get_string('importoutcomes', 'grades'));
               

              Show
              bunwich bunwich added a comment - Hi Everyone, Two possible choices to fix this issue, I'll leave it up to the maintainer to pick the best. On the outcomes import page. Admins can choose custom scope or global scope. Teachers do not have a choice, and should always be uploading outcomes to a course. This means that by default the scope should always be 'custom'. Option 1: change Line 33 ./grade/edit/outcome/import.php $scope = optional_param('scope', 'global', PARAM_ALPHA); to $scope = optional_param('scope', 'custom', PARAM_ALPHA);   Option 2: Change the form creation so that scope is always passed in the form. Right now scope is only passed when a user has system wide capabilities. If they only have course capabilities for importing outcomes, no scope is passed hence then confusion.   diff --git a/grade/edit/outcome/import_outcomes_form.php b/grade/edit/outcome/import_outcomes_form.php index 4a263c8..978550e 100644 --- a/grade/edit/outcome/import_outcomes_form.php +++ b/grade/edit/outcome/import_outcomes_form.php @@ -45,6 +45,8 @@ class import_outcomes_form extends moodleform { $mform->addElement('radio', 'scope', get_string('importcustom', 'grades'), null, 'custom'); $mform->addElement('radio', 'scope', get_string('importstandard', 'grades'), null, 'global'); $mform->setDefault('scope', 'custom'); + } else { + $mform->addElement('hidden', 'scope', 'custom'); }   $mform->addElement('filepicker', 'userfile', get_string('importoutcomes', 'grades'));  
              Hide
              lsmith Lesli Smith added a comment -

              Thanks! I'm not sure which one the maintainer of my site picked, but it is now working for my teachers.

              Show
              lsmith Lesli Smith added a comment - Thanks! I'm not sure which one the maintainer of my site picked, but it is now working for my teachers.
              Hide
              gaudreaj Jean-Philippe Gaudreau added a comment -

              Hi guys,

              I'll take it from here and go with "Option 1" since I think it's the cleanest way to fix the bug.

              Thx for patch!

              Show
              gaudreaj Jean-Philippe Gaudreau added a comment - Hi guys, I'll take it from here and go with "Option 1" since I think it's the cleanest way to fix the bug. Thx for patch!
              Hide
              andyjdavis Andrew Davis added a comment -

              I've been able to replicate this in the latest version so it's still an issue. The patch looks great. I've filled out the testing instructions a bit. Putting this up for integration review.

              Show
              andyjdavis Andrew Davis added a comment - I've been able to replicate this in the latest version so it's still an issue. The patch looks great. I've filled out the testing instructions a bit. Putting this up for integration review.
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

              TIA and ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
              Hide
              gaudreaj Jean-Philippe Gaudreau added a comment -

              Branches rebased!

              Thx

              Show
              gaudreaj Jean-Philippe Gaudreau added a comment - Branches rebased! Thx
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Thanks everyone, this has been integrated now.

              Show
              samhemelryk Sam Hemelryk added a comment - Thanks everyone, this has been integrated now.
              Hide
              phalacee Jason Fowler added a comment -

              All good Jean-Philippe, thanks.

              Show
              phalacee Jason Fowler added a comment - All good Jean-Philippe, thanks.
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              This is valid for unlimited entries to the, soon to be unveiled, Moodle Codebase Gardens. It includes free access to all facilities.

              Personal and non-transferable to all assignees, reviewers and testers in this issue. Valid until switching to Blackboard (100000€ penalization will be applied).

              Thanks, closing as fixed!

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - This is valid for unlimited entries to the, soon to be unveiled, Moodle Codebase Gardens. It includes free access to all facilities. Personal and non-transferable to all assignees, reviewers and testers in this issue. Valid until switching to Blackboard (100000€ penalization will be applied). Thanks, closing as fixed!

                People

                • Votes:
                  6 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13