Commit Graph

16 Commits

Author SHA1 Message Date
Cody Cutrer c5227d3f1b shackles was renamed to guardrail
closes FOO-989, FOO-990

Change-Id: I49dfa130cb74c34dd0eb25952790176ae4951058
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249365
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-06 19:23:08 +00:00
Adrian Packel 29c2c0dabc Have missing policy applicator emit live events
flag = missing_policy_applicator_emits_live_events
closes TALLY-575

Test plan:
- Set up live events in your Canvas installation and monitor them (see
  the relevant live events documentation in the doc/ directory)
- Have a course with a missing policy enabled
- With the root-account "Missing Policy Applicator Emits Live Events"
  flag ON:
  - Create/publish an assignment requiring online submissions and with a
    due date in the near future
  - Bear witness to the ineluctable passage of time as it strips you of
    everything and everyone you hold dear
  - Check that each submission marked as missing for the above assignment
    has also emitted a corresponding submission_updated live event
- With the flag OFF:
  - Repeat the above process
  - The missing policy applicator's mass-update should NOT generate live
    events

Change-Id: Ifa84affe2242827e1695d0d9c539cf9d542ba425
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229181
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Nick Pitrak <npitrak@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2020-05-04 20:56:34 +00:00
Spencer Olson 6f4226498c missing policy: ignore submissions for unpublished assignments
Changes the Missing Policy so that it does not apply grades to
missing submissions for unpublished assignments.

closes TALLY-610
flag=none

Test Plan:
* have a course with a student enrolled
* create a missing policy for the course
* create an assignment with a due and until date for the
  near future and do not publish the assignment
* wait for the due date to pass, and for the missing policy to run
* verify no submissions for the assignment were graded

Change-Id: I81c46154c2735d467cafb174aab44321115833bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/227591
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2020-03-04 17:40:54 +00:00
Keith T. Garner c22a1490dd eliminate an N+1 in missing_policy_applicator
test plan:
 - specs pass

Change-Id: I1a116700ea957c4f57daec101e01c1419e623ff1
Reviewed-on: https://gerrit.instructure.com/209051
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Jenkins
QA-Review: Keith Garner <kgarner@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-09-11 19:46:11 +00:00
Adrian Packel 66cd71eb75 Post submissions in missing policy applicator
fixes GRADE-2297

Test plan:
- Have a course with new gradebook
- Enable post policies:
  > PostPolicy.enable_feature!

- Set up a missing policy for the course that applies a deduction
- Set up two assignments accepting online submissions with a due date in
  the very near future
  - Set one assignment to manually post, keep the other auto-post
- Allow a submission to pass the due date unsubmitted
- Run the missing policy applicator or let it run
- The score on the auto-posted assignment should be posted to the
  student
- The score on the manual assignment should *not* be posted

Change-Id: If3942f6c01042b07c5d5d752dd2819e3222f101d
Reviewed-on: https://gerrit.instructure.com/201238
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Bender <djbender@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-07-16 15:53:08 +00:00
Keith T. Garner 6cbc442a04 support missing for quiz_lti assignments
This broadens the view of missing submissions to include Quizzes.Next
submissions.

fixes GRADE-1287

test plan:
 - Have a course with a student and a Quizzes.Next assignment with the
   due date set to a day in the past and one set to the future.
 - Load the new gradebook. Note that past due quiz is colored for
   missing and the grade details trail also reports missing. Confirm
   the future quiz is neither missing nor late.
 - As a student submit the past due quiz.
 - Load the new gradebook. Note that the past due quiz is no longer
   missing but is now late.

Change-Id: Ie78b24e6882759ff2d30bf17816be08a501198eb
Reviewed-on: https://gerrit.instructure.com/200413
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Kevin Dougherty III <jdougherty@instructure.com>
2019-07-11 17:35:39 +00:00
Rob Orton 487da5ddca slave missing policy applicator
refs CORE-2598

test plan
 - specs should pass

Change-Id: If52db805067aecef56703bb9a827c083f2ceeb55
Reviewed-on: https://gerrit.instructure.com/186444
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-03-29 22:01:25 +00:00
Gary Mei 3323376988 update submission graded_at after missing policy
closes GRADE-1648

Test Plan
- Create a Missing Policy for the course.
- Create an assignment due 1 minute from now.
- Load the Gradebook and verify that the submissions are not
  considered missing.
- Wait for the due date to pass.
- Refresh the Gradebook until the cells indicate missing, and there
  is the Missing score applied to those submissions.
- Do a GET request to this endpoint:
  `api/v1/courses/:course_id/assignments/:assignment_id/submissions/:id`
- Verify that the graded_at is not nil, and is accurate to when the
  submission had the missing policy applied to it.

