Skip to content

Commit

Permalink
Merge branch 'develop' into issue-1513-multiple-languages-per-unit
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima committed Aug 5, 2024
2 parents f416c6d + 399f78c commit 6d2b1be
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { Component, Input } from '@angular/core';

@Component({
selector: 'workgroup-node-status',
standalone: true,
template: `<span class="md-body-2 block center {{ statusClass }}">{{ statusText }}</span>`
})
export class WorkgroupNodeStatusComponent {
@Input()
statusClass: string = 'text-secondary';

@Input()
statusText: string;
@Input() statusClass: string = 'text-secondary';
@Input() statusText: string;
}
4 changes: 2 additions & 2 deletions src/app/teacher/grading-common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { NavItemProgressComponent } from '../classroom-monitor/nav-item-progress
ComponentGradingModule,
IntersectionObserverModule,
StatusIconComponent,
StudentTeacherCommonModule
StudentTeacherCommonModule,
WorkgroupNodeStatusComponent
],
declarations: [
EditComponentAnnotationsComponent,
Expand All @@ -32,7 +33,6 @@ import { NavItemProgressComponent } from '../classroom-monitor/nav-item-progress
WorkgroupInfoComponent,
WorkgroupItemComponent,
WorkgroupNodeScoreComponent,
WorkgroupNodeStatusComponent,
WorkgroupSelectAutocompleteComponent
],
exports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
></workgroup-info>
</div>
<div *ngIf="locations.length == 1" fxFlex="30" fxLayout="row" fxLayoutAlign="center center">
<workgroup-node-status [statusText]="statusText" [statusClass]="statusClass">
</workgroup-node-status>
<workgroup-node-status [statusText]="statusText" [statusClass]="statusClass" />
</div>
<div
*ngIf="showScore && locations.length > 1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
></workgroup-info>
</div>
<div fxFlex="{{ showScore ? 30 : 20 }}" fxLayout="row" fxLayoutAlign="center center">
<workgroup-node-status [statusText]="statusText" [statusClass]="statusClass">
</workgroup-node-status>
<workgroup-node-status [statusText]="statusText" [statusClass]="statusClass" />
</div>
<div *ngIf="showScore" fxFlex="20" fxLayout="row" fxLayoutAlign="center center">
<workgroup-node-score [score]="score" [maxScore]="maxScore"></workgroup-node-score>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
/>
</div>
<div fxFlex="{{ showScore ? 30 : 20 }}" fxLayout="row" fxLayoutAlign="center center">
<workgroup-node-status [statusText]="statusText" [statusClass]="statusClass">
</workgroup-node-status>
<workgroup-node-status [statusText]="statusText" [statusClass]="statusClass" />
</div>
<div *ngIf="showScore" fxFlex="20" fxLayout="row" fxLayoutAlign="center center">
<workgroup-node-score [score]="score" [maxScore]="maxScore"></workgroup-node-score>
Expand Down
15 changes: 12 additions & 3 deletions src/assets/wise5/services/studentDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ export class StudentDataService extends DataService {
private componentDirtySource: Subject<boolean> = new Subject<boolean>();
public componentDirty$: Observable<any> = this.componentDirtySource.asObservable();
private componentSaveTriggeredSource: Subject<boolean> = new Subject<boolean>();
public componentSaveTriggered$: Observable<any> = this.componentSaveTriggeredSource.asObservable();
public componentSaveTriggered$: Observable<any> =
this.componentSaveTriggeredSource.asObservable();
private componentSubmitDirtySource: Subject<boolean> = new Subject<boolean>();
public componentSubmitDirty$: Observable<any> = this.componentSubmitDirtySource.asObservable();
private componentSubmitTriggeredSource: Subject<boolean> = new Subject<boolean>();
public componentSubmitTriggered$: Observable<any> = this.componentSubmitTriggeredSource.asObservable();
public componentSubmitTriggered$: Observable<any> =
this.componentSubmitTriggeredSource.asObservable();
private componentStudentDataSource: Subject<any> = new Subject<any>();
public componentStudentData$: Observable<any> = this.componentStudentDataSource.asObservable();
private dataRetrievedSource: Subject<any> = new Subject<any>();
public dataRetrieved$: Observable<any> = this.dataRetrievedSource.asObservable();
private studentWorkSavedToServerSource: Subject<any> = new Subject<any>();
public studentWorkSavedToServer$: Observable<any> = this.studentWorkSavedToServerSource.asObservable();
public studentWorkSavedToServer$: Observable<any> =
this.studentWorkSavedToServerSource.asObservable();
private navItemIsExpandedSource: Subject<any> = new Subject<any>();
public navItemIsExpanded$: Observable<any> = this.navItemIsExpandedSource.asObservable();
private nodeStatusesChangedSource: Subject<void> = new Subject<void>();
Expand Down Expand Up @@ -281,6 +284,12 @@ export class StudentDataService extends DataService {
return this.saveToServer(componentStates, events, annotations);
}

saveEvents(events: any): Promise<any> {
const componentStates = undefined;
const annotations = undefined;
return this.saveToServer(componentStates, events, annotations);
}

createNewEvent(nodeId, componentId, context, componentType, category, event, data) {
return {
nodeId: nodeId,
Expand Down
66 changes: 17 additions & 49 deletions src/assets/wise5/vle/node/node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,21 @@ export class NodeComponent implements OnInit {
})
);

this.studentDataService.currentNodeChanged$.subscribe(({ currentNode }) => {
this.node = this.projectService.getNode(currentNode.id);
this.nodeUnloaded(this.node.id);
if (this.node.isEvaluateTransitionLogicOn('exitNode')) {
this.nodeService.evaluateTransitionLogic();
}
this.initializeNode();
});
this.studentDataService.nodeStatusesChanged$.subscribe(() => {
this.updateComponentVisibility();
});
this.subscriptions.add(
this.studentDataService.currentNodeChanged$.subscribe(({ currentNode }) => {
this.node = this.projectService.getNode(currentNode.id);
if (this.node.isEvaluateTransitionLogicOn('exitNode')) {
this.nodeService.evaluateTransitionLogic();
}
this.initializeNode();
})
);

this.subscriptions.add(
this.studentDataService.nodeStatusesChanged$.subscribe(() => {
this.updateComponentVisibility();
})
);
}

