Render live assessment results in student LMGB
fixes OUT-2953 test plan: - create a new course in an account - enable LMGB and student LMGB in course feature options - create a course outcome - create a student user in the course - create two assignments, one titled "assessed assignment" and another titled "unassessed assignment" and align the outcome to both assignments - create a quiz question bank with a single question and align the outcome to the bank - create two quizzes, one titled "assessed quiz" and another titled "unassessed quiz", both pulling the question from the above bank - create a live assessment: > c = Course.last > la = LiveAssessments::Assessment.create!( key: 'test1', title: 'assessed live assessment', context: c) > o = LearningOutcome.last > o.align(la, c) > LiveAssessments::Result.create!(user: User.last, assessor_id: 1, assessment_id: la.id, passed: true, assessed_at: Time.now) > la.generate_submissions_for([User.last]) - as the student, submit to the two assignments and two quizzes - in speedgrader, assess the "assessed assignment" and "assessed quiz" submissions - open the student LMGB for the given student - confirm that assessed quiz, assignment and live assessment appear, followed by unassessed quiz and assignment Change-Id: I8cb62396a3a09aa168d90bb043e28f12b92019e0 Reviewed-on: https://gerrit.instructure.com/183458 Reviewed-by: Frank Murphy III <fmurphy@instructure.com> Reviewed-by: Neil Gupta <ngupta@instructure.com> Tested-by: Jenkins QA-Review: Brian Watson <bwatson@instructure.com> Product-Review: Neil Gupta <ngupta@instructure.com>
This commit is contained in:
parent
1ba2a0e1ad
commit
baf2136cc6
|
@ -451,7 +451,7 @@ class OutcomeResultsController < ApplicationController
|
|||
end
|
||||
|
||||
def include_assignments
|
||||
assignments = @results.map(&:assignment)
|
||||
assignments = @results.map { |result| result.assignment || result.alignment&.content }
|
||||
outcome_results_assignments_json(assignments)
|
||||
end
|
||||
|
||||
|
|
|
@ -131,10 +131,15 @@
|
|||
# "type": "integer"
|
||||
# },
|
||||
# "assignment_id": {
|
||||
# "description": "the id of the aligned assignment.",
|
||||
# "description": "the id of the aligned assignment (null for live assessments).",
|
||||
# "example": 2,
|
||||
# "type": "integer"
|
||||
# },
|
||||
# "assessment_id": {
|
||||
# "description": "the id of the aligned live assessment (null for assignments).",
|
||||
# "example": 3,
|
||||
# "type": "integer"
|
||||
# },
|
||||
# "submission_types": {
|
||||
# "description": "a string representing the different submission types of an aligned assignment.",
|
||||
# "example": "online_text_entry,online_url",
|
||||
|
@ -314,7 +319,21 @@ class OutcomesApiController < ApplicationController
|
|||
end
|
||||
end.flatten
|
||||
|
||||
alignments.concat(quiz_alignments)
|
||||
live_assessments = LiveAssessments::Assessment.for_context(context).
|
||||
joins(:submissions).
|
||||
preload(:learning_outcome_alignments).
|
||||
where(live_assessments_submissions: {user_id: student_id})
|
||||
magic_marker_alignments = live_assessments.map do |la|
|
||||
la.learning_outcome_alignments.map do |loa|
|
||||
{
|
||||
learning_outcome_id: loa.learning_outcome_id,
|
||||
title: loa.title,
|
||||
submission_types: 'magic_marker',
|
||||
assessment_id: la.id
|
||||
}
|
||||
end
|
||||
end.flatten
|
||||
alignments.concat(quiz_alignments, magic_marker_alignments)
|
||||
|
||||
render :json => alignments
|
||||
end
|
||||
|
|
|
@ -25,6 +25,7 @@ import Link from '@instructure/ui-elements/lib/components/Link'
|
|||
import Text from '@instructure/ui-elements/lib/components/Text'
|
||||
import IconAssignment from '@instructure/ui-icons/lib/Line/IconAssignment'
|
||||
import IconQuiz from '@instructure/ui-icons/lib/Line/IconQuiz'
|
||||
import IconHighlighter from '@instructure/ui-icons/lib/Line/IconHighlighter'
|
||||
import * as shapes from './shapes'
|
||||
import Ratings from '../../rubrics/Ratings'
|
||||
|
||||
|
@ -37,6 +38,28 @@ const scoreFromPercent = (percent, outcome) => {
|
|||
}
|
||||
}
|
||||
|
||||
const renderLinkedResult = (name, url, isQuiz) => (
|
||||
<Link href={ url }>
|
||||
<Flex alignItems="center">
|
||||
<FlexItem><Text size="medium">
|
||||
{
|
||||
isQuiz ? <IconQuiz /> : <IconAssignment />
|
||||
}
|
||||
</Text></FlexItem>
|
||||
<FlexItem padding="0 x-small"><Text weight="bold">{ name }</Text></FlexItem>
|
||||
</Flex>
|
||||
</Link>
|
||||
)
|
||||
|
||||
const renderUnlinkedResult = (name) => (
|
||||
<Flex alignItems="center">
|
||||
<FlexItem><Text size="medium">
|
||||
<IconHighlighter />
|
||||
</Text></FlexItem>
|
||||
<FlexItem padding="0 x-small"><Text weight="bold">{ name }</Text></FlexItem>
|
||||
</Flex>
|
||||
)
|
||||
|
||||
const AssignmentResult = ({ outcome, result, outcomeProficiency }) => {
|
||||
const { ratings } = outcome
|
||||
const { html_url: url, name, submission_types: types } = result.assignment
|
||||
|
@ -45,16 +68,7 @@ const AssignmentResult = ({ outcome, result, outcomeProficiency }) => {
|
|||
return (
|
||||
<Flex padding="small" direction="column" alignItems="stretch">
|
||||
<FlexItem>
|
||||
<Link href={ url }>
|
||||
<Flex alignItems="center">
|
||||
<FlexItem><Text size="medium">
|
||||
{
|
||||
isQuiz ? <IconQuiz /> : <IconAssignment />
|
||||
}
|
||||
</Text></FlexItem>
|
||||
<FlexItem padding="0 x-small"><Text weight="bold">{ name }</Text></FlexItem>
|
||||
</Flex>
|
||||
</Link>
|
||||
{ url.length > 0 ? renderLinkedResult(name, url, isQuiz) : renderUnlinkedResult(name) }
|
||||
</FlexItem>
|
||||
<FlexItem padding="x-small 0">
|
||||
<View padding="x-small 0 0 0">
|
||||
|
|
|
@ -98,10 +98,14 @@ export default class Outcome extends React.Component {
|
|||
renderDetails () {
|
||||
const { outcome, outcomeProficiency } = this.props
|
||||
const { assignments, results } = outcome
|
||||
const assignmentsWithResults = results.map((r) => r.assignment.id.split('_')[1])
|
||||
const unassessedAssignments = _.reject(assignments, (a) => (
|
||||
_.includes(assignmentsWithResults, a.assignment_id.toString()
|
||||
)))
|
||||
const assignmentsWithResults = _.filter(results,
|
||||
(r) => r.assignment.id.startsWith('assignment_')).map((r) => r.assignment.id.split('_')[1])
|
||||
const assessmentsWithResults = _.filter(results,
|
||||
(r) => r.assignment.id.startsWith('live_assessments/assessment_')).map((r) => r.assignment.id.split('_')[2])
|
||||
const unassessed = _.filter(assignments, (a) => (
|
||||
a.assignment_id && !_.includes(assignmentsWithResults, a.assignment_id.toString()) ||
|
||||
a.assessment_id && !_.includes(assessmentsWithResults, a.assessment_id.toString())
|
||||
))
|
||||
return (
|
||||
<List variant="unstyled" delimiter="dashed">
|
||||
{
|
||||
|
@ -112,8 +116,10 @@ export default class Outcome extends React.Component {
|
|||
))
|
||||
}
|
||||
{
|
||||
unassessedAssignments.map((assignment) => (
|
||||
<UnassessedAssignment assignment={assignment}/>
|
||||
unassessed.map((assignment) => (
|
||||
<UnassessedAssignment
|
||||
key={assignment.assessment_id ? `a${assignment.assessment_id}` : assignment.assignment_id}
|
||||
assignment={assignment}/>
|
||||
))
|
||||
}
|
||||
</List>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { render, shallow } from 'enzyme'
|
||||
import { render, mount, shallow } from 'enzyme'
|
||||
import AssignmentResult from '../AssignmentResult'
|
||||
|
||||
const defaultProps = (props = {}) => (
|
||||
|
@ -109,4 +109,11 @@ it('correctly rounds to two decimal places', () => {
|
|||
props.result.percent = 0.257
|
||||
const wrapper = render(<AssignmentResult {...props}/>)
|
||||
expect(wrapper.text()).toMatch('Your score: 1.29')
|
||||
})
|
||||
|
||||
it('renders unlinked result', () => {
|
||||
const props = defaultProps()
|
||||
props.result.assignment.html_url = ''
|
||||
const wrapper = mount(<AssignmentResult {...props}/>)
|
||||
expect(wrapper.find('IconHighlighter').exists()).toBe(true)
|
||||
})
|
|
@ -34,6 +34,9 @@ const result = (id = 1, date = new Date(), hidePoints = false) => ({
|
|||
submitted_or_assessed_at: date.toISOString()
|
||||
})
|
||||
|
||||
const time1 = new Date(Date.UTC(2018, 1, 1, 7, 1, 0)).toISOString()
|
||||
const time2 = new Date(Date.UTC(2019, 1, 1, 7, 1, 0)).toISOString()
|
||||
|
||||
const defaultProps = (props = {}) => (
|
||||
Object.assign({
|
||||
outcome: {
|
||||
|
@ -65,7 +68,20 @@ const defaultProps = (props = {}) => (
|
|||
name: 'My assignment',
|
||||
submission_types: 'online_quiz',
|
||||
score: 0
|
||||
}
|
||||
},
|
||||
submitted_or_assessed_at: time1
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
score: 1,
|
||||
percent: 0.1,
|
||||
assignment: {
|
||||
id: 'live_assessments/assessment_1',
|
||||
name: 'My assessment',
|
||||
submission_types: 'magic_marker',
|
||||
score: 0
|
||||
},
|
||||
submitted_or_assessed_at: time2
|
||||
}
|
||||
],
|
||||
title: 'My outcome',
|
||||
|
@ -153,7 +169,7 @@ describe('header', () => {
|
|||
|
||||
it('includes the individual results', () => {
|
||||
const wrapper = shallow(<Outcome {...defaultProps()} />)
|
||||
expect(wrapper.find('AssignmentResult')).toHaveLength(1)
|
||||
expect(wrapper.find('AssignmentResult')).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('renders the results by most recent', () => {
|
||||
|
|
|
@ -84,6 +84,18 @@ exports[`renders correctly expanded 1`] = `
|
|||
},
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
},
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"html_url": "http://foo",
|
||||
|
@ -95,6 +107,7 @@ exports[`renders correctly expanded 1`] = `
|
|||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
},
|
||||
],
|
||||
"score": 1,
|
||||
|
@ -189,6 +202,83 @@ exports[`renders correctly expanded 1`] = `
|
|||
size="medium"
|
||||
variant="unstyled"
|
||||
>
|
||||
<ListItem
|
||||
key="2"
|
||||
>
|
||||
<AssignmentResult
|
||||
outcome={
|
||||
Object {
|
||||
"assignments": Array [
|
||||
Object {
|
||||
"assignment_id": 1,
|
||||
"learning_outcome_id": 1,
|
||||
"submission_types": "online_quiz",
|
||||
"title": "My assignment",
|
||||
"url": "www.example.com",
|
||||
},
|
||||
],
|
||||
"calculation_method": "highest",
|
||||
"expansionId": 100,
|
||||
"id": 1,
|
||||
"mastered": false,
|
||||
"mastery_points": 3,
|
||||
"points_possible": 5,
|
||||
"ratings": Array [
|
||||
Object {
|
||||
"description": "My first rating",
|
||||
},
|
||||
Object {
|
||||
"description": "My second rating",
|
||||
},
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
},
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"html_url": "http://foo",
|
||||
"id": "assignment_1",
|
||||
"name": "My assignment",
|
||||
"score": 0,
|
||||
"submission_types": "online_quiz",
|
||||
},
|
||||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
},
|
||||
],
|
||||
"score": 1,
|
||||
"title": "My outcome",
|
||||
}
|
||||
}
|
||||
outcomeProficiency={null}
|
||||
result={
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
key="1"
|
||||
>
|
||||
|
@ -219,6 +309,18 @@ exports[`renders correctly expanded 1`] = `
|
|||
},
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
},
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"html_url": "http://foo",
|
||||
|
@ -230,6 +332,7 @@ exports[`renders correctly expanded 1`] = `
|
|||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
},
|
||||
],
|
||||
"score": 1,
|
||||
|
@ -249,6 +352,7 @@ exports[`renders correctly expanded 1`] = `
|
|||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
@ -423,6 +527,7 @@ exports[`renders correctly expanded with no results 1`] = `
|
|||
"url": "www.example.com",
|
||||
}
|
||||
}
|
||||
key="1"
|
||||
/>
|
||||
</List>
|
||||
</ToggleGroup>
|
||||
|
@ -669,6 +774,18 @@ exports[`renders the Outcome component 1`] = `
|
|||
},
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
},
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"html_url": "http://foo",
|
||||
|
@ -680,6 +797,7 @@ exports[`renders the Outcome component 1`] = `
|
|||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
},
|
||||
],
|
||||
"score": 1,
|
||||
|
@ -774,6 +892,83 @@ exports[`renders the Outcome component 1`] = `
|
|||
size="medium"
|
||||
variant="unstyled"
|
||||
>
|
||||
<ListItem
|
||||
key="2"
|
||||
>
|
||||
<AssignmentResult
|
||||
outcome={
|
||||
Object {
|
||||
"assignments": Array [
|
||||
Object {
|
||||
"assignment_id": 1,
|
||||
"learning_outcome_id": 1,
|
||||
"submission_types": "online_quiz",
|
||||
"title": "My assignment",
|
||||
"url": "www.example.com",
|
||||
},
|
||||
],
|
||||
"calculation_method": "highest",
|
||||
"expansionId": 100,
|
||||
"id": 1,
|
||||
"mastered": false,
|
||||
"mastery_points": 3,
|
||||
"points_possible": 5,
|
||||
"ratings": Array [
|
||||
Object {
|
||||
"description": "My first rating",
|
||||
},
|
||||
Object {
|
||||
"description": "My second rating",
|
||||
},
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
},
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"html_url": "http://foo",
|
||||
"id": "assignment_1",
|
||||
"name": "My assignment",
|
||||
"score": 0,
|
||||
"submission_types": "online_quiz",
|
||||
},
|
||||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
},
|
||||
],
|
||||
"score": 1,
|
||||
"title": "My outcome",
|
||||
}
|
||||
}
|
||||
outcomeProficiency={null}
|
||||
result={
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem
|
||||
key="1"
|
||||
>
|
||||
|
@ -804,6 +999,18 @@ exports[`renders the Outcome component 1`] = `
|
|||
},
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"id": "live_assessments/assessment_1",
|
||||
"name": "My assessment",
|
||||
"score": 0,
|
||||
"submission_types": "magic_marker",
|
||||
},
|
||||
"id": 2,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2019-02-01T07:01:00.000Z",
|
||||
},
|
||||
Object {
|
||||
"assignment": Object {
|
||||
"html_url": "http://foo",
|
||||
|
@ -815,6 +1022,7 @@ exports[`renders the Outcome component 1`] = `
|
|||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
},
|
||||
],
|
||||
"score": 1,
|
||||
|
@ -834,6 +1042,7 @@ exports[`renders the Outcome component 1`] = `
|
|||
"id": 1,
|
||||
"percent": 0.1,
|
||||
"score": 1,
|
||||
"submitted_or_assessed_at": "2018-02-01T07:01:00.000Z",
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
|
|
@ -65,12 +65,14 @@ describe('fetchOutcomes', () => {
|
|||
1: {
|
||||
outcome_results: [
|
||||
{ id: 1, score: 3.0, links: { assignment: 'assignment_1' } },
|
||||
{ id: 2, score: 2.0, links: { assignment: 'assignment_2' } }
|
||||
{ id: 2, score: 2.0, links: { assignment: 'assignment_2' } },
|
||||
{ id: 3, score: 2.0, links: { alignment: 'live_assessments/assessment_1' } }
|
||||
],
|
||||
linked: {
|
||||
assignments: [
|
||||
{ id: 'assignment_1', name: 'Assignment 1' },
|
||||
{ id: 'assignment_2', name: 'Assignment 2' }
|
||||
{ id: 'assignment_2', name: 'Assignment 2' },
|
||||
{ id: 'live_assessments/assessment_1', name: 'Test' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -124,6 +126,10 @@ describe('fetchOutcomes', () => {
|
|||
{
|
||||
assignment: { id: 'assignment_2', name: 'Assignment 2' },
|
||||
score: 2
|
||||
},
|
||||
{
|
||||
assignment: { id: 'live_assessments/assessment_1', name: 'Test' },
|
||||
score: 2
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -179,7 +185,7 @@ describe('fetchOutcomes', () => {
|
|||
mockAll(responses)
|
||||
fetchOutcomes(1, 2)
|
||||
.then(({ outcomes }) => {
|
||||
expect(outcomes[0].results).toHaveLength(1)
|
||||
expect(outcomes[0].results).toHaveLength(2)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -117,7 +117,8 @@ const fetchOutcomes = (courseId, studentId) => {
|
|||
outcome.assignments = outcomeAssignmentsByOutcomeId[outcome.id] || []
|
||||
outcome.results = outcomeResultsByOutcomeId[outcome.id] || []
|
||||
outcome.results.forEach((result) => {
|
||||
result.assignment = assignmentsByAssignmentId[result.links.assignment]
|
||||
const key = result.links.assignment || result.links.alignment
|
||||
result.assignment = assignmentsByAssignmentId[key]
|
||||
})
|
||||
})
|
||||
return { outcomeGroups, outcomes }
|
||||
|
|
|
@ -131,8 +131,8 @@ module Api::V1::OutcomeResults
|
|||
{
|
||||
id: a.asset_string,
|
||||
name: a.title,
|
||||
html_url: polymorphic_url([a.context, a]),
|
||||
submission_types: a.submission_types
|
||||
html_url: a.is_a?(LiveAssessments::Assessment) ? "" : polymorphic_url([a.context, a]),
|
||||
submission_types: a.try(:submission_types) || "magic_marker"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -714,16 +714,31 @@ describe "Outcomes API", type: :request do
|
|||
quiz_with_submission
|
||||
bank = @quiz.quiz_questions[0].assessment_question.assessment_question_bank
|
||||
@outcome.align(bank, @course, :mastery_score => 6.0)
|
||||
@live_assessment = LiveAssessments::Assessment.create!(
|
||||
key: 'live_assess',
|
||||
title: 'MagicMarker',
|
||||
context: @course
|
||||
)
|
||||
@outcome.align(@live_assessment, @course)
|
||||
LiveAssessments::Result.create!(
|
||||
user: @student,
|
||||
assessor_id: @teacher.id,
|
||||
assessment_id: @live_assessment.id,
|
||||
passed: true,
|
||||
assessed_at: Time.zone.now
|
||||
)
|
||||
@live_assessment.generate_submissions_for([@student])
|
||||
end
|
||||
|
||||
it "should return aligned assignments for a student" do
|
||||
it "should return aligned assignments and assessments for a student" do
|
||||
json = api_call(:get, "/api/v1/courses/#{@course.id}/outcome_alignments?student_id=#{@student.id}",
|
||||
:controller => 'outcomes_api',
|
||||
:action => 'outcome_alignments',
|
||||
:course_id => @course.id.to_s,
|
||||
:student_id => @student.id.to_s,
|
||||
:format => 'json')
|
||||
expect(json.map{ |j| j["assignment_id"] }.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
expect(json.map{ |j| j["assignment_id"] }.compact.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
expect(json.map{ |j| j['assessment_id'] }.compact.sort).to eq([@live_assessment.id].sort)
|
||||
end
|
||||
|
||||
it "should allow teacher to return aligned assignments for a student" do
|
||||
|
@ -734,7 +749,7 @@ describe "Outcomes API", type: :request do
|
|||
:course_id => @course.id.to_s,
|
||||
:student_id => @student.id.to_s,
|
||||
:format => 'json')
|
||||
expect(json.map{ |j| j["assignment_id"] }.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
expect(json.map{ |j| j["assignment_id"] }.compact.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
end
|
||||
|
||||
it "should allow observer to return aligned assignments for a student" do
|
||||
|
@ -745,7 +760,7 @@ describe "Outcomes API", type: :request do
|
|||
:course_id => @course.id.to_s,
|
||||
:student_id => @student.id.to_s,
|
||||
:format => 'json')
|
||||
expect(json.map{ |j| j["assignment_id"] }.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
expect(json.map{ |j| j["assignment_id"] }.compact.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
end
|
||||
|
||||
it "should not return outcomes aligned to quizzes in other courses" do
|
||||
|
@ -774,7 +789,7 @@ describe "Outcomes API", type: :request do
|
|||
:course_id => @course.id.to_s,
|
||||
:student_id => @student.id.to_s,
|
||||
:format => 'json')
|
||||
expect(json.map{ |j| j["assignment_id"] }.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
expect(json.map{ |j| j["assignment_id"] }.compact.sort).to eq([@assignment1.id, @assignment2.id, @quiz.assignment_id].sort)
|
||||
end
|
||||
|
||||
it "requires a student_id to be present" do
|
||||
|
|
Loading…
Reference in New Issue