Commit Graph

21 Commits

Author SHA1 Message Date
Cody Cutrer 1832881748 RuboCop: Performance/RegexpMatch
[skip-stages=Flakey]

auto-corrected

Change-Id: Icf79dc86947cde22d0853b3db8afa3db853e7b8a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278013
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>
2021-11-11 22:02:06 +00:00
Cody Cutrer c65d57737a RuboCop: Layout lib
Change-Id: I0655d9a9d750f2debd6378b03d8ddc1403ebc31b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274158
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>
2021-09-22 20:01:52 +00:00
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
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-27 20:49:50 +00:00
James Williams ec00892c7e move unbounded user preference data to separate table
such as gradebook column settings stored for every
course, etc

test plan:
* all user preferences should behave as before, such as
 gradebook column sizes, course nicknames,
 dashboard card color settings, etc

closes #LA-571

Change-Id: I6896e0d97d577c554d450f377137cb4d6e78e2ef
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/226119
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-03-02 20:10:32 +00:00
Spencer Olson 406120ceb6 fall back to sorting by user name if invalid sort type
closes TALLY-475
flag=none

Fall back to sorting by student name if the saved "sort by" is not
a valid student sort option (such as "grade").

Test Plan:
1. Go to the New Gradebook as a teacher and sort by any criteria in
   the "Student Name" column (such as "Name").
2. In a rails console, change the sort_rows_by_setting_key for your
   teacher to "grade".

   course = Course.find(<course id>)
   user = User.find(<user id>)
   user.preferences[:gradebook_settings][course.id]["sort_rows_by_setting_key"] = "grade"
   user.save!

3. Go to the New Gradebook and verify it loads. Verify you can sort by
   different columns/criteria without issue.

Change-Id: I2ff99641ddf81fe6927da3f56571a4857c50eb35
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/223930
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2020-01-21 16:20:07 +00:00
Adrian Packel 87bbc0ba5b Add more gradebook sort options
flag=new_gradebook_sort_options
closes TALLY-210

Test plan:
- Have a course using new gradebook
  - Have several students with pseudonyms (i.e., logins; see below)
  - Have at least one pseudonym-less student
  - Have a mechanism to filter students (section or student group)
- Enable the feature:
  - Open the Settings page for your root account and allow the
    "Additional Sort Options for New Gradebook" feature
  - Open the Settings page for your course and enable the above setting
    for the course
- Open new Gradebook
- In the student column header menu, the "Sort by" item should now show
  several sort fields and (separately) a sort order
- Check that the sort fields work as expected:
  - (Note that you will need to use the "Secondary info" menu item to
    show the relevant info field under users' names; selecting a sort
    option will not automatically change the secondary info to match)
  - "Name" should sort by the user's (sortable) name
  - "SIS ID" should sort by the SIS user ID on the user's account
  - "Integration ID" should sort by the account's integration ID
  - "Login ID" should sort by the user's login name
  - "A-Z" and "Z-A" should switch between ascending and descending
    sort order for the selected sort field
  - In all cases, students with no value for the selected field (e.g., a
    student with no login ID) should appear at the bottom of the list,
    regardless of the selected sort order
- Check that filtering by section or group still works as expected
  - Selecting a specific filter, as well as removing the filter, should
    respect the sort field and order

- Turn OFF the feature flag for the course
- Go back to New Gradebook
  - Check that the sort menu has returned to its previous state, with
    only "A-Z" and "Z-A" options that sort by name
  - (If you were sorting by a different criterion when you had the flag
    enabled, said criterion will initially still be in effect, but
    adjusting the sort order will bounce it back to sorting by name)

APPENDIX: adding pseudonyms

To create a pseudonym for a student in a Rails console:
> user = <a student>
> user.pseudonyms.create!(
    account: user.account,
    sis_user_id: "some_sis_id_or_other",
    integration_id: "some_integration_id_or_other",
    unique_id: "a_login_id"
  )

Or you could do it the boring way by just adding a login from their user
details page, but I'm not sure how to update the SIS ID and integration
ID from there.

Change-Id: I290bced84432a4776a9c20efbaeb26aeb7e18638
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/200805
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2019-12-09 16:40:02 +00:00
Adrian Packel efb1deb064 Exclude deleted groups from filter
Do not show deleted groups/group categories in the student group filter.
If a filter is selected and then subsequently deleted, behave as though
no filter is applied until such time as a valid group is selected.

fixes GRADE-2275

Test plan:
- Have a course with New Gradebook and some group sets/groups
  - Enable the "Launch SpeedGrader filtered by student group" setting
