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
4 changes: 4 additions & 0 deletions src/assets/wise5/components/common/cRater/CRaterRubric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export class CRaterRubric {
getIdea(ideaId: string): CRaterIdea {
return this.ideas.find((idea) => idea.name === ideaId);
}

hasRubricData(): boolean {
return (this.description ?? '') !== '' || this.ideas.length > 0;
}
}

export function getUniqueIdeas(responses: any[], rubric: CRaterRubric): CRaterIdea[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ <h2 mat-dialog-title class="!flex items-center !py-1 !pe-1">
@if (cRaterRubric.description && cRaterRubric.description !== '') {
<p>{{ cRaterRubric.description }}</p>
}
<table class="text-sm">
<thead>
<tr>
<th i18n>ID</th>
<th i18n>Description</th>
</tr>
</thead>
<tbody>
@for (idea of ideas; track idea.name) {
@if (cRaterRubric.ideas.length > 0) {
<table class="text-sm">
<thead>
<tr>
<td>{{ idea.name }}</td>
<td>{{ idea.text }}</td>
<th i18n>ID</th>
<th i18n>Description</th>
</tr>
}
</tbody>
</table>
</thead>
<tbody>
@for (idea of ideas; track idea.name) {
<tr>
<td>{{ idea.name }}</td>
<td>{{ idea.text }}</td>
</tr>
}
</tbody>
</table>
}
</mat-dialog-content>
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ describe('LibraryProjectDetailsComponent', () => {
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});

it('should close dialog when X is clicked', () => {
closeDialogSpy = spyOn(component['dialogRef'], 'close');
fixture.nativeElement.querySelector('button').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class CRaterRubricComponent {
this.ideas = this.ideasSortingService
.sortById(this.cRaterRubric.ideas.map(cRaterIdeaToIdeaData))
.map(ideaDataToCRaterIdea);
this.rubricEventService.rubricToggled();
}

ngOnDestroy(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('DialogGuidanceShowWorkComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(DialogGuidanceShowWorkComponent);
component = fixture.componentInstance;
spyOn(TestBed.inject(CRaterService), 'getCRaterRubric').and.returnValue({} as CRaterRubric);
spyOn(TestBed.inject(CRaterService), 'getCRaterRubric').and.returnValue(new CRaterRubric());
component.componentState = {
studentData: {}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if (showDetectedIdeas) {
@if (showDetectedIdeas && hasRubricData) {
<div class="flex items-center justify-end">
<mat-icon class="mat-18" color="primary">auto_awesome</mat-icon>&nbsp;<a
tabindex="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CRaterRubricComponent } from '../../common/cRater/crater-rubric/crater-
import { DetectedIdeasComponent } from '../detected-ideas/detected-ideas.component';
import { DialogResponse } from '../DialogResponse';
import { DialogResponseComponent } from '../dialog-response/dialog-response.component';
import { MatDialog } from '@angular/material/dialog';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { RubricEventService } from '../../common/cRater/crater-rubric/RubricEventService';

Expand All @@ -25,25 +25,36 @@ import { RubricEventService } from '../../common/cRater/crater-rubric/RubricEven
export class DialogResponsesComponent {
@Input() computerAvatar: ComputerAvatar;
@Input() cRaterRubric: CRaterRubric;
protected hasRubricData: boolean;
@Input() isWaitingForComputerResponse: boolean;
@Input() responses: DialogResponse[] = [];
private rubricDialog: MatDialogRef<CRaterRubricComponent>;
@Input() showDetectedIdeas: boolean = false;

constructor(
protected dialog: MatDialog,
protected rubricEventService: RubricEventService
) {}

ngOnInit(): void {
this.hasRubricData = this.cRaterRubric?.hasRubricData() ?? false;
}

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

protected openIdeasRubric(): void {
if (!this.rubricEventService.getIsRubricOpen()) {
this.dialog.open(CRaterRubricComponent, {
this.rubricDialog = this.dialog.open(CRaterRubricComponent, {
panelClass: 'dialog-sm',
position: { right: '0', bottom: '0' },
hasBackdrop: false,
data: this.cRaterRubric,
autoFocus: false
});
this.rubricEventService.rubricToggled();
}
}
}
4 changes: 2 additions & 2 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,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">16,20</context>
<context context-type="linenumber">17,21</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 @@ -16627,7 +16627,7 @@ Are you ready to receive feedback on this answer?</source>
<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">16,19</context>
<context context-type="linenumber">17,20</context>
</context-group>
</trans-unit>
<trans-unit id="1859914769947265531" datatype="html">
Expand Down