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

Assign date validation should use >=

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1, 3.4, 3.4.4
    • Fix Version/s: 3.4.5, 3.5.2
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      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.    
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull 3.4 Branch:
    • Pull 3.5 Branch:
    • Pull Master Branch:
      MDL-38301-master

      Description

      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)

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Sep/18

                Time Tracking

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