Commit Graph

8 Commits

Author SHA1 Message Date
Cody Cutrer 72ce9c47c4 fix several N+1 found by Bullet
in spec/lib/*

Change-Id: Ia689e76f0f2bd435909a7d87ba2b1b6ba77fee93
Reviewed-on: https://gerrit.instructure.com/159150
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-08-02 16:37:02 +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
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 a8e3191c5c include previously late submissions in late policy recalculation
fixes CNVS-37332

Test Plan
  1. Create a course with one assignment and a student, Gary.
     Set a due date in the past for the assignment.
  2. Enable new gradebook feature flags on the course and
     create a late policy that deducts 10% per day.
  3. Masquerade as Gary, submit the assignment, and end the
     masquerade.
  4. Grade Gary's submission and verify that late points are
     deducted from the score.
  5. Change the assignment due date to a date in the future,
     because we like Gary.
  6. Return to the gradebook and verify that late policy
     deduction has been reversed.
  7. Change the assignment due date back to a date in the past.
     We still like Gary, but we have to test this.
  8. Return to the gradebook and verify that late points
     are deducted from the score.

Change-Id: I8351c6dec55655ebf33d632f1411ba3da7e2e38c
Reviewed-on: https://gerrit.instructure.com/117102
Tested-by: Jenkins
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-06 19:46:02 +00:00
Keith Garner 2cfaf5fb22 fix no method error in late policy applicator
This fixes a small logic error in LatePolicyApplicato that would cause
an undefined method error for NilClass when an assignment was assigned
to some students in a closed grading period and some students in an
open grading period.

fixes CNVS-37774

test plan:
 - Have a course in a term with a closed grading period and an open
   grading period and three students.
 - Attempt to create an assignment. Set the due dates for one student
   in the closed grading period and two students in the open grading
   period.
 - Observe that the assignment was created successfully.

Change-Id: If8e593302c96b7399214cbdf606ea929ff57ad15
Reviewed-on: https://gerrit.instructure.com/116816
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-06-27 18:28:04 +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
Shahbaz Javeed a4e109ea0c re-apply late policies to any late submissions as needed
the "as needed" refers to two cases:
* when late policy changes
* when an assignment's points_possible changes

closes CNVS-36656

test plan:
* Create a course with two assignments, two grading periods and
  two students enrolled
* Ensure one assignment is due in a closed grading period and the
  other in an open grading period
* Submit homework from both students so for each assignment one
  student submits the homework on time and the other submits it
  late
* Go to gradebook and grade the students
* Add a late policy to the course using the Rails console:

  course = Course.find(my_course_id)
  late_policy = LatePolicy.create(
    course: course,
    late_submission_deduction_enabled: true,
    late_submission_deduction: 50.0
  )
* Reload the gradebook and you should see the score of the late
  submission for the assignment in the open grading period to
  have changed (lowered)
* Verify that none of the other submissions had their scores
  changed

* Now edit the assignment in the open grading period and change
  its points possible to a higher number and save this change
* Reload the gradebook and you should see the score of the late
  submission for the assignment in the open grading period to
  have changed again
* Verify that none of the other submissions had their scores
  changed

* Now try this using three quiz submissions (early and late and
  just 45 seconds past the deadline).
* Verify in the gradebook that late policy deductions are applied
  only to quiz submissions that are later than 60 seconds after
  the quiz due date

Change-Id: I58ed3e3d0665870cf46d1b1e3ddf00f5f2f7008c
Reviewed-on: https://gerrit.instructure.com/110598
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-26 18:53:26 +00:00