- Open New Gradebook and filter by a group
- Go to the course's People page and delete the specific group you're
  filtering by
- Return to New Gradebook
  - The group filter should be cleared and all students should be shown
  - The submission details tray should disable the SpeedGrader link
    because no group is selected (except for group assignments)
- WITHOUT selecting a new group:
  - Open the view page for an assignment:
    - The SpeedGrader link/group select on the right-hand side should
      not have a group pre-selected, and the list of eligible groups
      should not include the deleted group
  - Open SpeedGrader directly for an assignment:
    - /courses/<course_id>/gradebook/speed_grader?assignment_id=<id>
    - All students should be shown (we should not attempt to filter by
      the selected-but-deleted group)
- Select a new group for real and make sure things work as before:
  - Check that Gradebook filters properly by the now-selected group
    - Check that the submission details tray now allows you to access
      SpeedGrader
  - Check that the view page for an assignment recognizes the selected
    group
  - Check that SpeedGrader filters by the selected group

Change-Id: Ib528e6594afc80e50d4e0127b62a161226c674bb
Reviewed-on: https://gerrit.instructure.com/205287
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-08-19 19:00:29 +00:00
Gary Mei 80177704c6 fix gradebook sort when filtering by student group
When New Gradebook is sorted by total grade, filtering by student
group now works.

fixes GRADE-2276

Test Plan
- Create at least 2 groups.
- Add some students to one group, and some students to another group.
- Navigate to the New Gradebook.
- Sort by Total Grade.
- Filter by student group.
- Verify that only students in the selected student group appear.

Change-Id: Ib690569b679956bff60d7bf801edf906fdf0a76e
Reviewed-on: https://gerrit.instructure.com/203373
Tested-by: Jenkins
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-08-06 18:44:13 +00:00
Adrian Packel c858092ceb Add student group filter to new gradebook
Add a filter for student groups to new gradebook. It can be enabled
from the View menu (as with the other filters) and behaves generally as
they do, with the small difference of showing groups/group categories
hierarchically. Also add the option to show a student's groups as their
"secondary info" below their name.

closes GRADE-2122

Test plan:
- Have a course (using New Gradebook) and some students
- Create some student groups for the course, and assign
  students to them
- Open New Gradebook
- The "View" menu should have a "Student Groups" filter in addition to
  the existing filters
  - Enabling it should make a filter appear that lets you choose between
    the student groups for the course (or show all groups)
  - Selecting a particular group should show only students belonging to
    that group
  - Selecting "All Student Groups" should show all students
  - Your selection should persist between page views
- The ellipsis menu in the Student Name column should have a new "Group"
  option under "Secondary Info"
  - Selecting it should set the secondary text below a student's name to
    the groups that student is part of

Change-Id: Id6b1c62699f1778e60545ba85f945ebecfc3e98a
Reviewed-on: https://gerrit.instructure.com/194096
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Bender <djbender@instructure.com>
Product-Review: Matthew Goodwin <mattg@instructure.com>
2019-05-28 21:36:43 +00:00
Cody Cutrer 2c185786b9 rails 5.2: Arel.sql
Change-Id: I6cf138e9ccc67a1a5ef6dbfb3061cda0fc93eedb
Reviewed-on: https://gerrit.instructure.com/159902
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-08-08 16:34:08 +00:00
Gary Mei d39a795518 fix empty rows in new gradebook for soft conclude
Soft concluded courses with hard concluded students were returning
ids for those hard concluded students while the frontend was only
expecting ids for non-hard concluded students. This was causing extra
rows to be present in the gradebook, which cascaded into grades not
showing up. This changes gradebook_user_ids to be in line with what
Gradebook.coffee is expecting.

fixes GRADE-1096

Test Plan
 - Create a course.
 - Turn on New Gradebook for the course.
 - Enroll at least two students.
 - Create an assignment.
 - Grade both students.
 - Conclude one student's enrollment.
 - Go to the course settings and change the course dates to start and
   end before the current day.
 - Under the course dates, check the box for
   "Users can only participate in the course between these dates"
 - Go back to the Gradebook.
 - Verify that there are no empty rows and only the students that are
   not concluded are present.
 - Set the grid to show concluded enrollments.
 - Verify that the concluded enrollments now appear.

Change-Id: I21ffa7ee52c07947710ff8ec68159fcfe96b0ec8
Reviewed-on: https://gerrit.instructure.com/154679
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-06-25 20:44:16 +00:00
Cody Cutrer 900cc85f54 fix a quoting issue in Rails 5.1
Change-Id: I647342d303513ecb0aba93074436cc7036113ccc
Reviewed-on: https://gerrit.instructure.com/141447
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-02-21 16:01:46 +00:00
Adrian Packel 29d09dd441 limit user ids to students visible to user
If a user is only allowed to view students in their own section,
omit student IDs for other sections instead of returning them, so
that they don't show up later on as blank rows in Gradebook.

