Commit Graph

2 Commits

Author SHA1 Message Date
Cody Cutrer 809904d8b6 add frozen_string_literal comment to migrations
Change-Id: Idf4ddb29567c1dfab9f01b09c7a1056367ae7b44
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261814
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-03-30 18:14:36 +00:00
Spencer Olson 0f3f341e72 add seconds_late_override to submissions table
Remove accepted_at and add seconds_late_override to the submissions
table.

closes CNVS-37893

Test Plan:
1. Verify running the migrations in this commit removes accepted_at
   and adds seconds_late_override to the submissions table.
2. Verify rolling back the migrations in this commit adds accepted_at
   and removes seconds_late_override from the submissions table.
3. Run the migration before following the next steps.
4. In a rails console, find a submission and set its late_policy_status
   to nil.

     s = Submission.find(<submission id>)
     s.update!(late_policy_status: nil)

5. Verify you cannot set seconds_late_override.

     s.update!(seconds_late_override: 60)
     s.seconds_late_override # => nil

6. Set the late_policy_status to "late" and verify you can set the
   seconds_late_override. Also verify the seconds_late method now
   returns the overridden value.

     s.update!(late_policy_status: "late", seconds_late_override: 60)
     s.seconds_late_override # => 60
     s.seconds_late # => 60
     s.update!(seconds_late_override: 20)
     s.seconds_late_override # => 20
     s.seconds_late # => 20

7. Set the late_policy_status to something other than "late" and verify
   the seconds_late_override is set to nil.

     s.update!(late_policy_status: "missing")
     s.seconds_late_override # nil

8. As a teacher, hit the submissions update API endpoint
   (PUT "/api/v1/courses/#{course.id}/assignments/#{assignment.id}/
         submissions/#{student.id}.json")

   and pass:

   submission: {
     late_policy_status: 'late',
     seconds_late_override: 60
   }

   a. Make sure the json response includes a late_policy_status of
      "late" and a seconds_late of 60.
   b. Load the submission in rails console and make sure its
      late_policy_status is set to "late" and its seconds_late_override
      is set to 60.

9. As a teacher, hit the submissions update API endpoint
   (PUT "/api/v1/courses/#{course.id}/assignments/#{assignment.id}/
         submissions/#{student.id}.json")

   and pass:

   submission: {
     late_policy_status: 'missing',
     seconds_late_override: 60
   }

   a. Make sure the json response includes a late_policy_status of
      "missing" and a seconds_late of 0.
   b. Load the submission in rails console and make sure its
      late_policy_status is set to "missing" and its
      seconds_late_override is set to nil.

Change-Id: I9a8070445482b7029454cdfbbcc266aaab5a3e4b
Reviewed-on: https://gerrit.instructure.com/117476
Tested-by: Jenkins
Reviewed-by: Matt Taylor <mtaylor@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-07 20:57:18 +00:00