Commit Graph

81 Commits

Author SHA1 Message Date
James Williams cf2488b2bc switch grade logging from info to debug
Change-Id: I93bfcc9407e169e575d96c6d23c8020de07f639b
Reviewed-on: https://gerrit.instructure.com/142581
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-03-05 21:21:12 +00:00
Shahbaz Javeed 11f764f833 fix stale grades when re-assigning students to assignment
closes GRADE-819

The specific case was to unassign a graded student from an assignment by
removing "Everyone" and adding all students except one to the
assignment.  Then remove all students and assign "Everyone" to the
assignment.  This should make the previously unassigned student's grades
stale.

test plan:
* Configure delayed jobs to use 6 simultaneously running workers
  by editing config/delayed_jobs.yml to look like this:

  default:
    workers:
    - queue: canvas_queue
      workers: 6

  Notice the line that says "workers: 6"
* Restart the jobs container so all six new workers are started
* Create a published course with one assignment worth 150 points
  and two students enrolled
* For the remainder of these steps, let's assume unique identifer
  for the course is "course_id" and the unique identifier for
  the student is "student_id"
* Go to the Gradebook and grade the first student at 125 points
  and wait for their score to be updated in the gradebook.
* Verify the score in the Gradebook is 83.33%
* In a separate tab, visit the following URL, making sure to
  replace course_id with the actual course id and student_id
  with the actual student id:

  /api/v1/courses/course_id/enrollments?user_id=student_id

* Verify that you see the student's current_score as 83.33
* Repeat the following steps multiple times to ensure the
  problem does not manifest itself:

  - Modify the assignment: unassign it from the first student
    and only assign it to the second student only
  - Go to the gradebook and verify the cells for the first student
    are not editable any more
  - Go back to the API URL above and verify the student's
    current_score now says null

  - Modify the assignment: re-assign it to "Everyone"
  - Go to the gradebook and verify the cells for the first student
    are now editable again
  - Go back to the API URL above and verify the student's
    current_score now says 83.33 again.  If it ever says null
    at this point, there is a problem.

Change-Id: Ifaaf0609dfe5081697c1939db1b4a4e0a3e05bad
Reviewed-on: https://gerrit.instructure.com/141049
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-22 16:04:24 +00:00
Shahbaz Javeed a18991b819 Store points and points_possible for all Scores
closes GRADE-8

test plan:
Store points and points_possible for all Scores

closes GRADE-8

test plan:
** Setup
* Create a course in a term with two grading periods GP1 and GP2
* Weight the grading periods as: GP1: 30%, GP2: 70%
* Create four assignment groups AG1, AG2, AG3 and AG4
  - Ensure the assignment groups have a rule to drop the 1 lowest
    score
* Weight the assignment groups as: AG1: 15%, AG2: 20%, AG3: 25%, AG4: 40%
* Create three assignments in AG1, AG1-1, AG1-2, AG1-3
  - Ensure they're all due in GP1
  - Ensure they have the following points possible:
    AG1-1: 5, AG1-2: 10, AG1-3: 15
  - Mute AG1-1
* Create three assignments in AG2, AG2-1, AG2-2, AG2-3
  - Ensure they're all due in GP1
  - Ensure they have the following points possible:
    AG2-1: 5, AG2-2: 10, AG2-3: 15
  - Mute AG2-2
* Create three assignments in AG3, AG3-1, AG3-2, AG3-3
  - Ensure they're all due in GP2
  - Ensure they have the following points possible:
    AG3-1: 5, AG3-2: 10, AG3-3: 15
  - Mute AG3-3
* Create three assignments in AG4, AG4-1, AG4-2, AG4-3
  - Ensure they're all due in GP2
  - Ensure they have the following points possible:
    AG4-1: 5, AG4-2: 10, AG4-3: 15
  - Mute AG4-1

* Enroll one student in this course
* Go to the Gradebook and ensure you're viewing all grading periods
* Assign the following grades to the student:
  AG1-1: 3
  AG1-2: 8
  AG1-3: 5

  AG2-1: 4
  AG2-2: 6
  AG2-3: 10

  AG3-1: 2
  AG3-2: 9
  AG3-3: 14

  AG4-1: 1
  AG4-2: 7
  AG4-3: 12

** Validating Assignment Group Scores
* Assuming your newly created course's id is course_id, run the
  following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:current_points)

* Verify that this returns [8.0, 4.0, 9.0, 12.0]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:final_points)

* Verify that this returns [8.0, 10.0, 9.0, 12.0]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:unposted_current_points)

* Verify that this returns [11.0, 14.0, 23.0, 19.0]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(assignment_group_id: nil).order(assignment_group_id: :asc).
    pluck(:unposted_final_points)

* Verify that this returns [11.0, 14.0, 23.0, 19.0]

** Validating Grading Period Scores
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:current_points)

* Verify that this returns [80.0, 83.85]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:final_points)

* Verify that this returns [45.71, 50.77]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:unposted_current_points)

* Verify that this returns [71.43, 82.15]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where.not(grading_period_id: nil).order(grading_period_id: :asc).
    pluck(:unposted_final_points)

* Verify that this returns [71.43, 82.15]

** Validating Total Scores
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:current_points)

* Verify that this returns [82.7]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:final_points)

* Verify that this returns [49.25]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:unposted_current_points)

* Verify that this returns [82.7]
* Run the following command from the Rails console:

  Score.where(enrollment: Course.find(course_id).enrollments).
    where(course_score: true).pluck(:unposted_final_points)

* Verify that this returns [49.25]