Fixes GRADE-713

Test plan:
- Create multiple sections in a course
- Enroll at least 2 students in different section than the teacher
- Restrict a teacher to only see students in their section
- Enable New Gradebook for the course
- As the teacher, view the Gradebook
- You should see only rows for the students in the teacher's section.
- You should not see any blank rows if other sections are selected.
- Test that a teacher signed up for multiple sections can only see those
  sections.
- Test that inactive/concluded students appear if the appropriate
  checkboxes are set.

Change-Id: Ie4cf32b13933416fd8b3b386f366a36ad778584d
Reviewed-on: https://gerrit.instructure.com/137455
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-01-15 21:25:07 +00:00
Keith Garner 36e29e4b42 add assignment group score sorting in gradebook_user_ids
Add the ability to server side sort gradebook users by assignment
group scores. Also unlocks the UI in the new gradebook to allow the
sorting.

closes GRADE-7

test plan:
 - Have a course with multiple students
 - Have an assignment in the default "assignments" assignment group
 - Have an assignment in a second assignment group
 - In the gradebook, grade the students
 - Sort the gradebook by the default assignment group, score low to
   high
 - Reload the gradebook
 - Ensure that the default assignment group sort is persisted across
   the reload
 - Sort the gradebook by the second assignment group, score high to
   low
 - Reload the gradebook
 - Ensure that the second assignment group sort is persisted across
   the reload

Change-Id: Ia3647d43d8460124e413d83d5c6013dbebd8c33e
Reviewed-on: https://gerrit.instructure.com/136981
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-01-09 20:04:17 +00:00
Keith Garner 33a768aa85 fix sort by total grade to ignore assignment group grades
With the addition of assignment group grades, just grading_period_id
being nil is not good enough, so we either need to switch on
grading_period_id or on course_score is true. This also switches to
using the unposted_total_score for sorting and unblocks the
persistance of sorting by total column.

fixes GRADE-747

test plan:
 - Have a course with two students
 - Create an assignment with 10 points possible
 - Create a second assignment group
 - Create a second assignment in the second assignment group with 100
   points possible
 - Grade the first student 1 for the first assignment and 100 for the
   second assignment
 - Grade the second student 9 for the first assignment and 95 for the
   second assignment
 - Sort the gradebook total column by high to low
 - reload the gradebook
 - note that the second student sorts first

Change-Id: I70399d693e676b1934c4ffe10d38187fba7c933c
Reviewed-on: https://gerrit.instructure.com/136749
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-01-09 19:59:26 +00:00
Keith Garner 10b63792a7 fix gradebook_user_ids to return all users in assignment ordering
This fixes the query GradebookUserIds used to lookup users when
sorting by assignment when differentiated assignment are in play. Now
all users are returned with assigned users first, then unassigned, and
then finally fake.

fixes GRADE-640

test plan:
 - Have a course with multiple students
 - Create 2 assignments. Assign the first assignment to
   everyone. Assign the second assignment to a single student.
 - Go to the New Gradebook and click on the second assignment’s header
   and sort by grade low-to-high.
 - Refresh the page
 - Note the Gradebook shows a row for all students.

Change-Id: Ie473a0648d1f48228a24fc9ec0917a4acb3471bb
Reviewed-on: https://gerrit.instructure.com/132194
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-11-10 22:16:17 +00:00
Shahbaz Javeed a58081810a add secondary sorting by sortable_name for user_ids
closes CNVS-37707