Change-Id: Ia709a3d8420d70838a95c5f774a492c5088ae2be
Reviewed-on: https://gerrit.instructure.com/179344
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-01-31 19:27:08 +00:00
Adrian Packel 8fc7cf8c3c Set grade_matches_current_submission in MPA
For any submissions considered missing, have the missing policy
applicator set grade_matches_current_submission to true. (This is
appropriate since the grade issued by the applicator matches the
submission's current lack-of-submission.)

fixes GRADE-1171

Test plan:
- Create a course with some students
- Open new Gradebook, click the settings cog, and enable "Automatically
  apply grade for missing submissions" and set a value
- Create an online-submitted assignment with a due date in the past
  - The entries in Gradebook should be appropriately marked as missing
- Open the assignment in SpeedGrader
  - In the menu at the top, the students should have a checkbox by their
    name indicating their submissions (or lack thereof) are graded
- Log in as one of the students and submit something for the assignment
- As the teacher, open the assignment in SpeedGrader again
  - That student should now have the "circle" icon by their name in the
    menu, indicating their new submission needs a grade

Change-Id: I35d5036341192eac6e8abe017f88067fb621ea29
Reviewed-on: https://gerrit.instructure.com/154075
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-19 15:01:40 +00:00
Jeremy Neander 63bc5bc5f9 mark missing submission as graded when deducting points
fixes GRADE-980

test plan:
 1. Select or create a Course with at least one Student
 2. Enable a missing policy
 3. Create an assignment due 12 hours ago
 4. Load the Rails console
 5. Load a submission for this Assignment
 6. Ensure the cached due date matches the assignment due date
 7. Manually update the submission

    submission.score = nil
    submission.grade = nil
    submission.workflow_state = "unsubmitted"
    submission.save!

 8. Manually run the missing policy applicator

    MissingPolicyApplicator.apply_missing_deductions

 9. Reload the submission
10. Verify the submission workflow state is "graded"

Change-Id: I1ba5b69e7f6e42c69baca61fe10d30a2db2bb0ff
Reviewed-on: https://gerrit.instructure.com/145437
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-04-04 18:34:09 +00:00
Spencer Olson 78ee060f31 late and missing policies ignore concluded students
Prevents late and missing policies from adjusting grades for concluded
students.

closes GRADE-728

Test Plan:
1.  In a course with New Gradebook enabled and at least one student,
    create 2 assignments worth 10 points (I will refer to these as
    Assignment 1 and Assignment 2).
2.  Go to the Gradebook. Make sure there are no late or missing policies
    enabled.
3.  For Assignment 1, give the student 10/10 and open the Grade Details
    Tray and mark the student as "Late" by 2 days.
4.  For Assignment 2, open the Grade Details Tray and mark the student
    as "Missing".
5.  Conclude the student.
6.  Go to the Gradebook. Click on the settings cog to bring up the
    Late Policies modal.
7.  Enable a missing policy that awards a 50% grade for missing
    submissions.
8.  Enable a late policy that deducts 10% per day, with a minimum grade
    of 0%.
9.  Click 'Apply'.
10. Verify the missing submission for the concluded student still does
    not have a grade.
11. Verify the late submission for the concluded student still has
    10/10.
12. Refresh the Gradebook and follow steps 10 & 11 again.

Change-Id: Icd34bc611c09f15db1f6a5f01531293869ed8eb8
Reviewed-on: https://gerrit.instructure.com/135791
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
Tested-by: Jenkins
2017-12-20 20:04:18 +00:00
Cody Cutrer 2d9f94d2f9 move dots to end of line for chained methods
so that when you copy/paste to console, it doesn't start executing
a partial query!!

Change-Id: Ica70b0c5f60557d62f15696d966924be451c495d
Reviewed-on: https://gerrit.instructure.com/133051
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-11-22 22:20:49 +00:00
Sheldon Leibole 68d66eea73 do not apply late policy to assignments not expecting submission
fixes CNVS-37415

Test Plan

1. Create a course with some students.
2. Create a late policy for both missing and late assignments
3. Add assignments
   a) Due in the last 24 hours
   b) Some that expect submissions (online text, url, etc.)
   c) Some that don't expect submissions (no submission, paper)
4. Immediately after creation verify the missing policy has been
   applied to submissions for assignments expecting a submissions,
   but not for those not expecting one.
5. Wait for the MissingPolicyApplicator job to run
65. Verify submissions for the assignments not expecting
   a submission have not had the late policy applied.
7. As a student make submissions for the assignments
   expecting a submission.
8. As a teacher grade the assignments with submissions
9. Verify the late policy is applied to your grade.
10. As a teacher grade the assignments not expecting a submission.
11. Verify the late policy is not applied to your grade.

Change-Id: I12c26195bbd8ab6310a628fce38a073e5332df3f
Reviewed-on: https://gerrit.instructure.com/118005
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-19 22:33:32 +00:00
Neil Gupta 695e57836c apply deductions when a missing policy changes
fixes CNVS-36866

test plan:
* Create a course with a student
* Create an assignment with a past due date
* Add a missing policy on the course
* The student's score for the missing submission should reflect your
  policy

Change-Id: I005cd64945e882c1ca9ebfc8cb70360640f24876
Reviewed-on: https://gerrit.instructure.com/113601
Tested-by: Jenkins
Reviewed-by: Matt Taylor <mtaylor@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-10 22:44:39 +00:00
Matt Taylor 2ce599d587 apply deductions for assignments missing submissions
closes CNVS-36867