Change-Id: I6a107f09bc43d6e82eab4e3476313380f3e5d819
Reviewed-on: https://gerrit.instructure.com/137257
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-02-07 18:32:11 +00:00
Spencer Olson ac4b5714eb dropped assignments calculation respects ignore_muted
Fixes calculation of dropped assignments so that muted assignments are
never considered for dropping when computing posted score. In addition,
prevents score metadata for unposted grades from overwriting score
metadata for posted grades.

closes GRADE-763

Test Plan:
* Prerequisites: Have a course with at least one student and one
  teacher.

1. Create two assignments in a course with the same point value and
   place them in the same assignment group.
2. Set up a grading rule to drop the lowest 1 score.
3. Mute one of the assignments.
4. Have the teacher enter a score of zero for the muted assignment.
5. Have the teacher enter a positive score for the second assignment.
6. Check the teacher interaction report and verify there is
   no page error.

Change-Id: I5015ef73bb40bb0a45a21f166fa6b9ff146002da
Reviewed-on: https://gerrit.instructure.com/137538
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-01-11 19:21:06 +00:00
Shahbaz Javeed bec2cbd7ff gracefully handle missing submissions for concluded enrollments
closes GRADE-721

test plan:
* Create a course with two sections, I and II
* Enroll three students in Section I: A, B and C
* Ensure C is enrolled in both Section I and Section II
* Create a 10 point assignment in the default "Assignments" assignment
  group and ensure it is assigned to everyone in all sections
* Grade all three students

* Conclude Student C's enrollment in Section I
* Create two more 10 point assignments in the default "Assignments"
  assignment group
* Configure the "Assignments" assignment group to drop 1 lowest score
* Grade the students on the two new assignments
* Export the Gradebook and verify it works

* Conclude Student C's enrollment in Section II
* Create two more 10 point assignments in the default "Assignments"
  assignment group
* Grade the remaining two students on the two new assignments
* Export the Gradebook and verify it works

Change-Id: I4cafcd1328effdf3a57341978eb494376f680634
Reviewed-on: https://gerrit.instructure.com/135634
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-12-19 22:03:46 +00:00
Keith Garner e65a4e3ef8 modify grade calculator to only update metadata for score
This updates the grade calculator with a new switch:
only_update_course_gp_metadata. When set to true will only update
ScoreMetadata data for the current score calculations for course and
grading period scores

closes GRADE-711

test plan:
 - Have a course with a student, two assignment groups, and an
   assignment in each group
 - In the rails console:
   - examine the scores for the student for that course and note
     the updated_at for the course score and the assignment group
     scores.
   - execute: GradeCalculator.new(@student.id, @course,
     only_update_course_gp_metadata: true).compute_and_save_scores
   - examine the scores for the student for that course and note that
     the updated_at for the course score is unchanged and the
     assignment group scores have been updated
   - examine the course score's associated ScoreMetadata, note
     that updated_at for ScoreMetadata has changed

Change-Id: I81c9302f3dfe50b87c3a87ccef8ec98b677ff6e1
Reviewed-on: https://gerrit.instructure.com/135291
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-12-15 19:26:37 +00:00
Keith Garner 1f72ff68b4 allow missing grading period scores when calculation uses weights
When calculating final scores for a course with grading period
periods, a student with no cached scores would cause the grade
calculator to error out. This patchset fixes the error condition and
changes the grading period to only consider grading period
score objects what have an active workflow state.

fixes GRADE-663

test plan:
 - Have a course in a term with weighted grading period
 - Add a student to the course
 - Confirm no entries in the scores table. If you find entries in the
   scores table, destroy them via the rails console
 - As a teacher, in the new gradebook, export the gradebook
 - Observe it completes without error

Change-Id: I1f6679ba1cc1d9e96cf535ed3d7ed68dc67a4e3c
Reviewed-on: https://gerrit.instructure.com/132854
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-11-16 21:59:35 +00:00
Spencer Olson 45d9abdb3e grade calc: create course score if one does not exist
Fixes a bug where the grade calculator does not create a course
score for an enrollment if the enrollment has an assignment group
score.

refs GRADE-634

Test Plan:
1. Create a course with at least one assignment group.
2. Enroll a student in the course.
3. Enter a rails console and delete the 'course score' for the
   enrollment:

   course = Course.find(<course_id>)
   enrollment = course.student_enrollments.where(user_id: <student_id>)
   score = enrollment.find_score(course_score: true)
   score.destroy_permanently!

4. Run the Grade Calculator for the student:

   GradeCalculator.new(<student_id>, course).compute_and_save_scores

5. Verify the course score has been created:

   enrollment.reload.find_score(course_score: true)
     # => should return a Score

Change-Id: Ifef8eb24b90e95d35ef2bb17031a53dca3268fdb
Reviewed-on: https://gerrit.instructure.com/132409
Reviewed-by: Derek Bender <djbender@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>
2017-11-14 20:55:37 +00:00
Neil Gupta e597167034 Store dropped submissions from a calculation
fixes GRADE-326

test plan:
* Create a course with a student and assignment group
* Add 2 assignments with 10 points possible to the assignment group
* Create a drop rule to drop the lowest assignment from the group
* Score the student 5 and 10 on the assignment
* In rails console:

  e = Enrollment.where(user_id: <student_id>, course_id: <course_id>)
  score = e.first.find_score
  details = score.score_metadata.calculation_details

 score.current_score should be 10, and details should look like

  {
    current: {
      dropped: [first submission id]
    }, final: {
      dropped: [first submission id]
    }
  }

Change-Id: Iba4173ce52f52f6acd474860d190d1d4c4d3c253
Reviewed-on: https://gerrit.instructure.com/129213
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-10-30 22:57:49 +00:00
Keith Garner 1cc7a380ea unguard assignment group total storage
This removes the environmental variable guard that was blocking the
grade calculator from storing assignment group totals in the scores
table.

