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

Assign date validation should use >=

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.4.5, 3.5.2
    • 2.3.4, 2.4.1, 3.4, 3.4.4
    • Assignment
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_34_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-38301-master
    • Hide

      Testing steps:

      1. As Admin create a new Course
      2. Create a new Assignment with:
        • Allow submissions from date set to a particular date (e.g. today's date)
        • Due date set to a day before or equal to the Allow submissions from date
        • Cut-off date set to a day before or equal to the Due date
        • Remind me to grade by date to a day before or equal to the Cut-off date
      3. Save the Assignment
      4. You should see the following error messages:
        • Due date cannot be earlier than the allow submissions from date.
        • Cut-off date cannot be earlier than the allow submissions from date.
        • Remind me to grade by date cannot be earlier than the due date.
      5. Update the Due date to a date equal to or after the Allow submissions from date, the existing 'Due date cannot be earlier than the allow submissions from date.' error message should not be shown.
      6. Update the Cut-off date to a date to a date equal to or after the Due date, the existing 'Cut-off date cannot be earlier than the allow submissions from date.' error message should not be shown.
      7. Update the Remind me to grade by date to a date equal to or after the Due date, the existing 'Remind me to grade by date cannot be earlier than the due date.' error message should not be shown.
      8. Repeat testing from Step 2. but only update the Cut-off date to a date before the Due date, but both dates are greater than the Allow submissions from date.
      9. You should see the following error message:
        • Cut-off date cannot be earlier than the due date.
           
           

      Show
      Testing steps: As Admin create a new Course Create a new Assignment with: Allow submissions from date set to a particular date (e.g. today's date) Due date set to a day before or equal to the Allow submissions from date Cut-off date set to a day before or equal to the Due date Remind me to grade by date to a day before or equal to the Cut-off date Save the Assignment You should see the following error messages: Due date cannot be earlier than the allow submissions from date. Cut-off date cannot be earlier than the allow submissions from date. Remind me to grade by date cannot be earlier than the due date. Update the Due date  to a date equal to or after the Allow submissions from date , the existing ' Due date cannot be earlier than the allow submissions from date. ' error message should not be shown. Update the Cut-off date to a date  to a date equal to or after the Due date , the existing ' Cut-off date cannot be earlier than the allow submissions from date. ' error message should not be shown. Update the  Remind me to grade by date to a date equal to or after the Due date , the existing ' Remind me to grade by date cannot be earlier than the due date. ' error message should not be shown. Repeat testing from Step 2. but only update the  Cut-off date  to a date before the  Due date , but both dates are greater than the  Allow submissions from date . You should see the following error message: Cut-off date cannot be earlier than the due date.    

      I was looking at the code for validating dates for the new assignment.

      if ($data['allowsubmissionsfromdate'] && $data['duedate']) {
          if ($data['allowsubmissionsfromdate'] > $data['duedate']) {
              $errors['duedate'] = get_string('duedatevalidation', 'assign');
          }
      }
      if ($data['duedate'] && $data['cutoffdate']) {
          if ($data['duedate'] > $data['cutoffdate']) {
              $errors['cutoffdate'] = get_string('cutoffdatevalidation', 'assign');
          }
      }
      if ($data['allowsubmissionsfromdate'] && $data['cutoffdate']) {
          if ($data['allowsubmissionsfromdate'] > $data['cutoffdate']) {
              $errors['cutoffdate'] = get_string('cutoffdatefromdatevalidation', 'assign');
          }
      }
      

      Considering the ranges tested, I was wondering if the first and last tests should allow the submissionfrom and compared dates (duedate and cutoffdate) to be equal. I suggest that these two comparisons should use >= to prevent the case where the dates are equal to allow students to have time to submit. The validation strings support this assumption. I can't think of a contradictory case (perhaps an offline assignment).

      (Damyon: Sounds correct to me - but the upgrade code will need to do something sensible for assignments with these dates already set to == - and if this is valid for offline assignments that will need special handling)

        1. MDL-38301-Ass_with_dates_before_allow_submission_from.png
          124 kB
          Zig Tan
        2. MDL-38301-Cut_off_date_is_earlier_than_Due_date.png
          123 kB
          Zig Tan
        3. Verified MDL-38301_Step 4.PNG
          29 kB
          Gladys Basiana
        4. Verified MDL-38301_Step 5,6,7.PNG
          84 kB
          Gladys Basiana
        5. Verified MDL-38301_Step 8,9.PNG
          24 kB
          Gladys Basiana

            zig Zig Tan (Inactive)
            salvetore Michael de Raadt
            Jun Pataleta Jun Pataleta
            David Monllaó David Monllaó
            Gladys Basiana Gladys Basiana
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

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