diff --git a/src/app/teacher/teacher-tools-routing.module.ts b/src/app/teacher/teacher-tools-routing.module.ts index c074e0a6155..3f465815a2f 100644 --- a/src/app/teacher/teacher-tools-routing.module.ts +++ b/src/app/teacher/teacher-tools-routing.module.ts @@ -14,6 +14,7 @@ import { MilestonesComponent } from '../classroom-monitor/milestones/milestones. import { ExportItemComponent } from '../../assets/wise5/classroomMonitor/dataExport/export-item/export-item.component'; import { ExportRawDataComponent } from '../../assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component'; import { ExportEventsComponent } from '../../assets/wise5/classroomMonitor/dataExport/export-events/export-events.component'; +import { ExportOneWorkgroupPerRowComponent } from '../../assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component'; const routes: Routes = [ { @@ -25,6 +26,7 @@ const routes: Routes = [ { path: 'export', component: DataExportComponent }, { path: 'export/item', component: ExportItemComponent }, { path: 'export/events', component: ExportEventsComponent }, + { path: 'export/one-workgroup-per-row', component: ExportOneWorkgroupPerRowComponent }, { path: 'export/raw', component: ExportRawDataComponent }, { path: 'export/visits', component: ExportStepVisitsComponent }, { path: 'manage-students', component: ManageStudentsComponent }, diff --git a/src/assets/wise5/classroomMonitor/dataExport/abstract-export.component.ts b/src/assets/wise5/classroomMonitor/dataExport/abstract-export.component.ts index 536442436de..e23cb427a2a 100644 --- a/src/assets/wise5/classroomMonitor/dataExport/abstract-export.component.ts +++ b/src/assets/wise5/classroomMonitor/dataExport/abstract-export.component.ts @@ -25,7 +25,7 @@ export abstract class AbstractExportComponent { public configService: ConfigService, public dataExportService: DataExportService, public dataService: TeacherDataService, - private dialog: MatDialog, + protected dialog: MatDialog, public projectService: TeacherProjectService, protected route: ActivatedRoute, protected router: Router diff --git a/src/assets/wise5/classroomMonitor/dataExport/data-export.module.ts b/src/assets/wise5/classroomMonitor/dataExport/data-export.module.ts index 2330a39dcc3..c3870a85a67 100644 --- a/src/assets/wise5/classroomMonitor/dataExport/data-export.module.ts +++ b/src/assets/wise5/classroomMonitor/dataExport/data-export.module.ts @@ -7,6 +7,7 @@ import { SelectStepAndComponentCheckboxesComponent } from './select-step-and-com import { ExportItemComponent } from './export-item/export-item.component'; import { ExportRawDataComponent } from './export-raw-data/export-raw-data.component'; import { ExportEventsComponent } from './export-events/export-events.component'; +import { ExportOneWorkgroupPerRowComponent } from './export-one-workgroup-per-row/export-one-workgroup-per-row.component'; @NgModule({ imports: [RouterModule, StudentTeacherCommonModule], @@ -14,6 +15,7 @@ import { ExportEventsComponent } from './export-events/export-events.component'; DataExportComponent, ExportEventsComponent, ExportItemComponent, + ExportOneWorkgroupPerRowComponent, ExportRawDataComponent, ExportStepVisitsComponent, SelectStepAndComponentCheckboxesComponent @@ -22,6 +24,7 @@ import { ExportEventsComponent } from './export-events/export-events.component'; DataExportComponent, ExportEventsComponent, ExportItemComponent, + ExportOneWorkgroupPerRowComponent, ExportRawDataComponent, ExportStepVisitsComponent, SelectStepAndComponentCheckboxesComponent diff --git a/src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html b/src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html index 8e7ff485ab7..05b323497ac 100644 --- a/src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html +++ b/src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html @@ -4,7 +4,7 @@
-
+

{{ exportTypeLabel }}

-
-
- - -
-
- - Include Student Work - -
-
- - Include Student Work IDs - -
-
- - Include Student Names - -
-
- - Include Student Work Timestamps - -
-
- - Include Branch Path Taken - -
-
- - Include Branch Path Taken Node ID - -
-
- - Include Branch Path Taken Step Title - -
-
- - Include Scores - -
-
- - Include Score Timestamps - -
-
- - Include Comments - -
-
- - Include Comment Timestamps - -
-
+ +
Export Gradebook
+
+ + Include Student Work + +
+
+ + Include Student Work IDs + +
+
+ + Include Student Names + +
+
+ + Include Student Work Timestamps + +
+
+ + Include Branch Path Taken + +
+
+ + Include Branch Path Taken Node ID + +
+
+ + Include Branch Path Taken Step Title + +
+
+ Include Scores +
+
+ + Include Score Timestamps + +
+
+ + Include Comments + +
+
+ + Include Comment Timestamps + +
+ +
+ +
+
diff --git a/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.scss b/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.scss new file mode 100644 index 00000000000..99677ad276d --- /dev/null +++ b/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.scss @@ -0,0 +1,3 @@ +.mat-icon { + margin: 0px; +} diff --git a/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.spec.ts b/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.spec.ts new file mode 100644 index 00000000000..081d83c22d1 --- /dev/null +++ b/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.spec.ts @@ -0,0 +1,59 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { DataExportService } from '../../../services/dataExportService'; +import { ClassroomMonitorTestingModule } from '../../classroom-monitor-testing.module'; +import { RouterTestingModule } from '@angular/router/testing'; +import { MatIconModule } from '@angular/material/icon'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { DataExportModule } from '../data-export.module'; +import { TeacherProjectService } from '../../../services/teacherProjectService'; +import { ConfigService } from '../../../services/configService'; +import { ExportOneWorkgroupPerRowComponent } from './export-one-workgroup-per-row.component'; + +let configService: ConfigService; +let teacherProjectService: TeacherProjectService; + +describe('ExportOneWorkgroupPerRowComponent', () => { + let component: ExportOneWorkgroupPerRowComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ExportOneWorkgroupPerRowComponent], + imports: [ + ClassroomMonitorTestingModule, + DataExportModule, + HttpClientTestingModule, + MatCheckboxModule, + MatIconModule, + RouterTestingModule + ], + providers: [DataExportService] + }); + fixture = TestBed.createComponent(ExportOneWorkgroupPerRowComponent); + component = fixture.componentInstance; + configService = TestBed.inject(ConfigService); + spyOn(configService, 'getPermissions').and.returnValue({ + canAuthorProject: true, + canGradeStudentWork: true, + canViewStudentNames: true + }); + teacherProjectService = TestBed.inject(TeacherProjectService); + spyOn(teacherProjectService, 'getNodeOrderOfProject').and.returnValue({ + idToOrder: {}, + nodes: [] + }); + teacherProjectService.project = { + nodes: [], + inactiveNodes: [], + metadata: { + title: 'Test Project' + } + }; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.ts b/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.ts new file mode 100644 index 00000000000..9a93d07bcf3 --- /dev/null +++ b/src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.ts @@ -0,0 +1,61 @@ +import { Component } from '@angular/core'; +import { AbstractExportComponent } from '../abstract-export.component'; +import { OneWorkgroupPerRowDataExportStrategy } from '../strategies/OneWorkgroupPerRowDataExportStrategy'; +import { MatDialog } from '@angular/material/dialog'; +import { ActivatedRoute, Router } from '@angular/router'; +import { AnnotationService } from '../../../services/annotationService'; +import { ComponentServiceLookupService } from '../../../services/componentServiceLookupService'; +import { ConfigService } from '../../../services/configService'; +import { DataExportService } from '../../../services/dataExportService'; +import { TeacherDataService } from '../../../services/teacherDataService'; +import { TeacherProjectService } from '../../../services/teacherProjectService'; + +@Component({ + selector: 'export-one-workgroup-per-row', + templateUrl: './export-one-workgroup-per-row.component.html', + styleUrls: ['./export-one-workgroup-per-row.component.scss'] +}) +export class ExportOneWorkgroupPerRowComponent extends AbstractExportComponent { + protected includeBranchPathTaken: boolean; + protected includeBranchPathTakenNodeId: boolean; + protected includeBranchPathTakenStepTitle: boolean; + protected includeComments: boolean; + protected includeCommentTimestamps: boolean; + protected includeScores: boolean; + protected includeScoreTimestamps: boolean; + protected includeStudentNames: boolean; + protected includeStudentWork: boolean; + protected includeStudentWorkIds: boolean; + protected includeStudentWorkTimestamps: boolean; + + constructor( + public annotationService: AnnotationService, + public componentServiceLookupService: ComponentServiceLookupService, + public configService: ConfigService, + public dataExportService: DataExportService, + public dataService: TeacherDataService, + protected dialog: MatDialog, + public projectService: TeacherProjectService, + protected route: ActivatedRoute, + protected router: Router + ) { + super( + annotationService, + configService, + dataExportService, + dataService, + dialog, + projectService, + route, + router + ); + } + + protected export(): void { + this.showDownloadingExportMessage(); + const strategy = new OneWorkgroupPerRowDataExportStrategy(); + strategy.setDataExportContext({ controller: this } as any); + strategy.export(); + this.hideDownloadingExportMessage(); + } +} diff --git a/src/assets/wise5/classroomMonitor/dataExport/strategies/AbstractDataExportStrategy.ts b/src/assets/wise5/classroomMonitor/dataExport/strategies/AbstractDataExportStrategy.ts index d36d41659e1..617012a6241 100644 --- a/src/assets/wise5/classroomMonitor/dataExport/strategies/AbstractDataExportStrategy.ts +++ b/src/assets/wise5/classroomMonitor/dataExport/strategies/AbstractDataExportStrategy.ts @@ -4,7 +4,6 @@ import { ConfigService } from '../../../services/configService'; import { DataExportService } from '../../../services/dataExportService'; import { TeacherDataService } from '../../../services/teacherDataService'; import { TeacherProjectService } from '../../../services/teacherProjectService'; -import { DataExportComponent } from '../data-export/data-export.component'; import { DataExportContext } from '../DataExportContext'; import { DataExportStrategy } from './DataExportStrategy'; import { removeHTMLTags } from '../../../common/string/string'; @@ -12,7 +11,7 @@ import { generateCSVFile } from '../../../common/csv/csv'; export abstract class AbstractDataExportStrategy implements DataExportStrategy { context: DataExportContext; - controller: DataExportComponent; + controller: any; annotationService: AnnotationService; configService: ConfigService; dataExportService: DataExportService; @@ -123,6 +122,33 @@ export abstract class AbstractDataExportStrategy implements DataExportStrategy { headerRow.push(columnName); } + /** + * Check if a component is selected + * @param selectedNodesMap a map of node id and component id strings + * to true + * example + * { + * "node1-38fj20egrj": true, + * "node1-20dbj2e0sf": true + * } + * @param nodeId the node id to check + * @param componentId the component id to check + * @return whether the component is selected + */ + isComponentSelected(selectedNodesMap: any, nodeId: string, componentId: string): boolean { + var result = false; + if (selectedNodesMap != null) { + if ( + nodeId != null && + componentId != null && + selectedNodesMap[nodeId + '-' + componentId] == true + ) { + result = true; + } + } + return result; + } + /** * Get the plain text representation of the student work. * @param componentState {object} A component state that contains the student work. diff --git a/src/assets/wise5/classroomMonitor/dataExport/strategies/OneWorkgroupPerRowDataExportStrategy.ts b/src/assets/wise5/classroomMonitor/dataExport/strategies/OneWorkgroupPerRowDataExportStrategy.ts index 759f9a788e7..fd8334206ab 100644 --- a/src/assets/wise5/classroomMonitor/dataExport/strategies/OneWorkgroupPerRowDataExportStrategy.ts +++ b/src/assets/wise5/classroomMonitor/dataExport/strategies/OneWorkgroupPerRowDataExportStrategy.ts @@ -196,7 +196,7 @@ export class OneWorkgroupPerRowDataExportStrategy extends AbstractDataExportStra } } } - if (this.controller.exportNode(selectedNodesMap, nodeId)) { + if (this.exportNode(selectedNodesMap, nodeId)) { if (this.projectService.isBranchPoint(nodeId)) { var toNodeId = null; var stepTitle = null; @@ -244,7 +244,7 @@ export class OneWorkgroupPerRowDataExportStrategy extends AbstractDataExportStra rows.push(workgroupRow); } var fileName = runId + '_one_workgroup_per_row.csv'; - this.controller.generateCSVFile(rows, fileName); + this.generateCSVFile(rows, fileName); this.controller.hideDownloadingExportMessage(); }); } @@ -259,8 +259,7 @@ export class OneWorkgroupPerRowDataExportStrategy extends AbstractDataExportStra */ private exportComponent(selectedNodesMap, nodeId, componentId) { return ( - selectedNodesMap == null || - this.controller.isComponentSelected(selectedNodesMap, nodeId, componentId) + selectedNodesMap == null || this.isComponentSelected(selectedNodesMap, nodeId, componentId) ); } @@ -311,7 +310,7 @@ export class OneWorkgroupPerRowDataExportStrategy extends AbstractDataExportStra } } } - if (this.controller.exportNode(selectedNodesMap, nodeId)) { + if (this.exportNode(selectedNodesMap, nodeId)) { if (this.projectService.isBranchPoint(nodeId)) { if (this.controller.includeBranchPathTakenNodeId) { columnIds.push(nodeId + '-branchPathTakenNodeId'); @@ -329,6 +328,43 @@ export class OneWorkgroupPerRowDataExportStrategy extends AbstractDataExportStra return columnIds; } + /** + * Check if we want to export this node + * @param selectedNodesMap a mapping of node id to boolean value of whether + * the researcher has checked the node + * @param nodeId the node id + * @return whether the node was checked + */ + exportNode(selectedNodesMap: any, nodeId: string): boolean { + if (selectedNodesMap == null || this.isNodeSelected(selectedNodesMap, nodeId)) { + return true; + } else { + return false; + } + } + + /** + * Check if a component is selected + * @param selectedNodesMap a map of node id to true + * example + * { + * "node1": true, + * "node2": true + * } + * @param nodeId the node id to check + * @param componentId the component id to check + * @return whether the node is selected + */ + isNodeSelected(selectedNodesMap: any, nodeId: string): boolean { + var result = false; + if (selectedNodesMap != null) { + if (nodeId != null && selectedNodesMap[nodeId] == true) { + result = true; + } + } + return result; + } + /** * Get the top rows in the One Workgroup Per Row export * @param columnIds an array of column ids diff --git a/src/assets/wise5/classroomMonitor/dataExport/strategies/StudentWorkDataExportStrategy.ts b/src/assets/wise5/classroomMonitor/dataExport/strategies/StudentWorkDataExportStrategy.ts index f7b1c0dc629..06fca4fc851 100644 --- a/src/assets/wise5/classroomMonitor/dataExport/strategies/StudentWorkDataExportStrategy.ts +++ b/src/assets/wise5/classroomMonitor/dataExport/strategies/StudentWorkDataExportStrategy.ts @@ -109,7 +109,7 @@ export class StudentWorkDataExportStrategy extends AbstractDataExportStrategy { var exportRow = true; if (this.controller.exportStepSelectionType === 'exportSelectSteps') { if ( - !this.controller.isComponentSelected( + !this.isComponentSelected( selectedNodesMap, componentState.nodeId, componentState.componentId diff --git a/src/messages.xlf b/src/messages.xlf index 27390cff6b8..a5fefe8ae19 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -525,11 +525,11 @@ src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 212 + 145 src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 231 + 164 src/assets/wise5/common/node-icon-chooser-dialog/node-icon-chooser-dialog.component.html @@ -1448,6 +1448,10 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.src/assets/wise5/classroomMonitor/dataExport/export-item/export-item.component.html 111 + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 6 + src/assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component.html 6 @@ -14008,7 +14012,7 @@ Are you sure you want to proceed? src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.ts - 421 + 322 src/assets/wise5/classroomMonitor/dataExport/export-item/export-item.component.ts @@ -14177,121 +14181,26 @@ Are you sure you want to proceed? 121,123 - - Default - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 136 - - - src/assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component.html - 15 - - - - Everything - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 137 - - - src/assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component.html - 16 - - - - Include Student Work - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 140,142 - - - - Include Student Work IDs - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 145,147 - - - - Include Student Names - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 150,152 - - - - Include Student Work Timestamps - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 155,157 - - - - Include Branch Path Taken - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 160,162 - - - - Include Branch Path Taken Node ID - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 165,167 - - - - Include Branch Path Taken Step Title - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 170,172 - - - - Include Scores - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 175,177 - - - - Include Score Timestamps - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 180,182 - - - - Include Comments - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 185,187 - - - - Include Comment Timestamps - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 190,192 - - Include Student Names src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 201,203 + 134,136 Export src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 206 + 139 src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 225 + 158 + + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 72 src/assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component.html @@ -14310,61 +14219,54 @@ Are you sure you want to proceed? Export src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 206,208 + 139,141 src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 225,227 + 158,160 Cancel src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 215,217 + 148,150 src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html - 234,236 + 167,169 Correctness column key: 0 = Incorrect, 1 = Correct, 2 = Correct bucket but wrong position src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.ts - 101 + 90 src/assets/wise5/classroomMonitor/dataExport/export-item/export-item.component.ts 41 - - One Workgroup Per Row - - src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.ts - 124 - - Latest Student Work src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.ts - 126 + 113 All Student Work src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.ts - 128 + 115 Events src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.ts - 130 + 117 @@ -14441,6 +14343,104 @@ Are you sure you want to proceed? 98 + + Export Gradebook + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 12 + + + + Include Student Work + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 14,16 + + + + Include Student Work IDs + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 19,21 + + + + Include Student Names + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 24,26 + + + + Include Student Work Timestamps + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 29,31 + + + + Include Branch Path Taken + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 34,36 + + + + Include Branch Path Taken Node ID + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 39,41 + + + + Include Branch Path Taken Step Title + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 44,46 + + + + Include Scores + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 49 + + + + Include Score Timestamps + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 52,54 + + + + Include Comments + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 57,59 + + + + Include Comment Timestamps + + src/assets/wise5/classroomMonitor/dataExport/export-one-workgroup-per-row/export-one-workgroup-per-row.component.html + 62,64 + + + + Default + + src/assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component.html + 15 + + + + Everything + + src/assets/wise5/classroomMonitor/dataExport/export-raw-data/export-raw-data.component.html + 16 + + Include Student Work