closes GRADE-198

test plan:
 - Have a course with:
   o some students
   o weighted assignment groups
   o weighted grading periods
   o ungraded assignments
   o quizzes
   o late and missing policies
 - As a teacher grade a bunch of the above
 - Using the rails console, verify that assignment group grades
   recorded in the scores table match those calculated by the front
   end

Change-Id: I05f8dd0e115e7ed83d3dbfe07513679bac2b88bb
Reviewed-on: https://gerrit.instructure.com/129705
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-10-19 20:38:08 +00:00
Neil Gupta 5e5cfcd67a store teacher view of current score in scores table
fixes GRADE-9

Test plan:
* Create a course with a student and 2 assignments
* Mute one of the assignments
* Grade both assignments
* Verify that student sees the unmuted current score
* Verify that teacher sees current score that includes both assignments
* In rails console:
  e = Enrollment.where(user_id: <student id>, course_id: <course id>)
  score = e.find_score(course_score: true)

score.current_score should match the student view score
score.unposted_current_score should match the teacher view score

Change-Id: I995ec26fdef8b10e3e981d7b467edcb989230943
Reviewed-on: https://gerrit.instructure.com/127467
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-10-03 22:04:09 +00:00
Matt Taylor 42be7c1a8a store scores for each assignment group
closes GRADE-19

Test Plan:
1. Using the master branch prior to this commit:
   a. Seed a course with all of the following:
      - weighted assignment groups
      - weighted grading periods
      - ungraded assignments
      - quizzes
      - late and missing policies
   b. Record all data displayed in the gradebook
2. Using the code in this commit:
   a. Verify GRADEBOOK_COURSE_SCORE_POPULATED is
      not set in your environment
   b. Run database migrations
   c. Repeat steps in (1a)
   d. Verify that results are identical to (1b)
3. Using the code in this commit:
   a. Set GRADEBOOK_COURSE_SCORE_POPULATED="true"
      in your environment
   b. Repeat steps in (1a)
   c. Verify that results are identical to (1b)
   d. (Dev-QA only)
      Verify that assignment group grades recorded in the
      scores table match those calculated by the front end
4. (Dev-QA only)
   run scores_spec and grade_calculator_spec tests
   with GRADEBOOK_COURSE_SCORE_POPULATED="true"
5. (Dev-QA only)
   After running grade calculations with the new migrations
   in place, revert those migrations and verify that all
   scores created for assignment groups are deleted

Change-Id: Ie5e06eb5ad7c0d3958a686e7f0b054e6585be37d
Reviewed-on: https://gerrit.instructure.com/123085
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-09-22 14:46:27 +00:00
Spencer Olson 3076d90401 fix grade calculator bug with weighted grading periods
When calculating grades for weighted grading periods, the grade
calculator would throw an error if it was passed users that were
A) not enrolled in the course, or B) had deleted enrollments in the
course.

closes GRADE-249

Test Plan:
1. Verify grade calculation for weighted grading periods gracefully
   handles users with deleted enrollments and users enrolled in other
   courses.

Change-Id: I584276fbdd7cf7637dd04adceab43d4077a4926c
Reviewed-on: https://gerrit.instructure.com/124869
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Gentry Beckmann <gbeckmann@instructure.com>
2017-09-04 19:20:23 +00:00
Rob Orton 50322fba59 don’t die when course is deleted on section import
fixes CNVS-38794

test plan
 - specs should pass

Change-Id: Iff6b6933d5d2fc7d2372a5032822ed32b04b5c51
Reviewed-on: https://gerrit.instructure.com/123636
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2017-08-23 01:46:56 +00:00
James Williams 4ba94cb171 rails 5.1: lib specs
Change-Id: Ieef3d3447cfa2b22c9c9f6662688a40ae48a726c
Reviewed-on: https://gerrit.instructure.com/119730
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-07-20 17:26:51 +00:00
Keith Garner 0da767365a optimize and cache queries in grade summary presenter
This patchset combined two queries for course side stats into one to
be slightly kinder to the database for large classes and caches the
results in redis. The cache is invalided when the backend grade
calculator is run.

This also changes a call to EffectiveDueDates in grade summary to
switch from getting dates for everyone when we only care about one
student to doing a more targeted lookup using the newer more accurate
cached due dates off Submission.

fixes CNVS-38025

test plan:
 - Create a course with a number of students and assignments.
 - Grade the students.
 - Visit the grade summary page for one student.
 - Observe that the assignment stats are correct.

Change-Id: I57c0f2912abc33a4af6c73fd4da4bfcf021bcf64
Reviewed-on: https://gerrit.instructure.com/118179
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-07-11 17:54:10 +00:00
Neil Gupta 7b4a5a048a Limit EffectiveDueDates query to subset of users
Fixes CNVS-37088

Test plan:
* Create a course
* Enroll 2 students
* Create an assignment with a due date
* Grade student 1
* From rails console, run grade calculator for a single student
  GradeCalculator.new(user1_id, course)
* From console, run effective due dates for a single student
  EffectiveDueDates.for_course(course, assignment).filter_students_to(user1_id).to_hash

It should return a hash with only user 1's due date

Change-Id: Ibd509153558b2674775566b1f8ccd444a4aed1ce
Reviewed-on: https://gerrit.instructure.com/112839
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Matt Taylor <mtaylor@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-05-26 16:40:26 +00:00
James Williams 5af1879615 remove request cache in grade calculator
probably isn't necessary anymore because of
effective_due_dates query rewrite

