feat(MED-131): initial fix for analysis results table so result elements are shown correctly
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Fragment } from 'react';
|
||||
import { createI18nServerInstance } from '@/lib/i18n/i18n.server';
|
||||
import { withI18n } from '@/lib/i18n/with-i18n';
|
||||
|
||||
@@ -40,21 +41,25 @@ async function AnalysisResultsPage() {
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
{analysisList?.map((analysis, index) => (
|
||||
{analysisList?.map((analysis) => (
|
||||
<Fragment key={analysis.id}>
|
||||
{analysis.elements.map((element) => (
|
||||
<Analysis
|
||||
key={analysis.id}
|
||||
key={element.id}
|
||||
analysis={{
|
||||
name: analysis.element.analysis_name || '',
|
||||
status: analysis.element.norm_status as AnalysisStatus,
|
||||
unit: analysis.element.unit || '',
|
||||
value: analysis.element.response_value,
|
||||
normLowerIncluded: !!analysis.element.norm_lower_included,
|
||||
normUpperIncluded: !!analysis.element.norm_upper_included,
|
||||
normLower: analysis.element.norm_lower || 0,
|
||||
normUpper: analysis.element.norm_upper || 0,
|
||||
name: element.analysis_name || '',
|
||||
status: element.norm_status as AnalysisStatus,
|
||||
unit: element.unit || '',
|
||||
value: element.response_value,
|
||||
normLowerIncluded: !!element.norm_lower_included,
|
||||
normUpperIncluded: !!element.norm_upper_included,
|
||||
normLower: element.norm_lower || 0,
|
||||
normUpper: element.norm_upper || 0,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</PageBody>
|
||||
);
|
||||
|
||||
@@ -209,15 +209,10 @@ class AccountsApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
const elementMap = new Map(
|
||||
analysisResponseElements.map((e) => [e.analysis_response_id, e]),
|
||||
);
|
||||
|
||||
return analysisResponses
|
||||
.filter((r) => elementMap.has(r.id))
|
||||
.map((r) => ({
|
||||
...r,
|
||||
element: elementMap.get(r.id)!,
|
||||
elements: analysisResponseElements.filter((e) => e.analysis_response_id === r.id),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user