Skip to content

Commit

Permalink
fix: typescript fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Jan 30, 2025
1 parent 7bd802d commit d141fea
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
39 changes: 35 additions & 4 deletions src/data/repositories/testRepositories/SurveyFormTestRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,48 @@ export class SurveyTestRepository implements SurveyRepository {
}
getSurveyById(eventId: string): FutureData<D2TrackerEvent> {
if (eventId) {
//@ts-ignore
return Future.success({
event: "123",
orgUnit: "OU1",
program: "1234",
status: "ACTIVE",
occurredAt: new Date().toISOString().split("T")?.at(0) || "",
//@ts-ignore
programStage: "",
enrollment: "",
enrollmentStatus: "ACTIVE",
orgUnitName: "",
scheduledAt: "",
storedBy: " ",
followup: false,
deleted: false,
createdAt: "",
updatedAt: "",
createdBy: {
uid: "123",
name: "John Doe",
username: "",
firstName: "",
surname: "",
},
attributeOptionCombo: "",
attributeCategoryOptions: "",
updatedBy: {
uid: "123",
name: "John Doe",
username: "",
firstName: "",
surname: "",
},
notes: [],
dataValues: [
{ dataElement: "de1", value: "0" },
{ dataElement: "de2", value: "abc" },
{
dataElement: "de1",
value: "0",
providedElsewhere: false,
updatedAt: "",
storedBy: "",
createdAt: "",
},
],
});
} else {
Expand Down
1 change: 0 additions & 1 deletion src/data/utils/surveyChildCountHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const getEventSurveyCount = (
secondaryParentId: Id | undefined,
api: D2Api
): FutureData<number> => {
// const ouId = programId === PPS_COUNTRY_QUESTIONNAIRE_ID ? "" : orgUnitId;
const ouMode =
programId === PPS_HOSPITAL_FORM_ID || programId === PPS_COUNTRY_QUESTIONNAIRE_ID
? "DESCENDANTS"
Expand Down
14 changes: 8 additions & 6 deletions src/data/utils/surveyListMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,18 @@ export const mapTrackedEntityToSurvey = (
surveyType: "",
},
//TO DO : Fix for upgrade
// startDate: trackedEntityInstance.createdAt
// ? new Date(trackedEntityInstance.createdAt)
// : undefined,
startDate: undefined,
//@ts-ignore
startDate: trackedEntityInstance.enrollments[0]?.createdAt
? //@ts-ignore
new Date(trackedEntityInstance.enrollments[0].createdAt)
: undefined,

status: "ACTIVE",
assignedOrgUnit: {
id: trackedEntityInstance.orgUnit ?? "",
//TO DO : Fix for upgrade
// name: trackedEntityInstance.enrollments?.[0]?.orgUnitName ?? "",
name: "",
//@ts-ignore
name: trackedEntityInstance.enrollments?.[0]?.orgUnitName ?? "",
},
surveyType: "",
parentWardRegisterId: parentWardId,
Expand Down

0 comments on commit d141fea

Please sign in to comment.