Further specify order of outcome results

closes OUT-2899

test plan:
  - in a course, create an outcome
  - create 5 assignments aligned to that outcome
  - as a student, submit to all the assignments
  - as a teacher, provide a rubric assessment to all submissions
  - in a separate browser tab, confirm that 5 results show up
    (so no skipped results and no repeating results), in result id
    order, using two different pagination approaches (replace
    "1" with the actual course id and prefix each call with
    the domain being tested, like http://canvas.docker):

   * 2 results per page
   /api/v1/courses/1/outcome_results/?per_page=2&page=1
   /api/v1/courses/1/outcome_results/?per_page=2&page=2
   /api/v1/courses/1/outcome_results/?per_page=2&page=3

   * 10 results per page
   /api/v1/courses/1/outcome_results/?per_page=10

Change-Id: I963c6c89e395e2a9de9914152cbd92f375ce8b4d
Reviewed-on: https://gerrit.instructure.com/176507
Tested-by: Jenkins
Reviewed-by: Matthew Berns <mberns@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
This commit is contained in:
Augusto Callejas 2018-12-31 09:59:11 -10:00
parent 650a1e6957
commit 299535a962
2 changed files with 6 additions and 1 deletions

View File

@ -57,7 +57,7 @@ module Outcomes
#
# Returns the resulting relation
def order_results_for_rollup(relation)
relation.order(:user_id, :learning_outcome_id)
relation.order(:user_id, :learning_outcome_id, :id)
end
# Public: Generates a rollup of each outcome result for each user.

View File

@ -117,6 +117,11 @@ describe Outcomes::ResultAnalytics do
results = ra.find_outcome_results(@student, users: [@student], context: @course, outcomes: [@outcome])
expect(results.length).to eq 0
end
it 'order results by id on matching learning outcome id and user id' do
results = ra.find_outcome_results(@teacher, users: [@student], context: @course, outcomes: [@outcome], include_hidden: true)
expect(results.first.id).to be < results.second.id
end
end
describe '#rollup_user_results' do