initializeNode(): void {
Expand All @@ -164,29 +168,12 @@ export class NodeComponent implements OnInit {
this.nodeService.evaluateTransitionLogic();
}

const latestComponentState = this.studentDataService.getLatestComponentStateByNodeIdAndComponentId(
this.node.id
);
const latestComponentState =
this.studentDataService.getLatestComponentStateByNodeIdAndComponentId(this.node.id);
if (latestComponentState) {
this.latestComponentState = latestComponentState;
}

const componentId = null;
const componentType = null;
const category = 'Navigation';
const event = 'nodeEntered';
const eventData = {
nodeId: this.node.id
};
this.studentDataService.saveVLEEvent(
this.node.id,
componentId,
componentType,
category,
event,
eventData
);

if (this.configService.isPreview()) {
this.showRubric = this.node.rubric != null && this.node.rubric != '';
}
Expand Down Expand Up @@ -449,29 +436,10 @@ export class NodeComponent implements OnInit {
);
}

private nodeUnloaded(nodeId: string): void {
const componentId = null;
const componentType = null;
const category = 'Navigation';
const event = 'nodeExited';
const eventData = {
nodeId: nodeId
};
this.studentDataService.saveVLEEvent(
nodeId,
componentId,
componentType,
category,
event,
eventData
);
}

private registerExitListener(): void {
this.subscriptions.add(
this.sessionService.exit$.subscribe(() => {
this.stopAutoSaveInterval();
this.nodeUnloaded(this.node.id);
})
);
}
Expand Down
80 changes: 42 additions & 38 deletions src/assets/wise5/vle/vle.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export class VLEComponent implements AfterViewInit {
private wiseLinkService: WiseLinkService
) {}

@HostListener('window:beforeunload')
beforeUnload(): void {
this.saveNodeExitedEvent();
}