Change-Id: I5f6c54ed1913b34c674dd530f3bc38c3d1b726b2
Reviewed-on: https://gerrit.instructure.com/110330
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-05-01 17:16:55 +00:00
Landon Wilkins e08cd0c241 da licença part 30
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I13ce64f5dea44b41fe32c7c4b2ee1e31c0878c85
Reviewed-on: https://gerrit.instructure.com/110055
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:59:55 +00:00
Spencer Olson b5759303b5 use effective_due_dates in grade calculator
closes CNVS-36422

Change-Id: I57c120abfb309d510195926c8cf0f859798e9303
Reviewed-on: https://gerrit.instructure.com/109030
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-04-20 17:54:01 +00:00
Neil Gupta 1046a6ce2d Better cross-shard support for Grade Calculator
You can now safely run grade calculator from the user's shard in a
cross-shard enrollment.

Fixes CNVS-36097

Test plan:
* Create a course on one shard
* Create a grading period for that course
* Create a user in another shard
* Enroll that user in the first course as a student
* Create an assignment in the grading period
* Grade the student
* Delete the grading period
* GradeCalculator should recalculate scores
* Make sure the user's enrollment only has 1 active Score, and the
  one for the grading period is soft-deleted

Change-Id: Ia779ff8c873c45b2664da79458d1f93225383717
Reviewed-on: https://gerrit.instructure.com/107425
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-04-11 14:39:32 +00:00
James Williams ce960eb709 performance improvments for grade calculator with overrides
try to use the RequestCache to cache overrides

should help the most when calculating with several
grading periods

test plan:
* make sure i didn't break the grade calculator
* also hopefully it goes faster

Change-Id: I5426f767c6c70b7ce48344a7a97d447b6fbef5df
Reviewed-on: https://gerrit.instructure.com/106454
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-04-03 12:42:06 +00:00
Neil Gupta 9cd12065e3 Recalculate old grading period score when assignment moves
Fixes CNVS-35341

Test plan:
A. select or create
  1. an account with grading periods enabled
  2. an enrollment term for the course
  3. a grading period set for the enrollment term
     with grading period weighting disabled
     with two grading periods ('GP1' and 'GP2')
  4. a course with assignment group weighting enabled
  5. a teacher for the course
  6. a student enrolled in the course
  7. an assignment group 'AG1'
     a. with a weight of 60
     b. with an assignment 'A1'
       i. due in GP1
       ii. worth 10 points
     c. with an assignment 'A2'
       i. due in GP1
       ii. worth 10 points
  8. an assignment group 'AG2'
     a. with a weight of 20
     b. with an assignment 'A3'
       i. due in GP2
       ii. worth 20 points
  9. an assignment group 'AG3'
     a. with a weight of 20
     b. with an assignment 'A4'
       i. due in GP2
       ii. worth 40 points

B. set scores
  1. score A1 with 5 points
  2. score A2 with 10 points
  3. score A3 with 12 points
  4. score A4 with 16 points
     a. assignment group weighting should be enabled
     b. enable grading period weighting
     c. set 'GP1' weight to 30%
     d. set 'GP2' weight to 70%
     e. set 'A2' due date before 'GP1'
     f. confirm total grade of 50 %

Masquerade as the student and view the global grades page (/grades).
You should see 50% for the total grade on all grading periods.

Change-Id: Ic6ac67abd83e2cd6aa413472493fb1bfa3b041fc
Reviewed-on: https://gerrit.instructure.com/104200
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-03-09 20:06:24 +00:00
Neil Gupta e34d0de6a6 Merge branch 'master' into dev/weighted-grading
Fixes CNVS-35198
Fixes CNVS-34498

Change-Id: I7841fa62de2747654c3f4ad13c1124aeb10f6663
2017-02-28 16:36:42 -06:00
Spencer Olson 2560fba699 fix grade calculator to handle deleted enrollments
The grade calculator was throwing an error when computing scores for
a grading period for users with deleted enrollments. It will no longer
throw an error in that scenario.

closes CNVS-34643

1. Set up a course that is using grading periods with at least two
   active students.
2. Open a rails console.
3. Find the course.

   course = Course.find(2)

4. Find an active student in the course.

   student = course.students.active.first

5. Destroy all the student's enrollments.

   student.enrollments.destroy_all

6. Get a grading period ID for a grading period being used by the
   course.

   grading_period_id = GradingPeriod.for(course).first.id

7. Run the grade calculator for the student in the grading period and
   verify no errors are thrown.

   GradeCalculator.recompute_final_score(
     student.id,
     course.id,
     grading_period_id: grading_period_id
   )

Change-Id: If576c62fed75666c259d4753e8e7e7aeb1a135c9
Reviewed-on: https://gerrit.instructure.com/100961
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-02 20:17:53 +00:00
Neil Gupta 7298b8749f Get rid of multiple_grading_periods feature flag
Fixes CNVS-27109

Test plan:
Regression test everything related to multiple grading periods.

In particular, make sure:
* there is no mention of the multiple grading periods feature flag on
  the account or course features pages
* make sure grading periods UI always shows up on the account grading
  standards page
* make sure the grading periods UI only shows on the course grading
  standards page if legacy course grading periods exist for that course
  (see below)
* grading period dropdowns only show up everywhere else if there are
  grading periods to show. Otherwise, it should behave as if MGP is
  "disabled"
* Grade calculation should work as expected with and without grading
  periods

To create legacy course grading periods, you have to use rails console:
1. Find your course:
      course = Course.find(<id>)
2. Create a grading period group:
      group = course.grading_period_groups.create!(title: "2017")