test plan:
* Create a course with at least four students, two of whom
  have the same name (we'll call them the twins)
* Create two assignments, each with a maximum score of 10
* Go to Gradezilla

* Sort the gradebook by Student Name from A-Z
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify that user_ids are returned in an order where the
  corresponding user names are in ascending alphabetical
  order
* Verify that the twins' user_ids appear next to each
  other and are in increasing order by user_id

* Sort the gradebook by Student Name from Z-A
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify that user_ids are returned in an order where the
  corresponding user names are in descending alphabetical
  order
* Verify that the twins' user_ids appear next to each
  other and are in decreasing order by user_id

* Ensure all students have submissions for the first
  assignment
* Assign grades to the students in assignment #1
  and ensure both twins get the same grade
* Sort the gradebook by the grade in assignment #1
  (Low to High)
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify that user_ids are returned in an order where the
  corresponding user grades are in ascending order of name
* Verify that the twins' user_ids appear next to each
  other and are in increasing order by user_id

* Sort the gradebook by the grade in assignment #1
  (High to Low)
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify that user_ids are returned in an order where the
  corresponding user grades are in descending order
* Verify that the twins' user_ids appear next to each
  other and are in decreasing order by user_id

* Update assignment #1 to ensure three students have
  due dates in the past, thus making their submissions late
* Sort the gradebook by "Late"
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify the first 3 user_ids are for users with late
  submissions for that assignment and are in ascending
  order of name
* Verify the last (fourth) user_id is for the student
  whose submission was on time
* Verify that the twins' user_ids appear next to each
  other and are in increasing order by user_id

* Update assignment #1 to ensure only one student
  has a due date in the past, thus making only one student
  have a late submission.
* Sort the gradebook by "Late"
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify the first 3 user_ids are for users with timely
  submissions for that assignment and are in ascending
  order of name
* Verify the last (fourth) user_id is for the student
  whose submission was on time
* Verify that the twins' user_ids appear next to each
  other and are in increasing order by user_id

* Update assignment #2 to have a due date in the past
* Ensure only one student (not one of the twins) has
  submitted their work for assignment #2
* Sort the gradebook by "Missing"
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify the first 3 user_ids are for users with missing
  submissions for that assignment and are in ascending
  order of name
* Verify the last (fourth) user_id is for the student
  who submitted their work
* Verify that the twins' user_ids appear next to each
  other and are in increasing order by user_id

* Ensure both the twins now submit their work for
  assignment #2.  This should leave just one student who
  is missing a submission for assignment #2
* Sort the gradebook by "Missing"
* As a teacher hit the user_ids API endpoint
  (GET /courses/:course_id/gradebook/user_ids)
* Verify the first user_id is for the student who still
  has not submitted their work
* Verify the last 3 user_ids are for users with missing
  submissions for that assignment and are in ascending
  order of name
* Verify that the twins' user_ids appear next to each
  other and are in increasing order by user_id

Change-Id: Id91e02fc7dc475177d1f8c09cc75015916375576
Reviewed-on: https://gerrit.instructure.com/117227
Reviewed-by: Cody Cutrer <cody@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-07-11 22:07:00 +00:00
Jeremy Neander 9883d07cac fix section filter
fixes CNVS-37775

test plan:
* visit gradebook for a course with multiple sections
* enable visibility of the section filter
* ensure all students are visible when "All Section" is selected
* ensure selecting sections filters out unrelated students

Change-Id: I5bc0afd2dd8402bb31a806089bf43389d3b3de96
Reviewed-on: https://gerrit.instructure.com/116862
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-06-23 23:05:06 +00:00
Keith Garner 8c41c78d63 new gradebook: include concluded user_ids for concluded courses
closes CNVS-37758

test plan:
 - Create a course that has some active students, grade the students,
   and conclude the course. Enable New Gradebook and go to the
   gradebook.
 - hit the user_ids endpoint and confirm that the once active students
   still show up now that they are concluded

Change-Id: Id9c3ddacf07b3a8b6b7c9d0a04f005d006747aa5
Reviewed-on: https://gerrit.instructure.com/116726
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-06-23 15:15:45 +00:00
Spencer Olson 9d798709e0 new gradebook: fake student ids always sort last
closes CNVS-37752

Test Plan:
1. Create a course that has some active students, inactive students,
   concluded students, and a fake student. Enable New Gradebook and go
   to the gradebook.
2. Click on the student header and select 'Inactive enrollments' and
   'Concluded enrollments'. Then select 'Sort by -> A-Z'.
3. As a teacher in the course, hit the user_ids endpoint and verify you
   get a list of user IDs back. The user IDs should be ordered such
   that their corresponding users' names are in alpha ascending order.
   The list of user IDs should also include inactive and concluded
   students' IDs. The fake student's ID should always be last.
4. Go to the gradebook and click on the student header. Select 'Sort by
   -> Z-A'.
5. Hit the user_ids endpoint and verify the returned user IDs are now
   ordered such that their corresponding users' names are in alpha
   descending order. The list of user IDs should also include inactive
   and concluded students' IDs. The fake student's ID should be last.
6. Go to the gradebook and click on the student column header. Deselect
   the 'Inactive enrollments' and 'Concluded enrollments' options.
7. Hit the user_ids endpoint and verify the returned user IDs no longer
   include IDs for inactive or concluded students. The IDs should still
   be ordered such that their corresponding users' names are in alpha
   descending order. The fake student's ID should be last.
8. Go to the gradebook and click on the total grade header. Select
   'Sort by Grade -> Low to High'
9. Hit the user_ids endpoint and verify the returned user IDs are
   ordered such that their corresponding users' current total grades
   are in ascending order. The fake student's ID should be last.
10. Go to the gradebook and click on the total grade header. Select
   'Sort by Grade -> High to Low'
11. Hit the user_ids endpoint and verify the returned user IDs are
    ordered such that their corresponding users' current total grades
    are in descending order. The fake student's ID should be last.
12. In the same manner as the steps above, make sure changing the
    following settings in the gradebook causes the user_ids
    endpoint to return an array of IDs ordered according to the
    gradebook sort preferences, with the fake student's ID sorted last:
    a) Assignment column header -> Sort by Grade -> Low to High
    b) Assignment column header -> Sort by Grade -> High to Low
    c) Assignment column header -> Sort by -> Missing (the user_ids
       endpoint should return all users with a missing submission for
       that assignment first)
    d) Assignment column header -> Sort by -> Late (the user_ids
       endpoint shoudl return all users with a late submission for that
       assignment first)
    e) Select a grading period and sort by total grade. The user_ids
       endpoint should return user IDs that are ordered such that their
       corresponding users' grades are in ascending or descending order
       for the selected grading period.
