Skip to content

Commit

Permalink
avniproject/avni-client#1289 | Filter embedded objects while returnin…
Browse files Browse the repository at this point in the history
…g entities loaded from server
  • Loading branch information
1t5j0y committed Feb 7, 2024
1 parent bd8c578 commit cac36ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/EntityMetaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ import SubjectProgramEligibility from "./program/SubjectProgramEligibility";
import MenuItem from "./application/MenuItem";
import UserSubjectAssignment from "./assignment/UserSubjectAssignment";
import DashboardFilter from "./reports/DashboardFilter";
import KeyValue from "./application/KeyValue";
import Observation from "./Observation";
import Format from "./application/Format";
import StringKeyNumericValue from "./application/StringKeyNumericValue";
import ChecklistItemStatus from "./ChecklistItemStatus";
import Point from "./geo/Point";

const refData = (clazz, {
res,
Expand Down Expand Up @@ -502,7 +508,11 @@ class EntityMetaData {
}

static entitiesLoadedFromServer() {
return _.differenceBy(EntityMappingConfig.getInstance().getEntities(), [Settings, LocaleMapping], "schema.name");
return _.differenceBy(EntityMappingConfig.getInstance().getEntities(), [Settings, LocaleMapping].concat(EntityMetaData.embeddedEntities()), "schema.name");
}

static embeddedEntities() {
return [KeyValue, Observation, Format, StringKeyNumericValue, ChecklistItemStatus, Point];
}

static findByName(entityName) {
Expand Down
1 change: 1 addition & 0 deletions test/EntitiesMetaDataTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('EntitiesMetaDataTest', () => {
it('entitiesLoadedFromServer', () => {
var entitiesLoadedFromServer = EntityMetaData.entitiesLoadedFromServer();
assert.notIncludeMembers(entitiesLoadedFromServer, [Settings, Individual]);
assert.notIncludeMembers(entitiesLoadedFromServer, EntityMetaData.embeddedEntities());
});

describe('model', function () {
Expand Down

0 comments on commit cac36ce

Please sign in to comment.