2. Create a grading period:
      group.grading_periods.create!(
        weight: 1,
        title: 'Fall',
        start_date: 5.days.ago,
        end_date: 10.days.from_now
      )

Here's the list of known places grading periods can be seen in the UI:

Instructor Assignments page
  (https://community.canvaslms.com/docs/DOC-2615)
Student Assignments page
  (https://community.canvaslms.com/docs/DOC-3123)
Gradebook (https://community.canvaslms.com/docs/DOC-2785)
Gradebook Individual View
  (https://community.canvaslms.com/docs/DOC-2788)
Course Settings grading schemes page
  (https://community.canvaslms.com/docs/DOC-4042)
Student Grades page (https://community.canvaslms.com/docs/DOC-1291)
Dashboard global Grades page
  (https://community.canvaslms.com/docs/DOC-5464)

Change-Id: Iefac4b08120bd1699d4ed98bcb418089eec9b3b8
Reviewed-on: https://gerrit.instructure.com/99744
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-25 20:35:18 +00:00
Spencer Olson 74d948ff3b back-end grade calculator supports grading period weighting
closes CNVS-34105

test plan:

- Setup -
1. At the account-level, create a new grading period set that uses
   weighted grading periods. Attach the default enrollment term to this
   set.
2. Create a grading period (GP1) that runs from January 1, 2017 to June
   30, 2017. Give it a weight of 75%.
3. Create a grading period (GP2) that runs from July 1, 2017 to
   December 31, 2017. Give it a weight of 25%.
4. Create a course that belongs to the default enrollment term from
   step 1. Enroll one student in the course. Make sure that student is
   enrolled in at least one other course.
5. In the course settings, enable Multiple Grading Periods and enable
   Display ‘All Grading Period’ Totals.
6. In the course, create an assignment (Assignment in GP1) that is
   worth 10 points and due for everyone on March 15, 2017.
7. In the course, create an assignment (Assignment in GP2) that is
   worth 10 points and due for everyone on September 15, 2017.
8. Go to the gradebook and give the student 5/10 on Assignment in GP1
   and 10/10 on Assignment in GP2. Ignore the totals that show up in
   the gradebook.

- Grade Verification -
1.  Sign in as the student and go to the /grades page.
2.  Verify the grade for GP1 is 50%.
3.  Verify the grade for GP2 is 100%.
4.  Verify the grade for ‘All Grading Periods’ is 62.5%.
5.  Sign in as the account admin. Change the weight for GP1 to 20% and
    change the weight for GP2 to 40%.
6.  Sign in as the student and go to the /grades page.
7.  Verify the grade for GP1 is 50%.
8.  Verify the grade for GP2 is 100%.
9.  Verify the grade for ‘All Grading Periods’ is 83.33%.
10. Sign in as the account admin. Change the weight for GP1 to 100% and
    change the weight for GP2 to 100%.
11. Sign in as the student and go to the /grades page.
12. Verify the grade for GP1 is 50%.
13. Verify the grade for GP2 is 100%.
14. Verify the grade for ‘All Grading Periods’ is 150%.
15. Sign in as the account admin. Change the weight for GP1 to 100% and
    change the weight for GP2 to 0%.
16. Sign in as the student and go to the /grades page.
17. Verify the grade for GP1 is 50%.
18. Verify the grade for GP2 is 100%.
19. Verify the grade for ‘All Grading Periods’ is 50%.
20. Sign in as the account admin. Change the weight for GP1 to 0% and
    change the weight for GP2 to 0%.
21. Sign in as the student and go to the /grades page.
22. Verify the grade for GP1 is 50%.
23. Verify the grade for GP2 is 100%.
24. Verify the grade for ‘All Grading Periods’ is 0%.
25. Sign in as the account admin. Uncheck the box on the grading period
    set for ‘weighting’.
26. Sign in as the student and go to the /grades page.
27. Verify the grade for GP1 is 50%.
28. Verify the grade for GP2 is 100%.
29. Verify the grade for ‘All Grading Periods’ is 75%.

Change-Id: Iac23e92986f371b13de2d5e0524d6bed8a277bc4
Reviewed-on: https://gerrit.instructure.com/99040
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-12 23:04:14 +00:00
Neil Gupta 7abf23f8da Restore deleted scores instead of trying to make duplicate ones
Fixes CNVS-34276

Test plan:
* As a teacher, create an assignment
* As a student, create a submission
* As a teacher, grade the student
* Delete the student from the course
* In rails console, find the student's enrollment and set its
  workflow_state back to 'active'
* As the student, submit for the assignment again if needed
* As a teacher, grade the student again
* You should be able to see the new score (this crashed before)

Change-Id: I0eb62a4be1df7e568b9f761232d4c42ff835e534
Reviewed-on: https://gerrit.instructure.com/99288
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-11 20:24:22 +00:00
Neil Gupta 993ff42ae3 Handle NaN in GradeCalculator
Fixes CNVS-32980

Test plan: smoke test grade calculator
* As a teacher, create an assignment
* As a student, submit something for that assignment
* As a teacher, grade the submission
* Make sure the grade saved properly and is viewable by teacher
  and student.

Change-Id: Ie789492c3966be660bb726079dc2191cc1cbf8fe
Reviewed-on: https://gerrit.instructure.com/99065
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-01-09 20:05:26 +00:00
Spencer Olson 37fa769aef update grading period scores when student is graded
When a student is graded, the score for their grading period will now
be updated in addition to their total course score. Previously, when a
student was graded, their grading period score was not updated.

closes CNVS-26709

test plan:
1) In a course with multiple grading periods enabled and grading
   periods set up, grade students for assignments that fall in grading
   periods and make sure the scores get updated for the grading period
   and for the course total.

   * To make sure the scores get updated for the grading period, open a
     rails console and find the grading period scores (we'll assume the
     student's enrollment ID is 5, and the ID of the grading period
     that the assignment falls in is 8).

       $ Enrollment.find(5).scores.where(grading_period_id: 8)

     Then, give a different grade to the student for the assignment
     that falls in the grading period and run the command above again.
     You should see that the current_score and final_score have
     changed.

    * To make sure the scores get updated for the course total, open a
      rails console and find the course total scores (we'll assume the
      student's enrollment ID is 5).

        $ Enrollment.find(5).scores.where(grading_period_id: nil)

      Then, give a different grade to the student for the assignment
      that falls in the grading period and run the command above again.
      You should see that the current_score and final_score have
      changed.

Edge case: make sure that grading period scores continue to get updated
even if MGP is turned off. To verify this, turn off MGP in a course
that originally had MGP turned on. Then, grade students in assignments
that fell in a grading period when MGP was enabled. After grading, the
grading period scores should be updated.

Change-Id: I29e4e22a0b73d1062a93c6ad420d876c2f5d040a
Reviewed-on: https://gerrit.instructure.com/98603
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-06 16:35:23 +00:00
Neil Gupta 8edf09d694 add scores table
add scores table, which will hold the
computed_current_score and computed_final_score
which is currently stored on the enrollment
object. in addition, grading period scores will
be stored on the scores table.

closes CNVS-33573

Test plan:
* Create a course
* Make sure should total for all grading periods is enabled
* As a teacher, create an assignment that falls in a grading period
* As a student, submit something for that assignment
* As a teacher, grade that submission
* As a student, view your grades
* You should see the student's grade for both the grading period and
  all grading periods.
* Repeat this process for another assignment and make sure the total
  grades get updated for the student.

Basically, we want to smoke test test saving scores for an assignment
and re-calculating course grades with new scores. Everything should
behave the same as before.

Change-Id: Ib7241d55c0fa52e01441671f17f65675f8e10564
Reviewed-on: https://gerrit.instructure.com/96825
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-12-28 20:11:54 +00:00
Spencer Olson da237aacfb Fix grade display with cross shard grading periods
the global grades page will now use global grading
period IDs to support selecting grading periods
accross shards.

fixes CNVS-31407
fixes CNVS-31523

test plan:
* you will need an account in a trust relationship
  with a cross-shard account

1. enroll a user in a course in the main account.
2. enroll same user in a course in the
   cross-sharded account.
3. enable "Multiple Grading Periods" in the
   cross-sharded course.
4. create an assignment in each course as a teacher
5. create a submission for each assignment as the student
6. grade the submission from the cross-shard course
7. return to the main account and masquerade as the
   user.
8. visit the user's dashboard and click
   "View Grades". select a grading period from the
   dropdown on the cross-shard course.
9. verify no error message is shown and the total
   grade updates.
10. go to the non-global grades page for the
    cross-shard course (/courses/:course_id/grades).
11. select a grading period from the dropdown and
    verify the grade updates with no error.
12. go to the cross-shard account and masquerade as the
    user.
13. visit the user's dashboard and click
    "View Grades". select a grading period from the
    dropdown on cross-shard course.
14. verify no error message is shown and the total
    grade updates.

Change-Id: I3324c09f33ad976e76cf613a8163e3b7670a5cda
Reviewed-on: https://gerrit.instructure.com/89467
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-09-30 18:37:00 +00:00
James Williams bac67949c8 avoid re-touching course in enrollment grade calculator
should help with many concurrent recalculation jobs for a
single course

closes #CNVS-32173

Change-Id: I0bb7e6e07dac06793fd0b00e46c85bb9583086e2
Reviewed-on: https://gerrit.instructure.com/91531
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-09-29 12:43:51 +00:00
Amber Taniuchi dc34731e20 add not counted towards final grade flag to assignments
Teachers have requested for the ability to choose
which assignments count towards the final grade. I have
added a checkbox in the Assignment edit page that
can be checked that says, "This assignment does not count
toward the final grade." A new column has also been added
to the Assignments table to track this state called
"omit_from_final_grade," logic to omit such assignments
in the grade calculators, as well as notification in
assignment show, details, student grades pages, gradebook
and SRGB that notify an assignment is not included in
final grade. New state also added in assignment json.

fixes CNVS-28528

Test Plan:
As a Teacher:
1. Create or edit an assignment.
Verify there is a checkbox to not include the assignment
towards the final grade right below the grading type dropdown.
(This checkbox will not show up for not_graded grading type)
2. Save the assignment.
Verify there is a warning that the assignment is not
counted towards final grade.

As a Student:
1. Go to the assignment created above as a teacher
Verify the assignment show page (courses/x/assignments/y)
warns about the assignment not counting towards final grade.
2. Submit to the assignment.
3. Go to the assignment details page
Verify there is a warning that the assignment is not
counted towards final grade.

As a Teacher:
1. Go to gradebook2
Verify there is a warning that the assignment is not
counted towards final grade.
2. Grade the assignment
Verify in the Total Grade column that grade for the
assignment is not included in the final grade.
3. Download CSV
Verify assignment is not included in final grade.
4. Verify all the above for SRGB

As a Student:
1. Go to the Student Grades Page
Verify a flag that assignment is not counted towards
final grade.
Verify the total grade shown does not include
grade given for the assignment.

Change-Id: I61e2d8ca02201c6e5ff4fc063432b190b6f3d60f
Reviewed-on: https://gerrit.instructure.com/77201
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-07-14 23:31:40 +00:00
Cameron Matheson 282c86642c grade calculator: ignore pending_review submissions
fixes CNVS-26685

Test plan:
  * make and take a quiz with multiple choice and essay questions
  * the student's quiz grade should not be included in their current
    score on the grades-overview page (or in the api)
  * the partial quiz grade *will* affect their "final" score.

Change-Id: I70252375aac87c73e25b9e3dd7f3af4555826a97
Reviewed-on: https://gerrit.instructure.com/75754
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2016-04-05 17:25:54 +00:00
Strand McCutchen ebf8b4174f GradeCalculator#compute_scores returns an array of hashes
refs CNVS-26685

While investigating CNVS-26685, I discovered that
GradeCalculator#compute_scores returns an array of arrays
with arrays in them with values. This nested structure hid
the implicit meaning of the data, which maps to the current,
final, current group, and final group for the computed scores.

This more human-readable data structure improves the ability of
developers to reason about the returned values.

Test plan:

 - Run regression tests on the user, course, and enrollment APIs.

Change-Id: I58c8572f94863e47be5d67e6d50fe795d42f1856
Reviewed-on: https://gerrit.instructure.com/74093
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-03-16 21:25:54 +00:00
James Williams 0777cba946 remove differentiated assignments feature checks
test plan:
* basic regression test of assignment overrides

closes #CNVS-27549

Change-Id: Ie463848b3831087efb3f9ec762dca6264055ee76
Reviewed-on: https://gerrit.instructure.com/73139
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-07 18:44:46 +00:00
Cameron Matheson d990265772 add graded_at column to enrollments table
Test info:
  This commit adds a graded_at column that should be updated whenever
  the grades for an enrollment change

Change-Id: If1fa48cb9f15a8a5b8c651b1124db111d355d6c1
Reviewed-on: https://gerrit.instructure.com/49513
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2016-01-04 23:08:47 +00:00
Spencer Olson 802299b2cf feature flag for 'All Grading Periods' totals
Add grading period dropdowns on the 'grades' page,
and add a "Display Totals for 'All Grading Periods'"
feature flag. By default, the feature will be turned
'off'.

When the feature is 'off':
 - Totals will not display in the gradebook
   or the 'student grades' page when the 'All
   Grading Periods' option is selected.
 - The grading period dropdowns on the 'grades'
   page will not have an 'All Grading Periods'
   option.

When the feature is 'on':
 - Totals will display in the gradebook and the
   'student grades' page when the 'All Grading
   Periods' option is selected.
 - The grading period dropdowns on the 'grades'
   page will have an 'All Grading Periods' option.

closes CNVS-23995

test plan:

1) as a teacher, enable the 'multiple grading
   periods' feature (do not enable the 'display
   totals for all grading periods' feature yet).
   a) verify the gradebook does not show totals
    when the 'All Grading Periods' option is
    selected.
   b) verify the 'student grades page'
    (courses/4/grades/9#tab-assignments) does
    not show totals, and the calculation of
    'what-if' grades is disabled when the
    'All Grading Periods' option is selected.
   c) turn on the 'display totals for all
      grading periods' feature. repeat steps
      a & b and verify that the totals now
      show up (and you can calculate what-if
      grades on the student grades page when
      'All Grading Periods is selected')

2) sign in as a student that is enrolled in
   3 courses: 1 course with MGP disabled, 1
   course with MGP enabled and 'display all
   grading periods totals' (DAGPT) disabled,
   and 1 course with MGP enabled and DAGPT
   enabled. go the the 'grades' page (/grades).
   a) verify there is a grading period dropdown
      next to the totals for courses that have
      MGP enabled. verify there is not a grading
      period dropdown next to the total for the
      course with MGP disabled.
   b) verify that the current grading period is
      selected by default, if one exists. if a
      current grading period does not exist, then:
      - the dropdown next to the total for the
         course with DAGPT disabled should show
         'Select a grading period' and the total
         grade should show as '--'.
      - the dropdown next to the total for the
        course with DAGPT enabled should show
        'All Grading Periods' and the total grade
        should be displayed.
   c) verify clicking a grading period in the
      dropdown changes the total, and shows
      the correct total for that grading period.

