Skip to content

Commit

Permalink
Created Milestone Grading View component. #18
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreykwan committed Mar 23, 2021
1 parent 0155464 commit c36e5b0
Show file tree
Hide file tree
Showing 6 changed files with 248 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,15 @@ const MilestoneDetails = {
</md-tab>
<md-tab label="{{ ::'studentWork' | translate }}" md-on-select="$ctrl.saveTabSelectedEvent('MilestoneStudentWorkTabSelected')">
<div class="milestone-details__section">
<node-grading-view node-id="$ctrl.milestone.nodeId"
milestone="$ctrl.milestone"></node-grading-view>
<milestone-grading-view milestone="$ctrl.milestone"></milestone-grading-view>
</div>
</md-tab>
</md-tabs>
</div>
<div ng-if="!$ctrl.milestone.generatedRecommendations && $ctrl.milestone.isReportAvailable"
class="milestone-details__section md-whiteframe-1dp">
<div class="milestone-details__header primary md-body-2 gray-lightest-bg">{{ ::'studentWork' | translate }}</div>
<node-grading-view node-id="$ctrl.milestone.nodeId"
milestone="$ctrl.milestone"></node-grading-view>
<milestone-grading-view milestone="$ctrl.milestone"></milestone-grading-view>
</div>
</section>
<section ng-if="!$ctrl.milestone.isReportAvailable"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<div class="l-constrained grading">
<md-list class="user-list">
<md-list-item class="md-whiteframe-1dp md-with-secondary list-item list-item--actions"
layout-wrap>
<div flex-xs="100" flex-sm="100">
<workgroup-select-autocomplete></workgroup-select-autocomplete>
</div>
<span flex hide-xs hide-sm></span>
<div class="md-secondary-container" flex-xs="100" flex-sm="100"
layout-column layout-align="center center">
<md-button aria-label="{{ ::'expandAllLabel' | translate }}"
class="button--small md-primary" ng-click="$ctrl.expandAll()">
{{ ::'expandAll' | translate }}
</md-button>
<md-button aria-label="{{ ::'collapseAllLabel' | translate }}"
class="button--small md-primary" ng-click="$ctrl.collapseAll()">
{{ ::'collapseAll' | translate }}
</md-button>
</div>
</md-list-item>
<md-list-item class="table--list__thead table--list__thead__th md-whiteframe-1dp">
<div class="md-list-item-text table--list__thead__tr" layout="row" flex>
<md-button class="table--list__thead__link" flex layout="row" layout-align="start center"
ng-click="$ctrl.setSort('team')" aria-label="{{::'sortByTeam' | translate}}">
<span translate="team"></span>
<md-icon ng-if="$ctrl.sort === 'team' || $ctrl.sort === '-team'"
class="text-light table--list__thead__sort" md-theme="default"
ng-class="{'table--list__thead__sort--reverse': $ctrl.sort === '-team'}">
arrow_drop_up
</md-icon>
</md-button>
<md-button class="table--list__thead__link" flex="30"
layout="row" layout-align="center center" ng-click="$ctrl.setSort('status')"
aria-label="{{::'sortByCompletion' | translate}}">
<span translate="status"></span>
<md-icon ng-if="$ctrl.sort === 'status' || $ctrl.sort === '-status'"
class="text-light table--list__thead__sort" md-theme="default"
ng-class="{'table--list__thead__sort--reverse': $ctrl.sort === '-status'}">
arrow_drop_up
</md-icon>
</md-button>
<md-button class="table--list__thead__link" flex="20" layout="row"
layout-align="center center" ng-click="$ctrl.setSort('score')"
aria-label="{{::'sortByScore' | translate}}">
<span translate="score"></span>
<md-icon ng-if="$ctrl.sort === 'score' || $ctrl.sort === '-score'"
class="text-light table--list__thead__sort" md-theme="default"
ng-class="{'table--list__thead__sort--reverse': $ctrl.sort === '-score'}">
arrow_drop_up
</md-icon>
</md-button>
</div>
</md-list-item>
<workgroup-item ng-repeat="workgroup in $ctrl.workgroupsById | toArray | orderBy:$ctrl.getOrderBy()"
ng-if="$ctrl.isWorkgroupShown(workgroup)"
expand="$ctrl.workVisibilityById[workgroup.$key]" max-score="$ctrl.maxScore"
show-score="true" node-id="$ctrl.nodeId"
component-id="$ctrl.componentId" workgroup-id="::workgroup.workgroupId"
workgroup-data="workgroup" hidden-components="$ctrl.hiddenComponents"
on-update-expand="$ctrl.onUpdateExpand(workgroupId, value)"
in-view="$ctrl.workgroupInView(workgroup.$key, $inview)"></workgroup-item>
</md-list>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import { Directive } from '@angular/core';
import { AnnotationService } from '../../../../services/annotationService';
import { ConfigService } from '../../../../services/configService';
import { MilestoneService } from '../../../../services/milestoneService';
import { NodeService } from '../../../../services/nodeService';
import { NotificationService } from '../../../../services/notificationService';
import { StudentStatusService } from '../../../../services/studentStatusService';
import { TeacherDataService } from '../../../../services/teacherDataService';
import { TeacherProjectService } from '../../../../services/teacherProjectService';
import { NodeGradingViewController } from '../../nodeGrading/nodeGradingView/nodeGradingView';

@Directive()
class MilestoneGradingViewController extends NodeGradingViewController {
milestone: any;
nodeId: string;
componentId: string;

constructor(
protected $filter: any,
protected AnnotationService: AnnotationService,
protected ConfigService: ConfigService,
protected MilestoneService: MilestoneService,
protected NodeService: NodeService,
protected NotificationService: NotificationService,
protected ProjectService: TeacherProjectService,
protected StudentStatusService: StudentStatusService,
protected TeacherDataService: TeacherDataService
) {
super(
$filter,
AnnotationService,
ConfigService,
MilestoneService,
NodeService,
NotificationService,
ProjectService,
StudentStatusService,
TeacherDataService
);
}

$onInit() {
this.nodeId = this.milestone.nodeId;
this.componentId = this.milestone.componentId;
this.maxScore = this.getMaxScore();
this.retrieveStudentData();
this.subscribeToEvents();
this.saveNodeGradingViewDisplayedEvent();
}

getScoreByWorkgroupId(workgroupId: number): number {
let score = null;
const latestScoreAnnotation = this.AnnotationService.getLatestScoreAnnotation(
this.nodeId,
this.componentId,
workgroupId
);
if (latestScoreAnnotation) {
score = this.AnnotationService.getScoreValueFromScoreAnnotation(latestScoreAnnotation);
}
return typeof score === 'number' ? score : -1;
}

expandAll(): void {
super.expandAll();
this.saveMilestoneStudentWorkExpandCollapseAllEvent('MilestoneStudentWorkExpandAllClicked');
}

collapseAll(): void {
super.collapseAll();
this.saveMilestoneStudentWorkExpandCollapseAllEvent('MilestoneStudentWorkCollapseAllClicked');
}

saveMilestoneStudentWorkExpandCollapseAllEvent(event) {
const context = 'ClassroomMonitor',
nodeId = null,
componentId = null,
componentType = null,
category = 'Navigation',
data = { milestoneId: this.milestone.id };
this.TeacherDataService.saveEvent(
context,
nodeId,
componentId,
componentType,
category,
event,
data
);
}

onUpdateExpand(workgroupId: number, isExpanded: boolean): void {
super.onUpdateExpand(workgroupId, isExpanded);
this.saveMilestoneWorkgroupItemViewedEvent(workgroupId, isExpanded);
}

saveMilestoneWorkgroupItemViewedEvent(workgroupId, isExpanded) {
let event = '';
if (isExpanded) {
event = 'MilestoneStudentWorkOpened';
} else {
event = 'MilestoneStudentWorkClosed';
}
const context = 'ClassroomMonitor',
nodeId = null,
componentId = null,
componentType = null,
category = 'Navigation',
data = { milestoneId: this.milestone.id, workgroupId: workgroupId };
this.TeacherDataService.saveEvent(
context,
nodeId,
componentId,
componentType,
category,
event,
data
);
}
}

const MilestoneGradingView = {
bindings: {
milestone: '<'
},
controller: MilestoneGradingViewController,
templateUrl:
'/assets/wise5/classroomMonitor/classroomMonitorComponents/milestones/milestoneGradingView/milestoneGradingView.html'
};

export default MilestoneGradingView;
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
'use strict';

import MilestoneDetails from './milestoneDetails/milestoneDetails';
import * as angular from 'angular';
import MilestoneDetails from './milestoneDetails/milestoneDetails';
import MilestoneGradingView from './milestoneGradingView/milestoneGradingView';

const Milestones = angular.module('milestones', []).component('milestoneDetails', MilestoneDetails);
const Milestones = angular
.module('milestones', [])
.component('milestoneDetails', MilestoneDetails)
.component('milestoneGradingView', MilestoneGradingView);

export default Milestones;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="l-constrained grading">
<div ng-if="!$ctrl.componentId" class="flex md-subhead content-head" layout="row"
<div class="flex md-subhead content-head" layout="row"
layout-align="center center" layout-align-gt-sm="start center" layout-wrap>
<div layout="row" layout-align="center center" layout-wrap flex-xs="100" flex-sm="100">
<div class="accent-1" layout="row" layout-align="center center">
Expand Down Expand Up @@ -72,7 +72,6 @@ <h2 class="content-head__item" ng-if="$ctrl.nodeHasWork">
arrow_drop_up
</md-icon>
</md-button>
<!--<div flex="20" layout="row" layout-align="center center">Time Spent</div>-->
<md-button class="table--list__thead__link" ng-if="$ctrl.nodeHasWork" flex="20" layout="row"
layout-align="center center" ng-click="$ctrl.setSort('score')"
aria-label="{{::'sortByScore' | translate}}">
Expand All @@ -89,7 +88,7 @@ <h2 class="content-head__item" ng-if="$ctrl.nodeHasWork">
ng-if="$ctrl.isWorkgroupShown(workgroup)"
expand="$ctrl.workVisibilityById[workgroup.$key]" max-score="$ctrl.maxScore"
show-score="$ctrl.nodeHasWork" node-id="$ctrl.nodeId"
component-id="$ctrl.componentId" workgroup-id="::workgroup.workgroupId"
workgroup-id="::workgroup.workgroupId"
workgroup-data="workgroup" hidden-components="$ctrl.hiddenComponents"
on-update-expand="$ctrl.onUpdateExpand(workgroupId, value)"
in-view="$ctrl.workgroupInView(workgroup.$key, $inview)"></workgroup-item>
Expand Down
Loading

0 comments on commit c36e5b0

Please sign in to comment.