Skip to content

Commit

Permalink
Include quiz_type in the RCS quizzes api response
Browse files Browse the repository at this point in the history
this will facilitate showing the correct icon in the RCE

closes: MAT-954
flag=none

test plan:
  - hit the RCS' /api/quizzes?contextType=course&contextId=:course_id
    api
    - or open the course links tray in the RCE and expand the
      quizzes panel in the tray
  > expect to see quiz_type in each quiz's entry in the response

Change-Id: If6dbfa1da44bfc83b0707cf5d75c4981dc9b248c
Reviewed-on: https://gerrit.instructure.com/c/canvas-rce-api/+/298825
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Mysti Lilla <[email protected]>
QA-Review: Mysti Lilla <[email protected]>
Product-Review: Jon Scheiding <[email protected]>
  • Loading branch information
eschiebel authored and Jon Scheiding committed Aug 23, 2022
1 parent 8374e81 commit ee2ea38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/api/quizzes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const canvasResponseHandler = linksResponseHandler((request, results) => {
title: quiz.title,
published: quiz.published,
date,
date_type: "due"
date_type: "due",
quiz_type: quiz.quiz_type
};
});
});
Expand Down
6 changes: 6 additions & 0 deletions test/service/api/quizzes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe("Quizzes API", () => {
published: true,
all_dates: [{ due_at: "2019-04-22T13:00:00Z" }],
due_at: "2019-04-22T13:00:00Z",
quiz_type: "assignment",
...overrides
}
]
Expand Down Expand Up @@ -108,5 +109,10 @@ describe("Quizzes API", () => {
assert.equal(result.links[0].date, "multiple");
assert.equal(result.links[0].date_type, "due");
});

it("pulls the quiz_type from canvas' response", () => {
const [result, canvasResponse] = setup();
assert.equal(result.links[0].quiz_type, canvasResponse.body[0].quiz_type);
});
});
});

0 comments on commit ee2ea38

Please sign in to comment.