Test Plan
  1. Create a course with "New Gradebook" enabled
  2. Create three students in the course
     a. Alice always submits assignments early
     b. Bob always submits assignments late
     c. Chad never submits anything
  3. Make sure all users and courses are set to the same time
     zone as your Mac.  If your Mac is on Mountain Time this
     will probably happen by default anyway)
  4. Create a late policy for the course
     a. deducts 10% every hour late, down to 50% score
     b. grants 30% score for missing submissions
  5. Create assignments in the course, due in a few minutes
     A. 10 points, grade as complete/incomplete
     B. 10 points, grade as points, submit on paper
     C. 10 points, grade as points, online text
     D. 10 points, online quiz
  7. Immediately enter Alice's submissions
     a. Masquerade as Alice, take quiz D (100%), submit C
     b. Mark Alice complete on A, 10 points on B and C
  8. Wait until 6 minutes after the assignments' due time
     a. Masquerade as Bob, take quiz D (100%), submit C
     b. Mark Bob complete on A, 10 points on B and C
  9. Verify grades and status indicators on the assignments
     Alice: A(OK) B(10) C(10) D(10)
     Bob:   B(OK) B(9)  C(9)  D(9) [late]
     Chad:  C(X)  B(3)  C(3)  D(3)  [missing]
 10. Change the due time on all assignments to 2 hours earlier
     than it was. Refresh the gradebook and verify
     Alice: A(OK) B(8)  C(8)  D(8) [late]
     Bob:   B(OK) B(7)  C(7)  D(7) [late]
     Chad:  C(X)  B(3)  C(3)  D(3)  [missing]

Change-Id: I7b81c907b678997ebecab7342012ba4678f7c94f
Reviewed-on: https://gerrit.instructure.com/113912
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Tested-by: Jenkins
Product-Review: Christi Wruck
2017-06-13 19:05:20 +00:00
Brian Park 54b9ec859b apply deductions for missing submissions periodically
closes CNVS-36153

Test Plan

NOTE: If you don't feel like waiting 5 minutes for the missing
deductions job to run open config/initializers/period_jobs.rb
and change */5 * * * * to */1 * * * * on line 183. This will
make the job run once per minute. This change will need to be
made prior to starting the rails server.

1. Create a course with some students in it
2. Create some quiz and non-quiz assignments
  a. Mix grading types and submission types
  b. Make sure at least one of the assignments is complete/incomplete
     and has some kind of online submission type
  c. Set the due dates for some of the assignments/quizzes to be in
     the past within the last 24 hours, some further in the past,
     some in the future. Make sure at least one complete/incomplete
     assignment has a due date within the last 24 hours and one
     other grading type within the last 24 hours.
  d. Create at least one assignment due within the last 24 hours and
  	 manually grade one of the students in your course, but not the
  	 others.
  d. Create at least one assignment due within the last 24 hours and:
     1. Mark one of its submissions as missing via the rails
     	console with:
     	Assignment.find(4).submissions.first.update(
     		late_policy_status: 'missing'
     	)
     2. Mark one if its submissions as late via the rails console:
       Assignment.find(4).submissions.second.update(
     		late_policy_status: 'late'
     	)
  f. Wait for the missing deductions job to run in the console you'll
     see output that starts with:
  	"periodic: MissingPolicyApplicator.apply_missing_deductions...."
  g. Visit Gradezilla.
  h. Verify that none of the assignments were automatically graded.
3. Create a LatePolicy for your course via the rails console like so:
   LatePolicy.create(
   	course_id: <COURSE_ID>,
   	missing_submission_deduction_enabled: true,
   	missing_submission_deduction: 90
   )
4. Wait for the job to run again.
5. Visit Gradezilla
6. Verify that grades have been correctly assigned based on missing
   policy. If you created the LatePolicy with the command given in
   step 3 you should see each assignment/quiz given a score of 10%
   of total points. Complete / Incomplete assignments should always
   be given a score of zero and grade of Incomplete. Verify that
   the Total score for the course has been updated.
7. The submission where you set late_policy_status to late should
   not have been graded but the other submissions for that
   assignment should have been.
8. Verify that the manually graded assignment did not have its score
   overridden by the missing policy.
9. Grading periods
  a. Create an assignment in an open grading period that is due
     within the last 24 hours.
  b. Verify that it gets automatically graded when the job runs.
  c. Create an assignment in a closed grading period due within
     the last 24 hours.
  d. Verify that it is not automatically graded when the job runs.
10. Due date overrides
  a. Create assignments with overrides for individual students.
  b. Verify that if the override is due within the last 24 hours
     the submission gets automatically graded.
  c. Verify that if the override is not due within the last 24 hours
     it is not automatically graded.
11. Create a couple more courses and run through some of the above
    scenarios to verify that all courses with a missing policy have
    their missing policy applied correctly.

Change-Id: I39fd9e4c641df83a3bb222fc4b4f48d1c35a767b
Reviewed-on: https://gerrit.instructure.com/109727
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Shahbaz Javeed <sjaveed@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-31 19:21:22 +00:00