fix doc weight to show real doc instead of forcing 35-51 range and also fixed bug target weight using total days as reference for target weight instead of doc weight

This commit is contained in:
Alberto-Audrix committed 2026-09-07 10:43:54 +07:00
1 parent 4439e3b7b1
commit 75eb218558
8 files changed
+76 -34

No files matched your search

+3 -3
View File
@@ -5,7 +5,7 @@ import { formatWeight, getTargetWeightForAge } from '../../utils/weight.ts';
interface DailyDetailPanelProps {
row: ChickenWeight | null;
totalDays: number;
docWeight: number;
}
const DetailCard: React.FC<{
@@ -29,7 +29,7 @@ const DetailCard: React.FC<{
</div>
);
const DailyDetailPanel: React.FC<DailyDetailPanelProps> = ({ row, totalDays }) => {
const DailyDetailPanel: React.FC<DailyDetailPanelProps> = ({ row, docWeight }) => {
if (!row) {
return (
<div className="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
@@ -44,7 +44,7 @@ const DailyDetailPanel: React.FC<DailyDetailPanelProps> = ({ row, totalDays }) =
);
}
const target = getTargetWeightForAge(row.age, totalDays);
const target = getTargetWeightForAge(row.age, docWeight);
const deviation = target != null && row.average_weight > 0 ? row.average_weight - target : null;
return (