Skip to content

Commit

Permalink
Merge pull request #68 from EyeSeeTea/fix/remove-ou-filter-for-popula…
Browse files Browse the repository at this point in the history
…ted-form

Fix/remove ou filter for populated form
  • Loading branch information
MiquelAdell authored Oct 23, 2024
2 parents 2525238 + 4499ed1 commit aca629b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/data/repositories/SurveyFormD2Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class SurveyD2Repository implements SurveyRepository {
if (eventId) {
if (isTrackerProgram(programId)) {
if (!orgUnitId) return Future.error(new Error("Survey not found"));
return this.getTrackerProgramById(eventId, programId, orgUnitId).flatMap(
return this.getTrackerProgramById(eventId, programId).flatMap(
trackedEntity => {
if (resp.programs[0] && trackedEntity) {
return Future.success(
Expand Down Expand Up @@ -350,16 +350,15 @@ export class SurveyD2Repository implements SurveyRepository {

private getTrackerProgramById(
trackedEntityId: Id,
programId: Id,
orgUnitId: Id
programId: Id
): FutureData<TrackedEntity | void> {
return apiToFuture(
this.api.tracker.trackedEntities.get({
fields: { attributes: true, enrollments: true, trackedEntity: true, orgUnit: true },
orgUnit: orgUnitId,
program: programId,
trackedEntity: trackedEntityId,
ouMode: "DESCENDANTS",
enrollmentEnrolledBefore: new Date().toISOString(),
})
).flatMap(resp => {
if (resp) return Future.success(resp.instances[0]);
Expand Down

0 comments on commit aca629b

Please sign in to comment.