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

Problem and Solution of Course Reset - Assignment Dates

XMLWordPrintable

    • Any
    • MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • wip-mdl-31405-new
    • Hide

      Move 5 lines from reset_userdata to assignment_reset_userdata after its main loop is finished and will look like this (moodle 2.1.4):
      function assignment_reset_userdata($data) {
      global $CFG;

      $status = array();
      foreach (get_plugin_list('assignment') as $type=>$dir)

      { require_once("$dir/assignment.class.php"); $assignmentclass = "assignment_$type"; $ass = new $assignmentclass(); $status = array_merge($status, $ass->reset_userdata($data)); }

      /// moved code start
      /// updating dates - shift may be negative too
      if ($data->timeshift)

      { shift_course_mod_dates('assignment', array('timedue', 'timeavailable'), $data->timeshift, $data->courseid); $status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged').': '.$typestr, 'error'=>false); }

      /// moved code end

      return $status;
      }

      Show
      Move 5 lines from reset_userdata to assignment_reset_userdata after its main loop is finished and will look like this (moodle 2.1.4): function assignment_reset_userdata($data) { global $CFG; $status = array(); foreach (get_plugin_list('assignment') as $type=>$dir) { require_once("$dir/assignment.class.php"); $assignmentclass = "assignment_$type"; $ass = new $assignmentclass(); $status = array_merge($status, $ass->reset_userdata($data)); } /// moved code start /// updating dates - shift may be negative too if ($data->timeshift) { shift_course_mod_dates('assignment', array('timedue', 'timeavailable'), $data->timeshift, $data->courseid); $status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged').': '.$typestr, 'error'=>false); } /// moved code end return $status; }
    • Easy
    • Hide
      1. Create a course starting on 1/jan/2014
      2. Add one online assignment, one offline assignment, and three new assignment (assign) with "Allow submission from" 2/jan/2014
      3. Reset course with course start date as 2/jan/2014
      4. Make sure all all assignments have proper start date 3/jan/2014
      5. Rerun above test with assignment starting on 5/jan/2014 and reset course with course starting 10/jan/2014 and make sure dates for assignment is 13/jan/2014
      Show
      Create a course starting on 1/jan/2014 Add one online assignment, one offline assignment, and three new assignment (assign) with "Allow submission from" 2/jan/2014 Reset course with course start date as 2/jan/2014 Make sure all all assignments have proper start date 3/jan/2014 Rerun above test with assignment starting on 5/jan/2014 and reset course with course starting 10/jan/2014 and make sure dates for assignment is 13/jan/2014
    • BACKEND Sprint 6

      Course reset does not work correctly if activity dates are to be updated and course contains more than one type of assignment. This is due to fact that function assignment/lib.php: assignment_reset_userdata contains a loop for all assignment types. This calls the function reset_userdata and repetitively calls moodlelib.php::shift_course_mod_data. The last one should be called only once for all assignments.

        1. lib.patch
          0.8 kB
          Miroslav Fikar
        2. locallib.patch
          0.8 kB
          Miroslav Fikar

            rajeshtaneja Rajesh Taneja
            fikar Miroslav Fikar
            Damyon Wiese Damyon Wiese
            Dan Poltawski Dan Poltawski
            David Monllaó David Monllaó
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.