use analysisElementMedusaProductIds from order product selected variant if it exists

This commit is contained in:
2025-09-09 01:16:23 +03:00
parent 596d0e9eee
commit fd94320295
2 changed files with 25 additions and 10 deletions

View File

@@ -566,7 +566,7 @@ async function syncPrivateMessage({
);
}
const { data: allOrderResponseElements} = await supabase
const { data: allOrderResponseElements } = await supabase
.schema('medreport')
.from('analysis_response_elements')
.select('*')
@@ -714,7 +714,12 @@ export async function getOrderedAnalysisIds({
throw new Error(`Got ${orderedPackagesProducts.length} ordered packages products, expected ${orderedPackageIds.length}`);
}
const ids = getAnalysisElementMedusaProductIds(orderedPackagesProducts);
const ids = getAnalysisElementMedusaProductIds(
orderedPackagesProducts.map(({ id, metadata }) => ({
metadata,
variant: orderedPackages.find(({ product }) => product?.id === id)?.variant,
})),
);
if (ids.length === 0) {
return [];
}
@@ -755,10 +760,10 @@ export async function createMedipostActionLog({
hasError = false,
}: {
action:
| 'send_order_to_medipost'
| 'sync_analysis_results_from_medipost'
| 'send_fake_analysis_results_to_medipost'
| 'send_analysis_results_to_medipost';
| 'send_order_to_medipost'
| 'sync_analysis_results_from_medipost'
| 'send_fake_analysis_results_to_medipost'
| 'send_analysis_results_to_medipost';
xml: string;
hasAnalysisResults?: boolean;
medusaOrderId?: string | null;