Skip to content

Commit

Permalink
Update alignment id to include module id
Browse files Browse the repository at this point in the history
closes OUT-5219
flag=outcome_alignment_summary

Test plan:
- Enable Improved Outcomes Management FF
- Enable Outcome Alignment Summary FF
- Go to Course > Outcomes
- Create an outcome and a rubric and align them
- Create an assignment and align with the rubric
- Create two modules - one of them published the other one
unpublished and add the assignment to both modules
- Open in browser canvas.docker/graphiql
- Execute query below replacing outcome id and context id
query MyQuery {
  learningOutcome(id: "1") {
    alignments(contextId: "1", contextType: "Course") {
      _id
      title
      moduleName
      moduleUrl
      moduleWorkflowState
    }
  }
}
- Verify that the outcome alignments include two records for
the same assignment but with different values for _id,
moduleName, moduleUrl and moduleWorkflowState
- Verify that the _id value for the assignments consists of
two numbers concatenated with underscore
- Verify taht the _id for the rubric does not contain underscore
- Go to Course > Outcomes and open Devtools -> console
- Reload the Alignments tab and expand the aligned outcome
- Verify that the assignment appears two times in the list of
alignments with but with different module names
- Verify that there are no errors in the console

Change-Id: Ie8617f0499fe59590f3c1547c792f77b87ba05bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298429
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Angela Gomba <[email protected]>
Reviewed-by: Dave Wenzlick <[email protected]>
QA-Review: Angela Gomba <[email protected]>
Product-Review: Kyle Rosenbaum <[email protected]>
  • Loading branch information
instout authored and Kyle Rosenbaum committed Aug 12, 2022
1 parent 1101cbb commit b52722a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/graphql/types/outcome_alignment_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class OutcomeAlignmentType < ApplicationObjectType

global_id_field :id

field :_id, ID, null: false
def _id
return [object.id, object.module_id].join("_") unless object.module_id.nil?

object.id
end
field :title, String, null: false
field :content_id, ID, null: false
field :content_type, String, null: false
Expand Down
15 changes: 13 additions & 2 deletions spec/graphql/types/outcome_alignment_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def resolve_field(field_name)
@outcome_alignment = ContentTag.last
end

it "returns _id" do
expect(resolve_field("_id")).to eq @outcome_alignment.id.to_s
it "returns _id = alignment_id + '_' + module_id" do
expect(resolve_field("_id")).to eq [@outcome_alignment.id.to_s, @module.id.to_s].join("_")
end

it "returns learning_outcome_id" do
Expand Down Expand Up @@ -102,6 +102,17 @@ def resolve_field(field_name)
end
end

describe "for outcome alignment not included in module" do
before do
@rubric.associate_with(@assignment, @course, purpose: "grading")
@outcome_alignment = ContentTag.last
end

it "returns _id = alignment_id" do
expect(resolve_field("_id")).to eq @outcome_alignment.id.to_s
end
end

describe "for outcome alignment to an Assignment" do
before do
@rubric.associate_with(@assignment, @course, purpose: "grading")
Expand Down

0 comments on commit b52722a

Please sign in to comment.