3) repeat steps 2a-c, but sign in as an observer that
   is observing at least 3 students in 3 different
   courses(1 course with MGP disabled, 1 with MGP
   enabled and DAGPT disabled, and 1 course with
   MGP enabled + DAGPT enabled).

4) verify that the grading period dropdowns that were
   added are accessible.

Note: The 'grades' page (/grades) will _always_
display the total for 'All Grading Periods' when
signed in as a teacher. We are aware of this
existing bug and we're working on a solution.

Change-Id: If501b47aa57121d17d4e6629d1dcdbc8676971a2
Reviewed-on: https://gerrit.instructure.com/65847
Tested-by: Jenkins
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
Reviewed-by: Dylan Ross <dross@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2015-10-28 21:03:45 +00:00
James Williams 600165e7b2 rails4: deprecate Relation#all in favor of Relation#to_a
refs #CNVS-21596

Change-Id: I5dedaab90a2abe6bf288ff30401c9b31629b45b2
Reviewed-on: https://gerrit.instructure.com/59220
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-24 21:28:14 +00:00
Cameron Matheson da7512cbdc excused assignments backend
closes CNVS-17549
closes CNVS-17553

Test plan:
  * excuse and unexcuse assignments from the api
  * student grades should be correct

Change-Id: Id8e0fa9edb404bdf65bff0bfc4c79c6f33e8a7e4
Reviewed-on: https://gerrit.instructure.com/53409
Tested-by: Jenkins
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Adrian Foong <afoong@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2015-05-18 20:36:51 +00:00
Dylan Ross a878368b92 round total grade in gradebook to 2 decimal places
The total grade column is now rounded to two
decimal places in the gradebook and the
exported csv of the gradebook

