Skip to content

Commit

Permalink
fix: better detection of table updates (#2196)
Browse files Browse the repository at this point in the history
closes #2195

Co-authored-by: Sebastian <sebastian@aam-digital.com>
  • Loading branch information
TheSlimvReal and sleidig authored Feb 5, 2024
1 parent 9266e08 commit 142f68d
Show file tree
Hide file tree
Showing 38 changed files with 562 additions and 944 deletions.
7 changes: 4 additions & 3 deletions doc/compodoc_sources/concepts/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,13 @@ The component configuration requires another `"title"`, the `"component"` that s
"title": "Education",
"components": [
{
"title": "SchoolHistory",
"title": "School History",
"component": "PreviousSchools"
},
{
"title": "ASER Results",
"component": "Aser"
"title": "Literacy Test Results",
"component": "RelatedEntities",
"config": {}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class ActivitiesOverviewComponent
implements OnInit
{
entityCtr = RecurringActivity;
property = "linkedGroups";

titleColumn: FormFieldConfig = {
id: "title",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { EntitiesTableComponent } from "../../../core/common-components/entities
standalone: true,
})
export class AttendanceDetailsComponent {
@Input() entity: ActivityAttendance = new ActivityAttendance();
@Input() entity: ActivityAttendance;
@Input() forChild: string;
EventNote = EventNote;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ describe("AttendanceService", () => {

const childAttendingSchool = new ChildSchoolRelation();
childAttendingSchool.childId = "child attending school";
const mockQueryRelationsOf = spyOn(
const mockQueryRelations = spyOn(
TestBed.inject(ChildrenService),
"queryActiveRelationsOf",
).and.resolveTo([childAttendingSchool]);
Expand All @@ -298,10 +298,7 @@ describe("AttendanceService", () => {

const event = await service.createEventForActivity(activity, date);

expect(mockQueryRelationsOf).toHaveBeenCalledWith(
linkedSchool.getId(),
date,
);
expect(mockQueryRelations).toHaveBeenCalledWith(linkedSchool.getId(), date);
expect(event.children).toHaveSize(2);
expect(event.children).toContain(directlyAddedChild.getId());
expect(event.children).toContain(childAttendingSchool.childId);
Expand Down

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions src/app/child-dev-project/children/children-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,11 @@ export const childrenComponents: ComponentTuple[] = [
"./children-list/recent-attendance-blocks/recent-attendance-blocks.component"
).then((c) => c.RecentAttendanceBlocksComponent),
],
[
"Aser",
() =>
import("./aser/aser-component/aser.component").then(
(c) => c.AserComponent,
),
],
[
"ChildBlock",
() =>
import("./child-block/child-block.component").then(
(c) => c.ChildBlockComponent,
),
],
[
"ChildrenBmiDashboard",
() =>
import(
"./health-checkup/children-bmi-dashboard/children-bmi-dashboard.component"
).then((c) => c.ChildrenBmiDashboardComponent),
],
[
"BmiBlock",
() =>
import("./health-checkup/bmi-block/bmi-block.component").then(
(c) => c.BmiBlockComponent,
),
],
[
"HealthCheckup",
() =>
import(
"./health-checkup/health-checkup-component/health-checkup.component"
).then((c) => c.HealthCheckupComponent),
],
];
16 changes: 2 additions & 14 deletions src/app/child-dev-project/children/children.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Child } from "./model/child";
import { EntityMapperService } from "../../core/entity/entity-mapper/entity-mapper.service";
import { Note } from "../notes/model/note";
import { ChildSchoolRelation } from "./model/childSchoolRelation";
import { HealthCheck } from "./health-checkup/model/health-check";
import moment, { Moment } from "moment";
import { DatabaseIndexingService } from "../../core/entity/database-indexing/database-indexing.service";
import { Entity } from "../../core/entity/model/entity";
Expand Down Expand Up @@ -212,7 +211,7 @@ export class ChildrenService {
if (!Array.isArray(doc.children) || !doc.date) return;
if (doc.date.length === 10) {
emit(doc.date);
} else {
} else {
var d = new Date(doc.date || null);
emit(d.getFullYear() + "-" + String(d.getMonth()+1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0"));
}
Expand Down Expand Up @@ -240,7 +239,7 @@ export class ChildrenService {
var dString;
if (doc.date && doc.date.length === 10) {
dString = doc.date;
} else {
} else {
var d = new Date(doc.date || null);
dString = d.getFullYear() + "-" + String(d.getMonth()+1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0");
}
Expand All @@ -263,15 +262,4 @@ export class ChildrenService {
}`,
};
}

/**
*
* @param childId should be set in the specific components and is passed by the URL as a parameter
* This function should be considered refactored and should use a index, once they're made generic
*/
getHealthChecksOfChild(childId: string): Promise<HealthCheck[]> {
return this.entityMapper
.loadType(HealthCheck)
.then((res) => res.filter((h) => h.child === childId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import { Entity } from "../../../../core/entity/model/entity";
import { DatabaseEntity } from "../../../../core/entity/database-entity.decorator";
import { DatabaseField } from "../../../../core/entity/database-field.decorator";
import { ConfigurableEnumValue } from "../../../../core/basic-datatypes/configurable-enum/configurable-enum.interface";
import { EntityDatatype } from "../../../../core/basic-datatypes/entity/entity.datatype";
import { Child } from "../../model/child";
import { PLACEHOLDERS } from "../../../../core/entity/schema/entity-schema-field";

@DatabaseEntity("EducationalMaterial")
export class EducationalMaterial extends Entity {
Expand All @@ -28,14 +30,15 @@ export class EducationalMaterial extends Entity {
}

@DatabaseField({
dataType: "entity",
dataType: EntityDatatype.dataType,
additional: Child.ENTITY_TYPE,
entityReferenceRole: "composite",
})
child: string;

@DatabaseField({
label: $localize`:Date on which the material has been borrowed:Date`,
defaultValue: PLACEHOLDERS.NOW,
})
date: Date;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 142f68d

Please sign in to comment.