From c27f595e675659845083ae13117351845c4a9279 Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Wed, 6 Nov 2024 22:06:57 +0530 Subject: [PATCH] partially revert c9343d5 to fix investigation issues (#9026) --- src/components/Facility/Investigations/Reports/index.tsx | 4 ++-- src/components/Facility/Investigations/Reports/utils.tsx | 7 ++++--- .../Facility/Investigations/ShowInvestigation.tsx | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/Facility/Investigations/Reports/index.tsx b/src/components/Facility/Investigations/Reports/index.tsx index 7cfd21f3ff..e711372da4 100644 --- a/src/components/Facility/Investigations/Reports/index.tsx +++ b/src/components/Facility/Investigations/Reports/index.tsx @@ -1,4 +1,4 @@ -import { chain } from "lodash-es"; +import _ from "lodash"; import { useCallback, useReducer, useState } from "react"; import { useTranslation } from "react-i18next"; @@ -179,7 +179,7 @@ const InvestigationReports = ({ id }: any) => { ), ); - const investigationList = chain(data) + const investigationList = _.chain(data) .flatMap((i) => i?.data?.results) .compact() .flatten() diff --git a/src/components/Facility/Investigations/Reports/utils.tsx b/src/components/Facility/Investigations/Reports/utils.tsx index d6f5966d63..073be54160 100644 --- a/src/components/Facility/Investigations/Reports/utils.tsx +++ b/src/components/Facility/Investigations/Reports/utils.tsx @@ -1,9 +1,10 @@ -import { chain, findIndex, memoize } from "lodash-es"; +import _ from "lodash"; +import { findIndex, memoize } from "lodash-es"; import { InvestigationResponse } from "@/components/Facility/Investigations/Reports/types"; export const transformData = memoize((data: InvestigationResponse) => { - const sessions = chain(data) + const sessions = _.chain(data) .map((value: any) => { return { ...value.session_object, @@ -14,7 +15,7 @@ export const transformData = memoize((data: InvestigationResponse) => { .uniqBy("session_external_id") .orderBy("session_created_date", "desc") .value(); - const groupByInvestigation = chain(data) + const groupByInvestigation = _.chain(data) .groupBy("investigation_object.external_id") .values() .value(); diff --git a/src/components/Facility/Investigations/ShowInvestigation.tsx b/src/components/Facility/Investigations/ShowInvestigation.tsx index 84d3f733c4..11e9b5cc0a 100644 --- a/src/components/Facility/Investigations/ShowInvestigation.tsx +++ b/src/components/Facility/Investigations/ShowInvestigation.tsx @@ -1,4 +1,5 @@ -import { chain, set } from "lodash-es"; +import _ from "lodash"; +import { set } from "lodash-es"; import { useCallback, useReducer } from "react"; import { useTranslation } from "react-i18next"; @@ -150,7 +151,7 @@ export default function ShowInvestigation(props: ShowInvestigationProps) { }; const handleUpdateCancel = useCallback(() => { - const changedValues = chain(state.initialValues) + const changedValues = _.chain(state.initialValues) .map((val: any, _key: string) => ({ id: val?.id, initialValue: val?.notes || val?.value || null,