Commit Graph

7 Commits

Author SHA1 Message Date
Jon Willesen 388bc15684 A2: add user search to submissions in graphql
This adds a bunch of search options to the assignment
submissionsConnection in graphql. Not all of the potentially needed
orders and filters are implemented, but this gets the basic concept and
the simple stuff implemented.

closes ADMIN-2324

test plan:
- go to the graphiql interface and query an assignment and its
  submissionsConnection. You should see a bunch of options in the filter
  input of the submissionsConnection.
- try out all the filters and orders and see that you get the results
  that you'd expect
car
Change-Id: I541e333dc544f2258c9c2359124bac0d24277abc
Reviewed-on: https://gerrit.instructure.com/184727
Tested-by: Jenkins
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
2019-04-05 19:56:42 +00:00
Dan McCallum 2f2ca82c36 Support NRPS v2 filtering by Assignment `rlid`
- When the `rlid` query parameter refers to an `Assignment`,
  limit resulting NRPS v2 memberships as follows:
    - `Course`: All active non-student enrollments plus all
    student enrollments with an active `Submission` for the
    assignment.
    - `Group`: All active `Group` members with an active
    `Submission` for the assignment.
  - These results are further narrowed by the specified `role`
  query param, if any.
  - While refactoring `Group` AR queries to implement the
  above, started enforcing a rule that was probably missed
  previously: if the specified `role` parameter is not a
  `Group`-ish role, treat the `role` as nonsense and return
  an empty result set.
  - It is an error if the `rlid` refers to an `Assignment`
  but that `Assignment` is not bound to the same
  `ContextExternalTool` resolved from the current LTI access token
  and requested `Course`. As noted in the code, some of the
  implementation details may need to change in the near future since
  `Tool`<->`Assignment` binding for 1.3 `Tools` is incomplete.
  - Changes to tests include a new `let`-managed
  `:effective_page_size` ivar. This allows tests to distinguish
  between the page size used to limit the query window (the
  'effective' size) and the _actual_ response page size for
  any given request (`:rsp_page_size`). This was not an
  issue historically because the two values just hapened to
  always be equal.

Closes LTIA-32

Test Plan:

  - In a LTI 1.3/Advantage-enabled `Course`, configure
  'Assignment 1' which is assigned to 'Everyone' and 'Assignment 2'
  which is assigned to some subset of active student enrollments.
  - Via UI or console or direct db access or API access, ensure both
  assignments are bound to the Tool as which you plan to make NRPS
  v2 requests (this Tool must have access to the `Course` owning
  the assignments).
  - Via console or direct db access or API access, ensure both
  assignments have distinct `lti_context_id` values. These will be
  their `rlid`s.

  Course NRPS:

  - Invoke NRPS v2 specifying the `rlid` for 'Assignment 1':
    GET `/api/lti/courses/:course_id/names_and_roles?rlid=:rlid_1
  Result should be all active course members across all roles.
  - Repeat with a non-student `role` filter, e.g.:
    GET `/api/lti/courses/:course_id/names_and_roles?rlid=:rlid_1&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Instructor
  Result should be limited to active course members having that role.
  - Repeat with a student `role` filter, e.g.:
    GET `/api/lti/courses/:course_id/names_and_roles?rlid=:rlid_1&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Learner
  Result should be limited to active course students.
  - Invoke NRPS v2 specifying the `rlid` for 'Assignment 2':
    GET `/api/lti/courses/:course_id/names_and_roles?rlid=:rlid_2
  Result should be all active course members in non-student
  roles, plus only those active students to whom 'Assignment 2' was
  assigned.
  - Repeat with a non-student `role` filter, e.g.:
    GET `/api/lti/courses/:course_id/names_and_roles?rlid=:rlid_2&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Instructor
  Result should be limited to active course members having that role.
  - Repeat with a student `role` filter, e.g.:
    GET `/api/lti/courses/:course_id/names_and_roles?rlid=:rlid_2&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Learner
  Result should be limited to active course students to whom
  'Assignment 2' was assigned.
  - Repeat all of the above with pagination parameters and verify that
  results can be paged through, one-by-one if necessary.
  - Repeat the `role` filtered requests with nonsense values. Results
  should always represent the empty set.

  Group NRPS:
  - In the same `Course` create a `Group` with several members, some of
  which have been assigned to `Assignment 2`.
  - Invoke NRPS v2 specifying the `rlid` for 'Assignment 1':
    GET `/api/lti/groups/:group_id/names_and_roles?rlid=:rlid_1
  Result should be all active group members.
  - Repeat with the group leader `role` filter:
    GET `/api/lti/groups/:group_id/names_and_roles?rlid=:rlid_1&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Manager
  Result should be limited to the group leader.
  - Repeat with the group member `role` filter, e.g.:
    GET `/api/lti/groups/:group_id/names_and_roles?rlid=:rlid_1&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Member
  Result should be all active group members.
  - Invoke NRPS v2 specifying the `rlid` for 'Assignment 2':
    GET `/api/lti/groups/:group_id/names_and_roles?rlid=:rlid_2
  Result should be limited to only those group members to to whom
  'Assignment 2' was assigned.
  - Repeat with the group leader `role` filter, e.g.:
    GET `/api/lti/groups/:group_id/names_and_roles?rlid=:rlid_2&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Manager
  Result should be limited to the group leader if he was assigned
  `Assignment 2`, else empty.
  - Repeat with the group member `role` filter, e.g.:
    GET `/api/lti/groups/:group_id/names_and_roles?rlid=:rlid_2&role=http%3A%2F%2Fpurl.imsglobal.org%2Fvocab%2Flis%2Fv2%2Fmembership%23Learner
  Result should be limited to only those group members to to whom
  'Assignment 2' was assigned.
  - Repeat all of the above with pagination parameters and verify that
  results can be paged through, one-by-one if necessary.
  - Repeat the `role` filtered requests with pure nonsense and
  non-group-ish values. Results should always represent the empty set.
  - Create `Assignment 3` but bind it to a different
  `ContextExternalTool`. Ensure that it too has a distinct
  `lti_context_id`. A NRPS request for 'Assignment 3' should fail
  with a 401.