fixes CNVS-14989

- the gradebook and exported csv column should
  round the total grade to two decimal places

- if a student has a total grade of 99.567,
  before it would be displayed as '99.6%'.
  Now it will be displayed as '99.57%'

Change-Id: Ifcb45226c7c6c9ae6874b8895707c060998c7b3c
Reviewed-on: https://gerrit.instructure.com/49623
QA-Review: Robert Lamb <rlamb@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Product-Review: Dylan Ross <dross@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
Tested-by: Josh Simpson <jsimpson@instructure.com>
2015-05-11 19:54:06 +00:00
Cameron Matheson b51cc5d09f add logging around grade recomputation
Change-Id: I8fda274034d0815a4ed0f90a79946beed13b1f9f
Reviewed-on: https://gerrit.instructure.com/48780
Tested-by: Jenkins
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2015-02-19 22:12:49 +00:00
Cameron Matheson 5cda45c40f add grade period support to grade calculator
closes CNVS-17105

Test plan:
  (This has to be done at the rails console)

  * enable multiple grading periods
  * set up assignments in all the grading periods
  * grade the assignments for a student
  * run the grade calculator for a grade period.  make sure the grade
    only considers assignments in the grading period:

    gc = GradeCalculator.new([student_id], course, grading_period)
    pp gc.compute_scores.first.first

