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:
1 parent
4439e3b7b1
commit
75eb218558
8 files changed
+76
-34
No files matched your search
@@ -14,7 +14,7 @@ import { formatWeight, getTargetWeightForAge } from '../../utils/weight.ts';
|
||||
|
||||
interface DailyWeightProgressionChartProps {
|
||||
rows: ChickenWeight[];
|
||||
totalDays: number;
|
||||
docWeight: number;
|
||||
}
|
||||
|
||||
type ChartPoint = {
|
||||
@@ -27,7 +27,7 @@ type ChartPoint = {
|
||||
|
||||
const DailyWeightProgressionChart: React.FC<DailyWeightProgressionChartProps> = ({
|
||||
rows,
|
||||
totalDays,
|
||||
docWeight,
|
||||
}) => {
|
||||
const chartData = useMemo<ChartPoint[]>(
|
||||
() =>
|
||||
@@ -35,10 +35,10 @@ const DailyWeightProgressionChart: React.FC<DailyWeightProgressionChartProps> =
|
||||
day: row.age,
|
||||
date: row.date,
|
||||
actual: row.average_weight,
|
||||
target: getTargetWeightForAge(row.age, totalDays),
|
||||
target: getTargetWeightForAge(row.age, docWeight),
|
||||
chickenCount: row.chicken_count,
|
||||
})),
|
||||
[rows, totalDays]
|
||||
[rows, docWeight]
|
||||
);
|
||||
|
||||
const hasNoData = chartData.length === 0;
|
||||
|
||||
Reference in new issue
Block a user