Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export class ShowCRaterRubricComponent {
}

ngOnDestroy(): void {
if (this.rubricEventService.getIsRubricOpen()) {
if (this.rubricEventService.isRubricDisplayed()) {
this.rubricDialog.close();
}
}

protected openIdeasRubric(): void {
if (!this.rubricEventService.getIsRubricOpen()) {
if (!this.rubricEventService.isRubricDisplayed()) {
this.rubricDialog = this.dialog.open(CRaterRubricComponent, {
panelClass: 'dialog-sm',
position: { right: '0', bottom: '0' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { MilestoneReportButtonComponent } from '../milestone-report-button/miles
import { PeerGroupButtonComponent } from '../peer-group-button/peer-group-button.component';
import { ComponentCompletionComponent } from '../component-completion/component-completion.component';
import { ComponentContent } from '../../../common/ComponentContent';
import { IdeasSummaryComponent } from '../../../directives/teacher-summary-display/ideas-summary-display/ideas-summary.component';
import { IdeasSummaryComponent } from '../../../directives/teacher-summary-display/ideas-summary/ideas-summary.component';
import { MatchSummaryDisplayComponent } from '../../../directives/teacher-summary-display/match-summary-display/match-summary-display.component';
import { MatCardModule } from '@angular/material/card';
import { CRaterService } from '../../../services/cRaterService';
Expand Down
6 changes: 5 additions & 1 deletion src/assets/wise5/components/common/cRater/CRaterIdea.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
export class CRaterIdea {
name: string;
detected?: boolean;
color?: string;
characterOffsets: any[];
text?: string;
tags?: string[];

constructor(name: string, detected?: boolean, text?: string, tags?: string[]) {
constructor(name: string, detected?: boolean, text?: string, tags?: string[], color?: string) {
this.name = name;
if (detected) {
this.detected = detected;
Expand All @@ -16,5 +17,8 @@ export class CRaterIdea {
if (tags) {
this.tags = tags;
}
if (color) {
this.color = color;
}
}
}
13 changes: 9 additions & 4 deletions src/assets/wise5/components/common/cRater/CRaterRubric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ export class CRaterRubric {
!uniqueIdeas.some((uniqueIdea) => uniqueIdea.name === idea.name)
)
.forEach((idea) => {
const cRaterIdea = new CRaterIdea(idea.name, true);
const cRaterRubricIdea = this.getIdea(idea.name);
cRaterIdea.text = cRaterRubricIdea?.text ?? idea.name;
uniqueIdeas.push(cRaterIdea);
uniqueIdeas.push(
new CRaterIdea(
idea.name,
true,
this.getIdeaDescriptionText(idea.name),
[],
this.getIdeaColor(idea.name)
)
);
})
);
return uniqueIdeas;
Expand Down
4 changes: 0 additions & 4 deletions src/assets/wise5/components/common/cRater/IdeaData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ export type IdeaData = {
color?: string;
};

export function ideaDataToCRaterIdea(ideaData: IdeaData): CRaterIdea {
return new CRaterIdea(ideaData.id, undefined, ideaData.text, ideaData.tags);
}

export function cRaterIdeaToIdeaData(cRaterIdea: CRaterIdea): IdeaData {
return { id: cRaterIdea.name, text: cRaterIdea.text, count: 0, tags: cRaterIdea.tags };
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Injectable, signal } from '@angular/core';
import { Injectable } from '@angular/core';

@Injectable({ providedIn: 'root' })
export class RubricEventService {
private isRubricOpen: boolean;
private rubricDisplayed: boolean;

getIsRubricOpen(): boolean {
return this.isRubricOpen;
isRubricDisplayed(): boolean {
return this.rubricDisplayed;
}

rubricToggled(): void {
this.isRubricOpen = !this.isRubricOpen;
toggleRubricDisplayed(): void {
this.rubricDisplayed = !this.rubricDisplayed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ <h2 mat-dialog-title class="!flex items-center !py-1 !pe-1">
</button>
</h2>
<mat-dialog-content>
@if (cRaterRubric.description && cRaterRubric.description !== '') {
<p>{{ cRaterRubric.description }}</p>
@if (rubric.description && rubric.description !== '') {
<p>{{ rubric.description }}</p>
}
@if (cRaterRubric.ideas.length > 0) {
@if (rubric.ideaColors) {
<div class="flex flex-wrap items-center gap-2 mb-4">
<span class="text-sm font-medium" i18n>Key:</span>
@for (ideaColor of rubric.ideaColors; track ideaColor.colorValue) {
<div class="py-0.5 px-1 rounded" [style.background-color]="ideaColor.colorValue">
<span class="text-sm">{{ ideaColor.tags.join(', ') }}</span>
</div>
}
</div>
}
@if (ideas.length > 0) {
<table class="text-sm">
<thead>
<tr>
Expand All @@ -19,7 +29,7 @@ <h2 mat-dialog-title class="!flex items-center !py-1 !pe-1">
</thead>
<tbody>
@for (idea of ideas; track idea.name) {
<tr>
<tr [style.background-color]="idea.color">
<td>{{ idea.name }}</td>
<td>{{ idea.text }}</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('LibraryProjectDetailsComponent', () => {

fixture = TestBed.createComponent(CRaterRubricComponent);
component = fixture.componentInstance;
component['cRaterRubric'] = new CRaterRubric();
component['rubric'] = new CRaterRubric();
fixture.detectChanges();
});

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

it('should show description if one exists', () => {
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(0);
component['cRaterRubric'].description = 'Test';
component['rubric'].description = 'Test';
fixture.detectChanges();
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(1);
});

it('should not show description if none exists', () => {
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(0);
component['cRaterRubric'].description = '';
component['rubric'].description = '';
fixture.detectChanges();
expect(fixture.nativeElement.querySelectorAll('p').length).toEqual(0);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Inject } from '@angular/core';
import { CRaterIdea } from '../CRaterIdea';
import { cRaterIdeaToIdeaData, ideaDataToCRaterIdea, sortIdeasById } from '../IdeaData';
import { cRaterIdeaToIdeaData, IdeaData, sortIdeasById } from '../IdeaData';
import { CRaterRubric } from '../CRaterRubric';
import { MatIconModule } from '@angular/material/icon';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
Expand All @@ -17,20 +17,21 @@ export class CRaterRubricComponent {
protected ideas: CRaterIdea[];

constructor(
@Inject(MAT_DIALOG_DATA) protected cRaterRubric: CRaterRubric,
@Inject(MAT_DIALOG_DATA) protected rubric: CRaterRubric,
private dialogRef: MatDialogRef<CRaterRubricComponent>,
private rubricEventService: RubricEventService
) {}

ngOnInit(): void {
this.ideas = sortIdeasById(this.cRaterRubric.ideas.map(cRaterIdeaToIdeaData)).map(
ideaDataToCRaterIdea
this.ideas = sortIdeasById(this.rubric.ideas.map(cRaterIdeaToIdeaData)).map(
(idea: IdeaData) =>
new CRaterIdea(idea.id, undefined, idea.text, idea.tags, this.rubric.getIdeaColor(idea.id))
);
this.rubricEventService.rubricToggled();
this.rubricEventService.toggleRubricDisplayed();
}

ngOnDestroy(): void {
this.rubricEventService.rubricToggled();
this.rubricEventService.toggleRubricDisplayed();
}

protected closeDialog(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="secondary-text mb-2" i18n>Ideas detected:</div>
<div class="flex flex-row flex-wrap gap-1 items-center">
@for (idea of ideas; track idea.name) {
<span class="idea app-bg-bg border border-gray-300">
<span class="idea app-bg-bg border border-gray-300" [style.background-color]="idea.color">
<b>{{ idea.name }}.</b>
@if (idea.name !== idea.text) {
{{ idea.text }}
Expand Down
40 changes: 22 additions & 18 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,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/components/common/cRater/crater-rubric/crater-rubric.component.html</context>
<context context-type="linenumber">17,21</context>
<context context-type="linenumber">27,31</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/common/feedbackRule/feedback-rule-help/feedback-rule-help.component.html</context>
Expand Down Expand Up @@ -11264,11 +11264,11 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<context context-type="linenumber">10,11</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">15,16</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">31,32</context>
</context-group>
</trans-unit>
Expand Down Expand Up @@ -15096,7 +15096,7 @@ Are you sure you want to proceed?</source>
<context context-type="linenumber">51,56</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">72,75</context>
</context-group>
<context-group purpose="location">
Expand Down Expand Up @@ -17074,21 +17074,21 @@ Are you ready to receive feedback on this answer?</source>
<source>Most Common</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/common/cRater/CRaterRubric.ts</context>
<context context-type="linenumber">78</context>
<context context-type="linenumber">83</context>
</context-group>
</trans-unit>
<trans-unit id="419421250444615914" datatype="html">
<source>Unique Ideas</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/common/cRater/CRaterRubric.ts</context>
<context context-type="linenumber">87</context>
<context context-type="linenumber">92</context>
</context-group>
</trans-unit>
<trans-unit id="786337790284911605" datatype="html">
<source>All Ideas</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/common/cRater/CRaterRubric.ts</context>
<context context-type="linenumber">97</context>
<context context-type="linenumber">102</context>
</context-group>
</trans-unit>
<trans-unit id="463092785656273861" datatype="html">
Expand All @@ -17112,11 +17112,22 @@ Are you ready to receive feedback on this answer?</source>
<context context-type="linenumber">4,9</context>
</context-group>
</trans-unit>
<trans-unit id="2426670095217837155" datatype="html">
<source>Key:</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/common/cRater/crater-rubric/crater-rubric.component.html</context>
<context context-type="linenumber">14,15</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">53,54</context>
</context-group>
</trans-unit>
<trans-unit id="8040881171107393560" datatype="html">
<source>ID</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/common/cRater/crater-rubric/crater-rubric.component.html</context>
<context context-type="linenumber">17,20</context>
<context context-type="linenumber">27,30</context>
</context-group>
</trans-unit>
<trans-unit id="5849203454479447363" datatype="html">
Expand Down Expand Up @@ -21921,21 +21932,14 @@ If this problem continues, let your teacher know and move on to the next activit
<trans-unit id="1563518905064973119" datatype="html">
<source>Student Ideas Detected</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">46,48</context>
</context-group>
</trans-unit>
<trans-unit id="2426670095217837155" datatype="html">
<source>Key:</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="linenumber">53,54</context>
</context-group>
</trans-unit>
<trans-unit id="3517550046701184661" datatype="html">
<source>Show less</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">70,72</context>
</context-group>
<context-group purpose="location">
Expand All @@ -21946,7 +21950,7 @@ If this problem continues, let your teacher know and move on to the next activit
<trans-unit id="4191006504398748947" datatype="html">
<source>Your students&apos; ideas will show up here as they are detected in the activity.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary-display/ideas-summary.component.html</context>
<context context-type="sourcefile">src/assets/wise5/directives/teacher-summary-display/ideas-summary/ideas-summary.component.html</context>
<context context-type="linenumber">75,77</context>
</context-group>
</trans-unit>
Expand Down
Loading