Commit Graph

12 Commits

Author SHA1 Message Date
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