Skip to content

Commit 4ccc647

Browse files
Merge pull request #2936 from WISE-Community/issue-2935-extract-multiple-choice-grading
Extract grading view from Multiple Choice component
2 parents 43047de + a9d67f0 commit 4ccc647

14 files changed

Lines changed: 437 additions & 216 deletions

File tree

src/main/webapp/site/src/app/teacher-hybrid-angular.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { GraphAuthoring } from '../../../wise5/components/graph/graph-authoring/
6060
import { AudioOscillatorAuthoring } from '../../../wise5/components/audioOscillator/audio-oscillator-authoring/audio-oscillator-authoring.component';
6161
import { AnimationAuthoring } from '../../../wise5/components/animation/animation-authoring/animation-authoring.component';
6262
import { OpenResponseGrading } from '../../../wise5/components/openResponse/open-response-grading/open-response-grading.component';
63+
import { MultipleChoiceGrading } from '../../../wise5/components/multipleChoice/multiple-choice-grading/multiple-choice-grading.component';
6364

6465
@NgModule({
6566
declarations: [
@@ -92,6 +93,7 @@ import { OpenResponseGrading } from '../../../wise5/components/openResponse/open
9293
MilestonesComponent,
9394
MilestoneReportDataComponent,
9495
MultipleChoiceAuthoring,
96+
MultipleChoiceGrading,
9597
NavItemProgressComponent,
9698
NodeAdvancedGeneralAuthoringComponent,
9799
NodeAdvancedJsonAuthoringComponent,

src/main/webapp/site/src/messages.xlf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8259,6 +8259,27 @@
82598259
<context context-type="linenumber">90</context>
82608260
</context-group>
82618261
</trans-unit>
8262+
<trans-unit datatype="html" id="f80d8048e1a73a4f0c35681cc5f8a250754eaf4b">
8263+
<source> You have used <x equiv-text="{{componentState.studentData.submitCounter}}" id="INTERPOLATION"/> of <x equiv-text="{{componentContent.maxSubmitCount}}" id="INTERPOLATION_1"/> attempt(s) </source>
8264+
<context-group purpose="location">
8265+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-grading/multiple-choice-grading.component.html</context>
8266+
<context context-type="linenumber">38</context>
8267+
</context-group>
8268+
</trans-unit>
8269+
<trans-unit datatype="html" id="00a48b9fab48a5ccc0ebf0a2793495ee1cc9f968">
8270+
<source> Correct </source>
8271+
<context-group purpose="location">
8272+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-grading/multiple-choice-grading.component.html</context>
8273+
<context context-type="linenumber">43</context>
8274+
</context-group>
8275+
</trans-unit>
8276+
<trans-unit datatype="html" id="49a3371af0eb58f02e541105eb395340048527ec">
8277+
<source> Incorrect </source>
8278+
<context-group purpose="location">
8279+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-grading/multiple-choice-grading.component.html</context>
8280+
<context context-type="linenumber">48</context>
8281+
</context-group>
8282+
</trans-unit>
82628283
<trans-unit datatype="html" id="6817513ddcee06a7cb2a7b2708e5616b861db81c">
82638284
<source><x equiv-text="{{nodeCompletion}}" id="INTERPOLATION"/>% completed (All periods)</source>
82648285
<context-group purpose="location">

src/main/webapp/wise5/classroomMonitor/classroomMonitorComponents/shared/component-grading.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Directive, Input } from '@angular/core';
2+
import { ProjectService } from '../../../services/projectService';
23

34
@Directive()
45
export abstract class ComponentGrading {
@@ -10,4 +11,16 @@ export abstract class ComponentGrading {
1011

1112
@Input()
1213
componentState: any;
14+
15+
componentContent: any;
16+
17+
constructor(protected ProjectService: ProjectService) {}
18+
19+
ngOnInit() {
20+
this.componentState = JSON.parse(this.componentState);
21+
this.componentContent = this.ProjectService.getComponentByNodeIdAndComponentId(
22+
this.nodeId,
23+
this.componentId
24+
);
25+
}
1326
}

src/main/webapp/wise5/classroomMonitor/classroomMonitorComponents/shared/componentRevisionsInfo/componentRevisionsInfo.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ComponentRevisionsInfoController {
1515
nodeId: string;
1616
periodId: number;
1717
runId: number;
18+
fromWorkgroupId: number;
1819
toWorkgroupId: number;
1920
usernames: any;
2021

@@ -60,17 +61,16 @@ class ComponentRevisionsInfoController {
6061
}
6162

6263
if (latest) {
63-
// calculate the save time of the latest component state
64-
let serverSaveTime = Date.parse(latest.serverSaveTime);
65-
this.latestComponentStateTime = this.ConfigService.convertToClientTimestamp(serverSaveTime);
66-
67-
// check if the latest component state is a submit
64+
this.latestComponentStateTime = this.ConfigService.convertToClientTimestamp(
65+
latest.serverSaveTime
66+
);
6867
this.latestComponentStateIsSubmit = latest.isSubmit;
6968
}
7069
}
7170

7271
showRevisions($event) {
7372
let workgroupId = this.toWorkgroupId;
73+
let fromWorkgroupId = this.fromWorkgroupId;
7474
let componentId = this.componentId;
7575
let nodeId = this.nodeId;
7676
let usernames = this.usernames;
@@ -91,6 +91,8 @@ class ComponentRevisionsInfoController {
9191
<div class="md-dialog-content gray-lighter-bg">
9292
<workgroup-component-revisions component-states="componentStates"
9393
node-id="{{ nodeId }}"
94+
component-id="{{ componentId }}"
95+
from-workgroup-id="{{ fromWorkgroupId }}"
9496
workgroup-id="{{ workgroupId }}"></workgroup-component-revisions>
9597
</div>
9698
</md-dialog-content>
@@ -100,6 +102,7 @@ class ComponentRevisionsInfoController {
100102
</md-dialog>`,
101103
locals: {
102104
workgroupId: workgroupId,
105+
fromWorkgroupId: fromWorkgroupId,
103106
componentId: componentId,
104107
nodeId: nodeId,
105108
usernames: usernames,
@@ -111,12 +114,14 @@ class ComponentRevisionsInfoController {
111114
$scope,
112115
$mdDialog,
113116
workgroupId,
117+
fromWorkgroupId,
114118
componentId,
115119
nodeId,
116120
usernames,
117121
componentStates
118122
) {
119123
$scope.workgroupId = workgroupId;
124+
$scope.fromWorkgroupId = fromWorkgroupId;
120125
$scope.componentId = componentId;
121126
$scope.nodeId = nodeId;
122127
$scope.usernames = usernames;
@@ -129,6 +134,7 @@ class ComponentRevisionsInfoController {
129134
'$scope',
130135
'$mdDialog',
131136
'workgroupId',
137+
'fromWorkgroupId',
132138
'componentId',
133139
'nodeId',
134140
'usernames',
@@ -143,6 +149,7 @@ const ComponentRevisionsInfo = {
143149
componentId: '<',
144150
componentState: '<',
145151
nodeId: '<',
152+
fromWorkgroupId: '<',
146153
toWorkgroupId: '<'
147154
},
148155
template: `<div class="component__actions__info component--grading__actions__info md-caption">

src/main/webapp/wise5/classroomMonitor/classroomMonitorComponents/shared/workgroupComponentRevisions/workgroupComponentRevisions.ts

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ const WorkgroupComponentRevisions = {
141141
bindings: {
142142
componentStates: '<',
143143
nodeId: '@',
144-
workgroupId: '@'
144+
componentId: '@',
145+
workgroupId: '@',
146+
fromWorkgroupId: '@'
145147
},
146148
template: `<md-list class="component-revisions">
147149
<div ng-repeat="item in $ctrl.data | toArray | orderBy: '-clientSaveTime'"
@@ -154,10 +156,49 @@ const WorkgroupComponentRevisions = {
154156
#{{$ctrl.total - $index}}
155157
<span ng-if="$first"> (Latest)</span>
156158
</h3>
157-
<div>
158-
<component component-state="{{ item.componentState }}"
159-
workgroup-id="::$ctrl.workgroupId"
160-
mode="gradingRevision">
159+
<div style="padding: 20px;">
160+
<ng-content ng-switch="item.componentState.componentType">
161+
<div ng-switch-when="MultipleChoice|OpenResponse" ng-switch-when-separator="|" class="component__content" layout="row" layout-wrap>
162+
<div flex="100" flex-gt-sm="66" layout="column" class="component--grading__response">
163+
<multiple-choice-grading
164+
ng-if="item.componentState.componentType === 'MultipleChoice'"
165+
node-id="{{::$ctrl.nodeId}}"
166+
component-id="{{::$ctrl.componentId}}"
167+
component-state="{{ item.componentState }}"
168+
workgroup-id="::$ctrl.workgroupId">
169+
</multiple-choice-grading>
170+
<open-response-grading
171+
ng-if="item.componentState.componentType === 'OpenResponse'"
172+
node-id="{{::$ctrl.nodeId}}"
173+
component-id="{{::$ctrl.componentId}}"
174+
component-state="{{ item.componentState }}"
175+
workgroup-id="::$ctrl.workgroupId">
176+
</open-response-grading>
177+
<component-revisions-info
178+
node-id="::$ctrl.nodeId"
179+
component-id="::$ctrl.componentId"
180+
to-workgroup-id="::$ctrl.workgroupId"
181+
component-state="item.componentState"
182+
active='false'>
183+
</component-revisions-info>
184+
</div>
185+
<div flex="100" flex-gt-sm="33" class="component--grading__annotations">
186+
<component-grading node-id="::$ctrl.nodeId"
187+
component-id="::$ctrl.componentId"
188+
max-score="componentContent.maxScore"
189+
from-workgroup-id="::$ctrl.fromWorkgroupId"
190+
to-workgroup-id="$ctrl.workgroupId"
191+
component-state-id="item.componentState.id"
192+
show-all-annotations="true"
193+
is-disabled="true">
194+
</component-grading>
195+
</div>
196+
</div>
197+
<component ng-switch-default
198+
component-state="{{ item.componentState }}"
199+
workgroup-id="::$ctrl.workgroupId"
200+
mode="gradingRevision">
201+
</ng-content>
161202
</div>
162203
</div>
163204
</md-list-item>

src/main/webapp/wise5/classroomMonitor/classroomMonitorComponents/shared/workgroupNodeGrading/workgroupNodeGrading.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,24 @@ const WorkgroupNodeGrading = {
138138
</h3>
139139
<ng-content ng-switch="::component.type">
140140
{{latestComponentState = $ctrl.getLatestComponentStateByWorkgroupIdAndComponentId($ctrl.workgroupId, component.id); ""}}
141-
<div ng-switch-when="OpenResponse" class="component__content" layout="row" layout-wrap>
141+
<div ng-switch-when="MultipleChoice|OpenResponse" ng-switch-when-separator="|" class="component__content" layout="row" layout-wrap>
142142
<div flex="100" flex-gt-sm="66" layout="column" class="component--grading__response">
143+
<multiple-choice-grading
144+
ng-if="component.type === 'MultipleChoice'"
145+
node-id="{{::$ctrl.nodeId}}"
146+
component-id="{{::component.id}}"
147+
component-state="{{latestComponentState}}">
148+
</multiple-choice-grading>
143149
<open-response-grading
150+
ng-if="component.type === 'OpenResponse'"
144151
node-id="{{::$ctrl.nodeId}}"
145152
component-id="{{::component.id}}"
146153
component-state="{{latestComponentState}}">
147154
</open-response-grading>
148155
<span flex></span>
149156
<component-revisions-info node-id="::$ctrl.nodeId"
150157
component-id="::component.id"
158+
from-workgroup-id="::$ctrl.teacherWorkgroupId"
151159
to-workgroup-id="::$ctrl.workgroupId"
152160
component-state="latestComponentState"
153161
active='true'>
@@ -158,7 +166,7 @@ const WorkgroupNodeGrading = {
158166
component-id="::component.id"
159167
max-score="componentContent.maxScore"
160168
from-workgroup-id="::$ctrl.teacherWorkgroupId"
161-
to-workgroup-id="$ctrl.workgroupId"
169+
to-workgroup-id="::$ctrl.workgroupId"
162170
component-state-id="latestComponentState.id"
163171
show-all-annotations="false"
164172
is-disabled="false">

0 commit comments

Comments
 (0)