13. Conclude the course. Hit the user_ids endpoint as the teacher and
    verify you do not get a 401 response.
* Note: Sorting by assignment group totals is not currently supported.

Change-Id: I6c4b16b72e051d46cc7b7521949d5c82b92960b9
Reviewed-on: https://gerrit.instructure.com/116698
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-06-23 02:31:06 +00:00
Spencer Olson d831a9f7e2 add user_ids endpoint to gradebooks_controller
Add endpoint to gradebooks controller which returns user ids sorted
according to the user's gradebook sort preferences.

closes CNVS-37608

Test Plan:
1. Create a course that has some active students, inactive students,
   and concluded students. Enable New Gradebook and go to the
   gradebook.
2. Click on the student header and select 'Inactive enrollments' and
   'Concluded enrollments'. Then select 'Sort by -> A-Z'.
2. As a student in the course, hit the new endpoint to get user IDs
   (GET /courses/:course_id/gradebook/user_ids). Verify you get a 401
   unauthorized response.
3. As a teacher in the course, hit the user_ids endpoint and verify you
   get a list of user IDs back. The user IDs should be ordered such
   that their corresponding users' names are in alpha ascending order.
   The list of user IDs should also include inactive and concluded
   students' IDs.
4. Go to the gradebook and click on the student header. Select 'Sort by
   -> Z-A'.
5. Hit the user_ids endpoint and verify the returned user IDs are now
   ordered such that their corresponding users' names are in alpha
   descending order. The list of user IDs should also include inactive
   and concluded students' IDs.
6. Go to the gradebook and click on the student column header. Deselect
   the 'Inactive enrollments' and 'Concluded enrollments' options.
7. Hit the user_ids endpoint and verify the returned user IDs no longer
   include IDs for inactive or concluded students. The IDs should still
   be ordered such that their corresponding users' names are in alpha
   descending order.
8. Go to the gradebook and click on the total grade header. Select
   'Sort by Grade -> Low to High'
9. Hit the user_ids endpoint and verify the returned user IDs are
   ordered such that their corresponding users' current total grades
   are in ascending order.
10. Go to the gradebook and click on the total grade header. Select
   'Sort by Grade -> High to Low'
11. Hit the user_ids endpoint and verify the returned user IDs are
    ordered such that their corresponding users' current total grades
    are in descending order.
12. In the same manner as the steps above, make sure changing the
    following settings in the gradebook causes the user_ids
    endpoint to return an array of IDs ordered according to the
    gradebook sort preferences:
    a) Assignment column header -> Sort by Grade -> Low to High
    b) Assignment column header -> Sort by Grade -> High to Low
    c) Assignment column header -> Sort by -> Missing (the user_ids
       endpoint should return all users with a missing submission for
       that assignment first)
    d) Assignment column header -> Sort by -> Late (the user_ids
       endpoint shoudl return all users with a late submission for that
       assignment first)
    e) Select a grading period and sort by total grade. The user_ids
       endpoint should return user IDs that are ordered such that their
       corresponding users' grades are in ascending or descending order
       for the selected grading period.
* Note: Sorting by assignment group totals is not currently supported.

Change-Id: I4a36aa5b82d87f49d2396bbc16e1cc56e89eba0f
Reviewed-on: https://gerrit.instructure.com/116491
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-06-22 22:05:39 +00:00