ngAfterViewInit(): void {
this.initializeVLEService.initialized$.subscribe((initialized: boolean) => {
if (initialized) {
Expand Down Expand Up @@ -106,6 +111,7 @@ export class VLEComponent implements AfterViewInit {
this.notebookConfig = this.notebookService.getNotebookConfig();
this.setLayoutState();
this.initializeSubscriptions();
this.saveNodeEnteredEvent();
}

ngOnDestroy() {
Expand Down Expand Up @@ -179,49 +185,17 @@ export class VLEComponent implements AfterViewInit {
this.subscriptions.add(
this.studentDataService.currentNodeChanged$.subscribe(({ previousNode }) => {
this.setCurrentNode();
let currentNodeId = this.currentNode.id;

const currentNodeId = this.currentNode.id;
this.studentDataService.updateStackHistory(currentNodeId);
this.nodeStatusService.setNodeIsVisited(currentNodeId);

let componentId, componentType, category, eventName, eventData, eventNodeId;
if (previousNode != null && this.projectService.isGroupNode(previousNode.id)) {
// going from group to node or group to group
componentId = null;
componentType = null;
category = 'Navigation';
eventName = 'nodeExited';
eventData = {
nodeId: previousNode.id
};
eventNodeId = previousNode.id;
this.studentDataService.saveVLEEvent(
eventNodeId,
componentId,
componentType,
category,
eventName,
eventData
);
const events = [];
if (previousNode != null) {
events.push(this.createNodeExitedEvent(previousNode.id));
}
events.push(this.createNodeEnteredEvent());
this.studentDataService.saveEvents(events);

if (this.projectService.isGroupNode(currentNodeId)) {
componentId = null;
componentType = null;
category = 'Navigation';
eventName = 'nodeEntered';
eventData = {
nodeId: currentNodeId
};
eventNodeId = currentNodeId;
this.studentDataService.saveVLEEvent(
eventNodeId,
componentId,
componentType,
category,
eventName,
eventData
);
} else {
this.scrollToTop();
}
Expand Down Expand Up @@ -401,4 +375,34 @@ export class VLEComponent implements AfterViewInit {
}
};
}

private saveNodeEnteredEvent(): void {
this.studentDataService.saveEvents([this.createNodeEnteredEvent()]);
}

private saveNodeExitedEvent(): void {
this.studentDataService.saveEvents([this.createNodeExitedEvent()]);
}

private createNodeEnteredEvent(): any {
return this.createNodeEvent('nodeEntered');
}

private createNodeExitedEvent(nodeId: string = this.currentNode.id): any {
return this.createNodeEvent('nodeExited', nodeId);
}

private createNodeEvent(eventName: string, nodeId: string = this.currentNode.id): any {
return this.studentDataService.createNewEvent(
nodeId,
null,
'VLE',
null,
'Navigation',
eventName,
{
nodeId: nodeId
}
);
}
}
16 changes: 8 additions & 8 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -9977,7 +9977,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/vle.component.ts</context>
<context context-type="linenumber">162</context>
<context context-type="linenumber">168</context>
</context-group>
</trans-unit>
<trans-unit id="537022937435161177" datatype="html">
Expand All @@ -9992,7 +9992,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/vle.component.ts</context>
<context context-type="linenumber">163</context>
<context context-type="linenumber">169</context>
</context-group>
</trans-unit>
<trans-unit id="3407061818321766940" datatype="html">
Expand Down Expand Up @@ -13815,14 +13815,14 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<source>Step <x id="INTERPOLATION" equiv-text="{{ getNodePosition(firstNodeId) }}"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/classroomMonitor/classroomMonitorComponents/milestones/milestone-workgroup-item/milestone-workgroup-item.component.html</context>
<context context-type="linenumber">73</context>
<context context-type="linenumber">72</context>
</context-group>
</trans-unit>
<trans-unit id="ac74039732320d9727aad59519cd7961c2decd08" datatype="html">
<source>Step <x id="INTERPOLATION" equiv-text="{{ getNodePosition(lastNodeId) }}"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/classroomMonitor/classroomMonitorComponents/milestones/milestone-workgroup-item/milestone-workgroup-item.component.html</context>
<context context-type="linenumber">95</context>
<context context-type="linenumber">94</context>
</context-group>
</trans-unit>
<trans-unit id="314850458480650903" datatype="html">
Expand Down Expand Up @@ -21796,28 +21796,28 @@ If this problem continues, let your teacher know and move on to the next activit
<source>Preview Student</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/services/studentDataService.ts</context>
<context context-type="linenumber">74</context>
<context context-type="linenumber">77</context>
</context-group>
</trans-unit>
<trans-unit id="1967824796880640028" datatype="html">
<source>StudentDataService.saveComponentEvent: component, category, event args must not be null</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/services/studentDataService.ts</context>
<context context-type="linenumber">241</context>
<context context-type="linenumber">244</context>
</context-group>
</trans-unit>
<trans-unit id="944638387659785956" datatype="html">
<source>StudentDataService.saveComponentEvent: nodeId, componentId, componentType must not be null</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/services/studentDataService.ts</context>
<context context-type="linenumber">251</context>
<context context-type="linenumber">254</context>
</context-group>
</trans-unit>
<trans-unit id="4924640921903672943" datatype="html">
<source>StudentDataService.saveVLEEvent: category and event args must not be null</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/services/studentDataService.ts</context>
<context context-type="linenumber">260</context>
<context context-type="linenumber">263</context>
</context-group>
</trans-unit>
<trans-unit id="3178064088723974543" datatype="html">
Expand Down

0 comments on commit 6d2b1be

Please sign in to comment.