Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit 9f414d5

Browse files
committed
fix(updates): updated snapshots and check for rubric entries
1 parent 42e70be commit 9f414d5

6 files changed

+63
-33
lines changed

src/Rubric/RubricModels.ts

+6
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ export interface SmarterAppOptionModel {
3737
language: string;
3838
answer: string;
3939
}
40+
41+
export interface RubricTableRowModel {
42+
score: string;
43+
rationale: string;
44+
sample: string;
45+
}

src/Rubric/RubricTable.tsx

+25-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
import * as React from "react";
2-
import { RubricModel } from "./RubricModels";
2+
import { RubricModel, RubricTableRowModel } from "./RubricModels";
33

44
export interface RubricTableProps {
55
rubrics: RubricModel[];
66
}
77

88
export class RubricTable extends React.Component<RubricTableProps, {}> {
99
renderRubric(rubric: RubricModel, index: number) {
10-
const rows = rubric.rubricEntries.map(entry => {
11-
const sample = rubric.samples.find(
12-
s =>
13-
s.sampleResponses &&
14-
s.sampleResponses[0] &&
15-
s.sampleResponses[0].scorePoint === entry.scorepoint
16-
);
17-
const sampleHtml = sample
18-
? sample.sampleResponses.map(sr => sr.sampleContent).join("<br/>")
19-
: "";
10+
let rows: RubricTableRowModel[] = [];
11+
if (rubric.rubricEntries && rubric.rubricEntries.length > 0) {
12+
rows = rubric.rubricEntries.map(entry => {
13+
const sample = rubric.samples.find(
14+
s =>
15+
s.sampleResponses &&
16+
s.sampleResponses[0] &&
17+
s.sampleResponses[0].scorePoint === entry.scorepoint
18+
);
19+
const sampleHtml = sample
20+
? sample.sampleResponses.map(sr => sr.sampleContent).join("<br/>")
21+
: "";
2022

21-
return {
22-
score: entry.scorepoint,
23-
rationale: entry.value,
24-
sample: sampleHtml
25-
};
26-
});
23+
return {
24+
score: entry.scorepoint,
25+
rationale: entry.value,
26+
sample: sampleHtml
27+
};
28+
});
29+
}
2730

2831
const showSample = rubric.samples.length !== 0;
2932

@@ -34,8 +37,11 @@ export class RubricTable extends React.Component<RubricTableProps, {}> {
3437
// tslint:disable:react-no-dangerous-html
3538
const rowsJsx = rows.map((row, i) => (
3639
<tr key={i}>
37-
<td dangerouslySetInnerHTML={{ __html: row.rationale }} />
38-
<td dangerouslySetInnerHTML={{ __html: row.score }} style={leftAlign} />
40+
<td>{row.score}</td>
41+
<td
42+
dangerouslySetInnerHTML={{ __html: row.rationale }}
43+
style={leftAlign}
44+
/>
3945
{showSample ? (
4046
<td
4147
dangerouslySetInnerHTML={{ __html: row.sample }}

stories/Rubric/RubricModal.storybook.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ const rubricModalMockProps: RubricModalProps = {
1111
language: "English",
1212
rubricEntries: [
1313
{
14-
scorepoint:
15-
'<p style=""><span style="font-weight:bold; ">Exemplar</span>: <img id="item_3200_Object3" style="vertical-align:middle;" src="item_3200_v0_Object3_png16malpha.png" width="23" height="36" /> or &#xA0;3<img id="item_3200_Object4" style="vertical-align:middle;" src="item_3200_v0_Object4_png16malpha.png" width="12" height="35" /></p><p style="">&#xA0;</p><p style="">For this item, a full-credit response includes:</p><p style="">&#xA0;</p><p style=""><span style="font-weight:bold; ">1 point</span>: correct response of 32/9 or 3 5/9.</p>',
14+
scorepoint: "0",
1615
name: "\n Rubric 2",
1716
value:
1817
'<p style="text-decoration:underline; font-weight:bold; ">3 point text </p><p style="">&#xA0;</p><p style="">The student determines that Emily can make it to school on time at her current rate of speed and includes a valid explanation containing a full chain of reasoning that supports this conclusion. The student may make minor computation errors that do not affect the reasonableness of the explanation. </p><p style="">&#xA0;</p><p style="">&#xA0;</p><p style="text-decoration:underline; font-weight:bold; ">2 point text </p><p style="text-decoration:underline; font-weight:bold; ">&#xA0;</p><p style="">The student determines that Emily can make it to school on time at her current rate of speed and includes a valid explanation containing an incomplete chain of reasoning that supports this conclusion. (An incomplete chain of reasoning can be defined by missing process steps or unsupported calculations in an otherwise complete chain of reasoning.) </p><p style="">OR </p><p style="">The student determines that Emily can make it to school on time at her current rate of speed and includes a valid explanation containing a full chain of reasoning that supports this conclusion, but makes computation errors that affect the reasonableness of the explanation. </p>'

stories/Rubric/RubricTable.storybook.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ const rubricTableMockProps: RubricTableProps = {
99
language: "English",
1010
rubricEntries: [
1111
{
12-
scorepoint:
13-
'<p style=""><span style="font-weight:bold; ">Exemplar</span>: <img id="item_3200_Object3" style="vertical-align:middle;" src="item_3200_v0_Object3_png16malpha.png" width="23" height="36" /> or &#xA0;3<img id="item_3200_Object4" style="vertical-align:middle;" src="item_3200_v0_Object4_png16malpha.png" width="12" height="35" /></p><p style="">&#xA0;</p><p style="">For this item, a full-credit response includes:</p><p style="">&#xA0;</p><p style=""><span style="font-weight:bold; ">1 point</span>: correct response of 32/9 or 3 5/9.</p>',
12+
scorepoint: "0",
1413
name: "\n Rubric 2",
15-
value: "0"
14+
value:
15+
'<p style="text-decoration:underline; font-weight:bold; ">3 point text </p><p style="">&#xA0;</p><p style="">The student determines that Emily can make it to school on time at her current rate of speed and includes a valid explanation containing a full chain of reasoning that supports this conclusion. The student may make minor computation errors that do not affect the reasonableness of the explanation. </p><p style="">&#xA0;</p><p style="">&#xA0;</p><p style="text-decoration:underline; font-weight:bold; ">2 point text </p><p style="text-decoration:underline; font-weight:bold; ">&#xA0;</p><p style="">The student determines that Emily can make it to school on time at her current rate of speed and includes a valid explanation containing an incomplete chain of reasoning that supports this conclusion. (An incomplete chain of reasoning can be defined by missing process steps or unsupported calculations in an otherwise complete chain of reasoning.) </p><p style="">OR </p><p style="">The student determines that Emily can make it to school on time at her current rate of speed and includes a valid explanation containing a full chain of reasoning that supports this conclusion, but makes computation errors that affect the reasonableness of the explanation. </p>'
1616
},
1717
{
18-
scorepoint:
19-
'<p style="">The student completes the task and reaches a conclusion. The student\'s explanation attempts to relate distance to time, but contains errors in fundamental mathematical procedures. </p><p style="">&#xA0;</p>',
18+
scorepoint: "1",
2019
name: "\n Rubric 1",
21-
value: "1"
20+
value:
21+
'<p style="">The student completes the task and reaches a conclusion. The student\'s explanation attempts to relate distance to time, but contains errors in fundamental mathematical procedures. </p><p style="">&#xA0;</p>'
2222
},
2323
{
24-
scorepoint:
25-
'<p style="">The student demonstrates a lack of comprehension in regard to the mathematical content and practices essential to the task. </p>',
24+
scorepoint: "0",
2625
name: "\n Rubric 0",
27-
value: "2"
26+
value:
27+
'<p style="">The student demonstrates a lack of comprehension in regard to the mathematical content and practices essential to the task. </p>'
2828
}
2929
],
3030
samples: [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Storyshots Rubric Modal with rubric modal 1`] = `
4+
<div>
5+
<button
6+
aria-label="Open Rubric Modal"
7+
className="item-nav-btn btn btn-default btn-sm rubric-btn"
8+
onClick={[Function]}
9+
role="button"
10+
tabIndex={0}
11+
>
12+
<span
13+
aria-hidden="true"
14+
className="fa fa-check-circle-o"
15+
/>
16+
Rubric
17+
</button>
18+
</div>
19+
`;

stories/Rubric/__snapshots__/RubricTable.storybook.storyshot

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Storyshots RubricTable with a rubric table 1`] = `
3+
exports[`Storyshots Rubric Table with a rubric table 1`] = `
44
<div>
55
<table
66
className="item-data-table"
@@ -21,7 +21,7 @@ exports[`Storyshots RubricTable with a rubric table 1`] = `
2121
<tbody>
2222
<tr>
2323
<td>
24-
2
24+
0
2525
</td>
2626
<td
2727
dangerouslySetInnerHTML={
@@ -38,7 +38,7 @@ exports[`Storyshots RubricTable with a rubric table 1`] = `
3838
<td
3939
dangerouslySetInnerHTML={
4040
Object {
41-
"__html": "<p style=\\"\\"><span style=\\"text-decoration:underline; font-weight:bold; \\">Sample 1: </span>&#xA0;</p><p style=\\"\\">Emily can travel 3/4 mile in under 5 minutes, so she can travel 3 miles (4x as far) in under 20 minutes (4x as long.) This means that Emily will have traveled 3 miles before 8:45 (20 minutes after she left.) Then there is only .42 miles left to go, and since .42 miles is less than 3/4 mile, we know she can cover that distance in less than 5 minutes. That means she will get to school before 8:50, so she will be on time. </p><p style=\\"\\">&#xA0;</p><p style=\\"\\"><span style=\\"text-decoration:underline; font-weight:bold; \\">Sample 2:</span> &#xA0;</p><p style=\\"\\">Emily travels 3/4 mile in 4.5 minutes, so to find her rate of travel we would divide time by distance and get (4.5) / (.75) = 6 minutes per mile. Multiply 6 minutes per mile times the distance she has to travel (3.42 miles) to find the time it would take for her to get to school (20.52.) Since 20.52 is less than 21 minutes, we know it will take her less than 21 minutes to get to school. 8:25 + 21 minutes is 8:46, which is before 8:50, so she will make it to school on time. </p>",
41+
"__html": "",
4242
}
4343
}
4444
style={

0 commit comments

Comments
 (0)