fixing an issue with the break evens where if the bushel price or yield target were not set it would try to divide by 0 and get infinity, now it will just display 0 if not set

This commit is contained in:
csawatzky 2026-02-10 16:58:20 -06:00
parent 85568e6ce5
commit af90e8893c

View file

@ -58,25 +58,25 @@ export default function HarvestPlanDisplay(props: Props) {
<Grid container direction="column">
<Grid className={classes.dark}>
<Box style={{ display: "flex", justifyContent: "space-between" }}>
<Typography variant="subtitle1">Break Even Yield:</Typography>
<Typography variant="subtitle1">Break Even Yield (acre):</Typography>
<Typography variant="subtitle1">
{(
{plan.bushelPrice() !== 0 ? (
(plan.totalEquipmentCost() + plan.totalMaterialCost()) /
plan.bushelPrice()
).toFixed(2)}{" "}
).toFixed(2) : 0}{" "}
BU
</Typography>
</Box>
</Grid>
<Grid className={classes.light}>
<Box style={{ display: "flex", justifyContent: "space-between" }}>
<Typography variant="subtitle1">Break Even Sales Price</Typography>
<Typography variant="subtitle1">Break Even Sales Price (BU):</Typography>
<Typography variant="subtitle1">
$
{(
{plan.yieldTarget() !== 0 ? (
(plan.totalEquipmentCost() + plan.totalMaterialCost()) /
plan.yieldTarget()
).toFixed(2)}
).toFixed(2) : 0}
</Typography>
</Box>
</Grid>