Skip to content

Commit 49b0e31

Browse files
feat(Teacher Tools): Color ideas in rubric and detected ideas in student work (#2278)
Also adds a color key to the rubric.
1 parent c85c3dd commit 49b0e31

File tree

14 files changed

+70
-50
lines changed

14 files changed

+70
-50
lines changed

src/app/classroom-monitor/show-crater-rubric/show-crater-rubric.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ export class ShowCRaterRubricComponent {
2525
}
2626

2727
ngOnDestroy(): void {
28-
if (this.rubricEventService.getIsRubricOpen()) {
28+
if (this.rubricEventService.isRubricDisplayed()) {
2929
this.rubricDialog.close();
3030
}
3131
}
3232

3333
protected openIdeasRubric(): void {
34-
if (!this.rubricEventService.getIsRubricOpen()) {
34+
if (!this.rubricEventService.isRubricDisplayed()) {
3535
this.rubricDialog = this.dialog.open(CRaterRubricComponent, {
3636
panelClass: 'dialog-sm',
3737
position: { right: '0', bottom: '0' },

src/assets/wise5/classroomMonitor/classroomMonitorComponents/component-summary/component-summary.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { MilestoneReportButtonComponent } from '../milestone-report-button/miles
1010
import { PeerGroupButtonComponent } from '../peer-group-button/peer-group-button.component';
1111
import { ComponentCompletionComponent } from '../component-completion/component-completion.component';
1212
import { ComponentContent } from '../../../common/ComponentContent';
13-
import { IdeasSummaryComponent } from '../../../directives/teacher-summary-display/ideas-summary-display/ideas-summary.component';
13+
import { IdeasSummaryComponent } from '../../../directives/teacher-summary-display/ideas-summary/ideas-summary.component';
1414
import { MatchSummaryDisplayComponent } from '../../../directives/teacher-summary-display/match-summary-display/match-summary-display.component';
1515
import { MatCardModule } from '@angular/material/card';
1616
import { CRaterService } from '../../../services/cRaterService';

src/assets/wise5/components/common/cRater/CRaterIdea.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
export class CRaterIdea {
22
name: string;
33
detected?: boolean;
4+
color?: string;
45
characterOffsets: any[];
56
text?: string;
67
tags?: string[];
78

8-
constructor(name: string, detected?: boolean, text?: string, tags?: string[]) {
9+
constructor(name: string, detected?: boolean, text?: string, tags?: string[], color?: string) {
910
this.name = name;
1011
if (detected) {
1112
this.detected = detected;
@@ -16,5 +17,8 @@ export class CRaterIdea {
1617
if (tags) {
1718
this.tags = tags;
1819
}
20+
if (color) {
21+
this.color = color;
22+
}
1923
}
2024
}

src/assets/wise5/components/common/cRater/CRaterRubric.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,15 @@ export class CRaterRubric {
6161
!uniqueIdeas.some((uniqueIdea) => uniqueIdea.name === idea.name)
6262
)
6363
.forEach((idea) => {
64-
const cRaterIdea = new CRaterIdea(idea.name, true);
65-
const cRaterRubricIdea = this.getIdea(idea.name);
66-
cRaterIdea.text = cRaterRubricIdea?.text ?? idea.name;
67-
uniqueIdeas.push(cRaterIdea);
64+
uniqueIdeas.push(
65+
new CRaterIdea(
66+
idea.name,
67+
true,
68+
this.getIdeaDescriptionText(idea.name),
69+
[],
70+
this.getIdeaColor(idea.name)
71+
)
72+
);
6873
})
6974
);
7075
return uniqueIdeas;

src/assets/wise5/components/common/cRater/IdeaData.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ export type IdeaData = {
88
color?: string;
99
};
1010

11-
export function ideaDataToCRaterIdea(ideaData: IdeaData): CRaterIdea {
12-
return new CRaterIdea(ideaData.id, undefined, ideaData.text, ideaData.tags);
13-
}
14-
1511
export function cRaterIdeaToIdeaData(cRaterIdea: CRaterIdea): IdeaData {
1612
return { id: cRaterIdea.name, text: cRaterIdea.text, count: 0, tags: cRaterIdea.tags };
1713
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Injectable, signal } from '@angular/core';
1+
import { Injectable } from '@angular/core';
22

33
@Injectable({ providedIn: 'root' })
44
export class RubricEventService {
5-
private isRubricOpen: boolean;
5+
private rubricDisplayed: boolean;
66

7-
getIsRubricOpen(): boolean {
8-
return this.isRubricOpen;
7+
isRubricDisplayed(): boolean {
8+
return this.rubricDisplayed;
99
}
1010

11-
rubricToggled(): void {
12-
this.isRubricOpen = !this.isRubricOpen;
11+
toggleRubricDisplayed(): void {
12+
this.rubricDisplayed = !this.rubricDisplayed;
1313
}
1414
}

src/assets/wise5/components/common/cRater/crater-rubric/crater-rubric.component.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@ <h2 mat-dialog-title class="!flex items-center !py-1 !pe-1">
66
</button>
77
</h2>
88
<mat-dialog-content>
9-
@if (cRaterRubric.description && cRaterRubric.description !== '') {
10-
<p>{{ cRaterRubric.description }}</p>
9+
@if (rubric.description && rubric.description !== '') {
10+
<p>{{ rubric.description }}</p>
1111
}
12-
@if (cRaterRubric.ideas.length > 0) {
12+
@if (rubric.ideaColors) {
13+
<div class="flex flex-wrap items-center gap-2 mb-4">
14+
<span class="text-sm font-medium" i18n>Key:</span>
15+
@for (ideaColor of rubric.ideaColors; track ideaColor.colorValue) {
16+
<div class="py-0.5 px-1 rounded" [style.background-color]="ideaColor.colorValue">
17+
<span class="text-sm">{{ ideaColor.tags.join(', ') }}</span>
18+
</div>
19+
}
20+
</div>
21+
}
22+
@if (ideas.length > 0) {
1323
<table class="text-sm">
1424
<thead>
1525
<tr>
@@ -19,7 +29,7 @@ <h2 mat-dialog-title class="!flex items-center !py-1 !pe-1">
1929
</thead>
2030
<tbody>
2131
@for (idea of ideas; track idea.name) {
22-
<tr>
32+
<tr [style.background-color]="idea.color">
2333
<td>{{ idea.name }}</td>
2434
<td>{{ idea.text }}</td>
2535
</tr>

src/assets/wise5/components/common/cRater/crater-rubric/crater-rubric.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('LibraryProjectDetailsComponent', () => {
1717

1818
fixture = TestBed.createComponent(CRaterRubricComponent);
1919
component = fixture.componentInstance;
20-
component['cRaterRubric'] = new CRaterRubric();
20+
component['rubric'] = new CRaterRubric();
2121
fixture.detectChanges();
2222
});
2323

@@ -29,14 +29,14 @@ describe('LibraryProjectDetailsComponent', () => {
2929

3030
it('should show description if one exists', () => {
3131
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(0);
32-
component['cRaterRubric'].description = 'Test';
32+
component['rubric'].description = 'Test';
3333
fixture.detectChanges();
3434
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(1);
3535
});
3636

3737
it('should not show description if none exists', () => {
3838
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(0);
39-
component['cRaterRubric'].description = '';
39+
component['rubric'].description = '';
4040
fixture.detectChanges();
4141
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(0);
4242
});

src/assets/wise5/components/common/cRater/crater-rubric/crater-rubric.component.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, Inject } from '@angular/core';
22
import { CRaterIdea } from '../CRaterIdea';
3-
import { cRaterIdeaToIdeaData, ideaDataToCRaterIdea, sortIdeasById } from '../IdeaData';
3+
import { cRaterIdeaToIdeaData, IdeaData, sortIdeasById } from '../IdeaData';
44
import { CRaterRubric } from '../CRaterRubric';
55
import { MatIconModule } from '@angular/material/icon';
66
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
@@ -17,20 +17,21 @@ export class CRaterRubricComponent {
1717
protected ideas: CRaterIdea[];
1818

1919
constructor(
20-
@Inject(MAT_DIALOG_DATA) protected cRaterRubric: CRaterRubric,
20+
@Inject(MAT_DIALOG_DATA) protected rubric: CRaterRubric,
2121
private dialogRef: MatDialogRef<CRaterRubricComponent>,
2222
private rubricEventService: RubricEventService
2323
) {}
2424

2525
ngOnInit(): void {
26-
this.ideas = sortIdeasById(this.cRaterRubric.ideas.map(cRaterIdeaToIdeaData)).map(
27-
ideaDataToCRaterIdea
26+
this.ideas = sortIdeasById(this.rubric.ideas.map(cRaterIdeaToIdeaData)).map(
27+
(idea: IdeaData) =>
28+
new CRaterIdea(idea.id, undefined, idea.text, idea.tags, this.rubric.getIdeaColor(idea.id))
2829
);
29-
this.rubricEventService.rubricToggled();
30+
this.rubricEventService.toggleRubricDisplayed();
3031
}
3132

3233
ngOnDestroy(): void {
33-
this.rubricEventService.rubricToggled();
34+
this.rubricEventService.toggleRubricDisplayed();
3435
}
3536

3637
protected closeDialog(): void {

src/assets/wise5/components/dialogGuidance/detected-ideas/detected-ideas.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="secondary-text mb-2" i18n>Ideas detected:</div>
88
<div class="flex flex-row flex-wrap gap-1 items-center">
99
@for (idea of ideas; track idea.name) {
10-
<span class="idea app-bg-bg border border-gray-300">
10+
<span class="idea app-bg-bg border border-gray-300" [style.background-color]="idea.color">
1111
<b>{{ idea.name }}.</b>
1212
@if (idea.name !== idea.text) {
1313
{{ idea.text }}

0 commit comments

Comments
 (0)