IO-1273 Graceful error on job totals.
This commit is contained in:
@@ -34,7 +34,9 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
|
||||
let dailySales;
|
||||
if (!!jobsByDate[val]) {
|
||||
dailySales = jobsByDate[val].reduce((dayAcc, dayVal) => {
|
||||
return dayAcc.add(Dinero(dayVal.job_totals.totals.subtotal));
|
||||
return dayAcc.add(
|
||||
Dinero((dayVal.job_totals && dayVal.job_totals.totals.subtotal) || 0)
|
||||
);
|
||||
}, Dinero());
|
||||
} else {
|
||||
dailySales = Dinero();
|
||||
|
||||
@@ -13,7 +13,10 @@ export default function DashboardProjectedMonthlySales({ data, ...cardProps }) {
|
||||
const dollars =
|
||||
data.projected_monthly_sales &&
|
||||
data.projected_monthly_sales.reduce(
|
||||
(acc, val) => acc.add(Dinero(val.job_totals.totals.subtotal)),
|
||||
(acc, val) =>
|
||||
acc.add(
|
||||
Dinero(val.job_totals.totals && val.job_totals.totals.subtotal)
|
||||
),
|
||||
Dinero()
|
||||
);
|
||||
return (
|
||||
|
||||
@@ -14,7 +14,8 @@ export default function DashboardTotalProductionDollars({
|
||||
const dollars =
|
||||
data.production_jobs &&
|
||||
data.production_jobs.reduce(
|
||||
(acc, val) => acc.add(Dinero(val.job_totals.totals.subtotal)),
|
||||
(acc, val) =>
|
||||
acc.add(Dinero(val.job_totals && val.job_totals.totals.subtotal)),
|
||||
Dinero()
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user