Change-Id: I4fc16fc28797779abf3d7609961e68e9a8cdc022
Reviewed-on: https://gerrit.instructure.com/168736
Tested-by: Jenkins
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Bill Smith <bsmith@instructure.com>
2018-10-26 21:40:43 +00:00
Augusto Callejas edc711d12a Add pagination to LMGB
closes OUT-2356

This includes support for sorting by student sortable name
and outcome rollup score, which was previously done on the
client-side.

test plan:
  - create course-level outcomes
  - create an assignment aligned to those outcomes
  - create around 30 student accounts, with different
    names (first and last names) to test sorting by student name later
  - create two course sections and split the students between them
  - submit to the assignment with all student accounts
  - provide a rubric assessment in speedgrader to most
    submissions, providing mostly unique scores, but
    some duplicate scores to test sorting by rollup
    score later
  - test using current gradebook and new gradebook:
    * confirm that pagination appears at the bottom of LMGB
    * confirm that by clicking on the header above the student
      column, sorting works both ascending and descending
    * confirm that by clicking on the header above an outcome
      column, sorting works on rollup score both ascending
      and descending. additionally confirm when two students
      have the same score, it then sorts by student name
    * confirm that sorting (both by student name and outcome)
      continues properly when you paginate to the second page
    * confirm that selecting a course section (or all sections)
      only displays results for students in that section

Change-Id: Ie68cdf7e68791fb27cd851347a260efae6212cde
Reviewed-on: https://gerrit.instructure.com/159749
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-08-24 16:40:21 +00:00
Jacob Fugal ab535a0eac fix supported contexts in files#api_capture
fixes RECNVS-352

the list of context types in `VALID_CONTEXT_TYPES` corresponds to
possible contexts at all calls to api_attachment_preflight

test-plan:
- have inst-fs enabled and set up
- upload a file as a submission comment
- upload works

Change-Id: Iaa3371a1c9c5cf55196f2b43b134ae863e804017
Reviewed-on: https://gerrit.instructure.com/142890
Tested-by: Jenkins
Reviewed-by: Andrew Huff <ahuff@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-03-11 18:56:01 +00:00
Venk Natarajan ca929f15e6 Include an option to allow crosslisted courses in api results.
This also adds a new brakeman override about a SQL injection false
positive. `#{Course.best_unicode_collation_key("courses.name")}` is
safe, and any input in `opts[:order]` is generated from
app/controllers/accounts_controller.rb:sort_order, which does not allow
user input to be passed in.

Closes COMMS-574

Test Plan:
* Have an account with two sub-accounts, call them A and B
* Create a course in each sub account, and put a section in
  the course in account B.
* Publish these courses, and add them to the public index (in
  the settings for each course).
* Crosslist the section in the course in account B into the
  course in account A.
* Go to account B's page and ensure that the course in account
  A is *not* there.
* Also, go to /api/v1/accounts/#/courses for each account and
  check that only courses that *originated* in each account
  show up in the JSON response.
* HOWEVER, if you add in the param "include_crosslisted_courses=true"
  in the request for the account that the crosslist *originated from*
  then both coruses should show.

Change-Id: I3170bd062f8cf3e60c668e6b4bb494e5b0f2991b
Reviewed-on: https://gerrit.instructure.com/134690
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
Tested-by: Jenkins
QA-Review: Aaron Kc Hsu <ahsu@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2018-01-05 20:01:52 +00:00
Christian Prescott ec2681a331 Fix negative needs_grading_count
closes OUT-426

Test Plan
1. Prepare an assignment accepting submissions.
2. As teacher and admin, ensure todo list on course home page appears
   correctly for the assignment.
   a. When a submission is made, it should appear "needs grading"
   b. When more submissions are made, it should appear only once and
      show count of pending submissions.
   c. When a submission is graded, the count should decrement until
      there are no pending submissions remaining.
   d. When a user with a pending submission unenrolls, the count should
      decrement. When the user is reenrolled, their submission should
      reappear.
3. As a TA with limited visibility to a section, ensure todo list
   appears correctly and only counts submissions that should be visible.
4. Ensure graded quizzes have the same behavior.

Change-Id: I5eca4d0d9d008b2ce1ae39660f29709c509bed22
Reviewed-on: https://gerrit.instructure.com/96241
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2017-01-11 20:55:41 +00:00
Christian Prescott a909d264b7 Add need_grading_count scope to Submission
refs OUT-426

Counts submissions made by enrolled users in a pending grading state.
Includes partial index to support that aggregation

Test Plan
In canvas console or g/97755, ensure Submission.needs_grading_count:
Does count
  submission that has not been graded
  submission to quiz that is partially graded
  submission by student in the course
  submission by user that has been un- then re-enrolled in the course
  submission by user enrolled in >1 sections in the course *only once*
Does not count
  submission that has been graded
  submission that has been autograded
  submission by unenrolled user

Change-Id: I031bd3692c4dd4aaf4218a11a31c0debc61128ab
Reviewed-on: https://gerrit.instructure.com/97774
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Tested-by: Jenkins
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-12-21 01:47:05 +00:00