Skip to content

Commit 1caa081

Browse files
committed
Extracted the grading view from the Multiple Choice component. Also fixed student work timestamps in grading view. #2935
1 parent 43047de commit 1caa081

14 files changed

Lines changed: 439 additions & 213 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 & 2 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

@@ -61,8 +62,9 @@ class ComponentRevisionsInfoController {
6162

6263
if (latest) {
6364
// calculate the save time of the latest component state
64-
let serverSaveTime = Date.parse(latest.serverSaveTime);
65-
this.latestComponentStateTime = this.ConfigService.convertToClientTimestamp(serverSaveTime);
65+
this.latestComponentStateTime = this.ConfigService.convertToClientTimestamp(
66+
latest.serverSaveTime
67+
);
6668

6769
// check if the latest component state is a submit
6870
this.latestComponentStateIsSubmit = latest.isSubmit;
@@ -71,6 +73,7 @@ class ComponentRevisionsInfoController {
7173

7274
showRevisions($event) {
7375
let workgroupId = this.toWorkgroupId;
76+
let fromWorkgroupId = this.fromWorkgroupId;
7477
let componentId = this.componentId;
7578
let nodeId = this.nodeId;
7679
let usernames = this.usernames;
@@ -91,6 +94,8 @@ class ComponentRevisionsInfoController {
9194
<div class="md-dialog-content gray-lighter-bg">
9295
<workgroup-component-revisions component-states="componentStates"
9396
node-id="{{ nodeId }}"
97+
component-id="{{ componentId }}"
98+
from-workgroup-id="{{ fromWorkgroupId }}"
9499
workgroup-id="{{ workgroupId }}"></workgroup-component-revisions>
95100
</div>
96101
</md-dialog-content>
@@ -100,6 +105,7 @@ class ComponentRevisionsInfoController {
100105
</md-dialog>`,
101106
locals: {
102107
workgroupId: workgroupId,
108+
fromWorkgroupId: fromWorkgroupId,
103109
componentId: componentId,
104110
nodeId: nodeId,
105111
usernames: usernames,
@@ -111,12 +117,14 @@ class ComponentRevisionsInfoController {
111117
$scope,
112118
$mdDialog,
113119
workgroupId,
120+
fromWorkgroupId,
114121
componentId,
115122
nodeId,
116123
usernames,
117124
componentStates
118125
) {
119126
$scope.workgroupId = workgroupId;
127+
$scope.fromWorkgroupId = fromWorkgroupId;
120128
$scope.componentId = componentId;
121129
$scope.nodeId = nodeId;
122130
$scope.usernames = usernames;
@@ -129,6 +137,7 @@ class ComponentRevisionsInfoController {
129137
'$scope',
130138
'$mdDialog',
131139
'workgroupId',
140+
'fromWorkgroupId',
132141
'componentId',
133142
'nodeId',
134143
'usernames',
@@ -143,6 +152,7 @@ const ComponentRevisionsInfo = {
143152
componentId: '<',
144153
componentState: '<',
145154
nodeId: '<',
155+
fromWorkgroupId: '<',
146156
toWorkgroupId: '<'
147157
},
148158
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)