canvas-lms/lib/gradebook
Jeremy Neander 66eee60398 create endpoint for final grade overrides
closes GRADE-1876

test plan:
 Notes:
  * To test the endpoint, send use the path:

     GET /courses/:course_id/gradebook/final_grade_overrides

  * To set overrides, perform the following in the Rails console:

     enrollment = course.enrollments.find_by(user_id: <student.id>)

     # to update a course score
     score = enrollment.scores.find_by!(course_score: true)
     score.update!(override_score: 89.2) # some score value

     # to update a grading period score
     period = <some grading period>
     score = enrollment.scores.find_by!(grading_period: period)
     score.update!(override_score: 89.2) # some score value

 A. Setup
    1. Select or create a course
    2. Ensure the course has at least one assignment
    3. Enable the "Final Grade Override" feature flag
    4. Use an enrollment term with some grading periods
    5. Override a student's course score
    6. Override a student's grading period score

 B. Verify
    1. As a teacher in the course, send a request to the endpoint
    2. Verify the response is structured as follows:

       {
         final_grade_overrides: {
           <student_id>: {
             course_grade: {
               percentage: 12.34
             },
             grading_period_grades: {
               <grading_period_id>: {
                 percentage: 56.78
               },
               <grading_period_id>: {
                 percentage: 90.12
               }
             }
           },
           <student_id>: {…}
         }
       }

    3. Verify the response includes ids of only students with
       overrides
    4. Verify each student represented includes scores for only the
       specific overrides assigned
       * not all grading period ids will be included if they do not
         all have overrides
       * the course grade override will not be included if not
         assigned
    5. Verify the override percentage values are accurate

Change-Id: I0e7df11139518b94460883d3dbd4700cba9aaeda
Reviewed-on: https://gerrit.instructure.com/174017
Tested-by: Jenkins
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2018-12-07 18:26:39 +00:00
..
final_grade_overrides.rb create endpoint for final grade overrides 2018-12-07 18:26:39 +00:00