diff --git a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html index 098480b5b9..a0a126ea6a 100644 --- a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html +++ b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.html @@ -6,9 +6,9 @@
- + - Total: {{ totalSummary }}
+ Total: {{ summary }}
Average: {{ avgSummary }}
diff --git a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.spec.ts b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.spec.ts index 1a3885cce7..2e8e639b56 100644 --- a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.spec.ts +++ b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.spec.ts @@ -6,9 +6,8 @@ import { MockedTestingModule } from "../../../../utils/mocked-testing.module"; import { EducationalMaterial } from "../model/educational-material"; import { ConfigurableEnumValue } from "../../../../core/basic-datatypes/configurable-enum/configurable-enum.interface"; import { EntityMapperService } from "../../../../core/entity/entity-mapper/entity-mapper.service"; -import { of, Subject } from "rxjs"; +import { Subject } from "rxjs"; import { UpdatedEntity } from "../../../../core/entity/model/entity-update"; -import { ActivatedRoute } from "@angular/router"; describe("EducationalMaterialComponent", () => { let component: EducationalMaterialComponent; @@ -27,33 +26,7 @@ describe("EducationalMaterialComponent", () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [EducationalMaterialComponent, MockedTestingModule.withState()], - providers: [ - { - provide: ActivatedRoute, - useValue: { - data: of({ - config: { - entity: "Child", - panels: [ - { - title: "Educational Materials", - summary: [ - { - Total: "Total", - }, - { - Average: "Average", - }, - ], - }, - ], - }, - }), - }, - }, - ], }).compileComponents(); - const entityMapper = TestBed.inject(EntityMapperService); spyOn(entityMapper, "receiveUpdates").and.returnValue(updates); })); @@ -123,18 +96,6 @@ describe("EducationalMaterialComponent", () => { expect(newRecord.child).toBe(child.getId()); }); - it("produces an empty summary when there are no records", () => { - component.records = []; - component.updateSummary(); - expect(component.summary).toHaveSize(0); - }); - - it("should set summaryTitle based on panel title", () => { - setRecordsAndGenerateSummary([{ Total: "Total" }, { Average: "Average" }]) - component.getSummaryList(); - expect(component.summaryTitle).toEqual([{ Total: "Total" }, { Average: "Average" }]); - }); - it("should update the summary when entity updates are received", async () => { const update1 = EducationalMaterial.create({ child: child.getId(), diff --git a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts index 668efa2d8a..729fca4d34 100644 --- a/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts +++ b/src/app/child-dev-project/children/educational-material/educational-material-component/educational-material.component.ts @@ -29,10 +29,10 @@ import { ActivatedRoute } from "@angular/router"; standalone: true, }) export class EducationalMaterialComponent implements OnInit { - @Input() summary: any[]; + @Input() summaries: any[]; @Input() entity: Child; records: EducationalMaterial[] = []; - totalSummary = ""; + summary = ""; avgSummary = ""; listConfig: EntityListConfig; @@ -115,7 +115,7 @@ export class EducationalMaterialComponent implements OnInit { return `${label}: ${avg}`; }); - this.totalSummary = summaryArray.join(", "); + this.summary = summaryArray.join(", "); this.avgSummary = avgSummaryArray.join(", "); } } diff --git a/src/app/core/config/config-fix.ts b/src/app/core/config/config-fix.ts index 3c9d8b4df8..6be1cd34c3 100644 --- a/src/app/core/config/config-fix.ts +++ b/src/app/core/config/config-fix.ts @@ -714,7 +714,7 @@ export const defaultJsonConfig = { "title": "", "component": "EducationalMaterial", "config": { - "summary": [ + "summaries": [ { "type": "boolean", total: true, average: true