diff --git a/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx b/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx index 4214935..69dfdf3 100644 --- a/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx +++ b/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx @@ -369,12 +369,12 @@ export default function FertilizerEditPage({ planId }: { planId?: number }) { const getPlanAvailableStock = (fertilizer: Fertilizer) => { const stock = getStockInfo(fertilizer); if (!stock) return null; - return getNumericValue(stock.available_stock) + (initialPlanTotals[fertilizer.id] ?? 0); + return getNumericValue(stock.available_stock); }; const getPlanShortage = (fertilizer: Fertilizer) => { const available = getPlanAvailableStock(fertilizer); if (available === null) return 0; - return Math.max(colTotal(fertilizer.id) - available, 0); + return available < 0 ? Math.abs(available) : 0; }; // ─── 保存(adjusted 優先、なければ calc 値を使用)