Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unrelated changes #2196

Merged
merged 34 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6f2432a
added test for adding unrelated note
TheSlimvReal Jan 23, 2024
821972a
`loadData` function returns result instead of initializing it and ren…
TheSlimvReal Jan 23, 2024
454d313
using same filter logic to initialize data and pass to entities table
TheSlimvReal Jan 23, 2024
c86df39
some code cleanups
TheSlimvReal Jan 23, 2024
b90f7a9
added related property for related notes
TheSlimvReal Jan 23, 2024
3fa13de
inferring related property
TheSlimvReal Jan 23, 2024
473d6b4
added multi property support
TheSlimvReal Jan 23, 2024
e5e4ebe
removed overwrites of `property`
TheSlimvReal Jan 23, 2024
c54ef74
using different approach to update table summary
TheSlimvReal Jan 23, 2024
5a61f1d
updated documentation
TheSlimvReal Jan 23, 2024
9e894dd
correctly setting showInactive toggle in child school overview
TheSlimvReal Jan 23, 2024
0dc0c09
using placeholder instead of new record factory
TheSlimvReal Jan 23, 2024
f030a6a
added todos
TheSlimvReal Jan 23, 2024
b392171
removed unnecessary sorts
TheSlimvReal Jan 24, 2024
4ada0ed
removed unnecessary data filter
TheSlimvReal Jan 24, 2024
4340bc0
not using properties in tests
TheSlimvReal Jan 24, 2024
cdfbfa6
generalized newRecordFactory
TheSlimvReal Jan 24, 2024
366f4c6
aligned new record factory names
TheSlimvReal Jan 24, 2024
48975c1
fixed color highlighting for child school overview
TheSlimvReal Jan 24, 2024
5a16564
small cleanups
TheSlimvReal Jan 24, 2024
2957df5
code cleanups
TheSlimvReal Jan 24, 2024
bbc96e9
Update src/app/core/entity-details/related-entities/related-entities.…
TheSlimvReal Jan 31, 2024
f5ccc48
Merge branch 'master' into fix_unrelated_changes
TheSlimvReal Feb 1, 2024
0e1c6c6
fixed setting of invalid properties
TheSlimvReal Feb 1, 2024
3ef41a2
Merge branch 'master' into fix_unrelated_changes
TheSlimvReal Feb 1, 2024
8791493
added option to set relation property
TheSlimvReal Feb 2, 2024
209e4aa
added fallback handling to Todos list if multiple related properties …
TheSlimvReal Feb 2, 2024
ada0e08
fixed tests
TheSlimvReal Feb 2, 2024
4fccb15
Merge branch 'master' into fix_unrelated_changes
sleidig Feb 2, 2024
1e6ca4e
remove AserComponent in favor of simple RelatedEntities
sleidig Feb 2, 2024
e58e78d
remove Health and BMI related components in favor of generic RelatedE…
sleidig Feb 2, 2024
c5d4248
Merge remote-tracking branch 'origin/master' into fix_unrelated_changes
sleidig Feb 2, 2024
25d2982
improved doc
TheSlimvReal Feb 5, 2024
51daedd
Merge branch 'master' into fix_unrelated_changes
TheSlimvReal Feb 5, 2024
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
Prev Previous commit
Next Next commit
aligned new record factory names
TheSlimvReal committed Jan 24, 2024
commit 366f4c656f8c6e01138b7ab434bee7d3e734d3cb
Original file line number Diff line number Diff line change
@@ -50,21 +50,21 @@ describe("NotesRelatedToEntityComponent", () => {
component.entity = entity;
component.filter = undefined;
await component.ngOnInit();
let note = component.generateNewRecordFactory()();
let note = component.createNewRecordFactory()();
expect(note.children).toEqual([entity.getId()]);

entity = new School();
component.entity = entity;
component.filter = undefined;
await component.ngOnInit();
note = component.generateNewRecordFactory()();
note = component.createNewRecordFactory()();
expect(note.schools).toEqual([entity.getId()]);

entity = new User();
component.entity = entity;
component.filter = undefined;
await component.ngOnInit();
note = component.generateNewRecordFactory()();
note = component.createNewRecordFactory()();
expect(note.relatedEntities).toEqual([entity.getId(true)]);

entity = new ChildSchoolRelation();
@@ -73,7 +73,7 @@ describe("NotesRelatedToEntityComponent", () => {
component.entity = entity;
component.filter = undefined;
await component.ngOnInit();
note = component.generateNewRecordFactory()();
note = component.createNewRecordFactory()();
expect(note.relatedEntities).toEqual([entity.getId(true)]);
expect(note.children).toEqual(["someChild"]);
expect(note.schools).toEqual(["someSchool"]);
@@ -110,7 +110,7 @@ describe("NotesRelatedToEntityComponent", () => {
component.entity = customEntity;
component.ngOnInit();

const newNote = component.generateNewRecordFactory()();
const newNote = component.createNewRecordFactory()();

expect(newNote.relatedEntities).toContain(customEntity.getId(true));
expect(newNote.relatedEntities).toContain(customEntity.links[0]);
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ export class NotesRelatedToEntityComponent extends RelatedEntitiesComponent<Note
* @param note note to get color for
*/
getColor = (note: Note) => note?.getColor();
newRecordFactory = this.generateNewRecordFactory();
newRecordFactory = this.createNewRecordFactory();

constructor(
private childrenService: ChildrenService,
@@ -69,7 +69,7 @@ export class NotesRelatedToEntityComponent extends RelatedEntitiesComponent<Note
return this.childrenService.getNotesRelatedTo(this.entity.getId(true));
}

generateNewRecordFactory() {
override createNewRecordFactory() {
return () => {
const newNote = super.createNewRecordFactory()();
//TODO: generalize this code - possibly by only using relatedEntities to link other records here? see #1501
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ describe("ChildSchoolOverviewComponent", () => {
component.entity = child;
await component.ngOnInit();

const newRelation = component.generateNewRecordFactory()();
const newRelation = component.createNewRecordFactory()();

expect(newRelation.childId).toEqual(child.getId());
expect(
@@ -87,7 +87,7 @@ describe("ChildSchoolOverviewComponent", () => {
component.entity = new School("testID");
await component.ngOnInit();

const newRelation = component.generateNewRecordFactory()();
const newRelation = component.createNewRecordFactory()();

expect(newRelation).toBeInstanceOf(ChildSchoolRelation);
expect(newRelation.schoolId).toBe("testID");
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
[records]="data"
[filter]="filter"
[customColumns]="_columns"
[newRecordFactory]="generateNewRecordFactory()"
[newRecordFactory]="createNewRecordFactory()"
[getBackgroundColor]="
hasCurrentlyActiveEntry && showInactive ? backgroundColorFn : undefined
"
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ describe("RelatedTimePeriodEntitiesComponent", () => {
component.entity = child;
await component.ngOnInit();

const newRelation = component.generateNewRecordFactory()();
const newRelation = component.createNewRecordFactory()();

expect(newRelation.childId).toEqual(child.getId());
});
@@ -114,7 +114,7 @@ describe("RelatedTimePeriodEntitiesComponent", () => {
component.entity = child;
await component.ngOnInit();

const newRelation = component.generateNewRecordFactory()();
const newRelation = component.createNewRecordFactory()();

expect(
moment(existingRelation.end)
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ export class RelatedTimePeriodEntitiesComponent<E extends TimePeriod>
}
}

generateNewRecordFactory() {
override createNewRecordFactory() {
return () => {
const newRelation = super.createNewRecordFactory()();