Change-Id: I3b87eb7ec08fedebaab4f7a2fc83e68d4d4d5c7e
Reviewed-on: https://gerrit.instructure.com/45753
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-12-29 20:01:45 +00:00
Cameron Matheson e3a8ea8445 remove Assignment.assignment_scope_for_draft_state
closes CNVS-17254

Test plan:
  * the gradebook should not show unpublished assignments
  * grades from the enrollment csv should be correct (they should not
    consider unpublished assignments)

Change-Id: I5a5405ff33146beeeba5453eff388d2bf806b427
Reviewed-on: https://gerrit.instructure.com/45250
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-12-05 17:44:51 +00:00
Michael Nomitch 386a8d15e8 DA - split large hashes
fixes CNVS-16452

test plan:
  - regression test of the following
    - GB csv download/upload
    - assignments index
    - assignments api index
    - submissions api call to for_students
      - as teacher/observer/student
    - score calculation in GB
    - score calculation on individual grades page

Change-Id: Ifaa0c7580535c2c5d4e218508ef00c1b6007770b
Reviewed-on: https://gerrit.instructure.com/43361
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-11-03 19:35:09 +00:00
Michael Nomitch 65a28679c5 DA - grading rework for performance
fixes CNVS-14865

test plan:
  - with a large class
  - with DA on and off
    - check that the gradebook csv download works
      (grades can be wrong when DA is on)
    - check that gradebook2 & srgb work
    - check that student grade summary pages work

Change-Id: I7a7b4ffe302d912aa2877106295a78ab662868f1
Reviewed-on: https://gerrit.instructure.com/39470
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-08-26 22:46:14 +00:00
Simon Williams e241218d48 revert DA grading to fix grade calc performance regression
this reverts part of b4840c75cc

fixes CNVS-14840

test plan:
- with differentiated assignments off, grading should work correctly
- in a course with many assignments, you should be able to download the
  gradebook csv
- with differentiated assignments on, grading will not work correctly, this is
  intentional.

Change-Id: Id910ff28763ba13c529a21d4c125a164e094aeac
Reviewed-on: https://gerrit.instructure.com/39436
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-08-17 21:25:20 +00:00
Michael Nomitch b4840c75cc DA - grade calculation works on backend
fixes CNVS-13715

test plan:
  - create a student who is in one group and not another
  - create an assignment only visible to each group
  - grade the student for both assignments
  - turn DA on
    - as the student and teacher, go to the student grades page
      - both of the assignments should be visible
      - final grade should be correct (factoring in both)
        * final grade = ungraded assignments count too
    - delete one of the grades and return
      - only one of the assignments should be visible
      - final grade should be correct (using just one assignment)
  - turn DA off
    - as the student and teacher, go to the student grades page
      - both assignments are visible
      - final grade should factor in both assignments
  - with DA on and off, ensure that the following work:
    - drop rules
    - never drop rules
    - assignment stats (mean median etc)
    - what if scores

Change-Id: I727aff943b14c91089ccffa6d3b63ba026abbeec
Reviewed-on: https://gerrit.instructure.com/36762
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-07-17 21:27:59 +00:00
Michael Nomitch 9c8c42b952 DA - assignment indices
fixes CNVS-13708

test plan:
  - create a student who is in one section and not another
  - create an assignment only visible to each section
    (1 section => 1 assignment)
  - grade the student for both assignments
  - turn DA on
    - as the student, go to the assignment index page
      - both assignments should be visible initially
      - delete the grades for both assignments and return
        - only the overridden assignment should be visible
      - only one of the assignments should be visible
    - as the student, go to the grades page
      - only the overridden assignment should be visible
      - regrade the assignment whose grade you had deleted
        - both assignments should be visible now
      - (fyi: final grade wont be correct)
  - turn DA off
    - as the student, go to the assignment index page
      - both assignments are visible
    - as the student, go to the grades page
      - both assignments are visible
      - final grade should factor in both assignments

Change-Id: I32e3fea4d6fd3db9a512e0d170779b48418f90cf
Reviewed-on: https://gerrit.instructure.com/36728
Reviewed-by: Liz Abinante <labinante@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-07-17 18:23:25 +00:00