mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-355): Guard HPP total calculation for empty data
This commit is contained in:
@@ -477,7 +477,10 @@ const HppPerKandangTab = () => {
|
|||||||
// ===== TABLE COLUMNS DEFINITION =====
|
// ===== TABLE COLUMNS DEFINITION =====
|
||||||
const totals: Totals = useMemo(() => {
|
const totals: Totals = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
total_hpp_rp: data.reduce((acc, item) => acc + (item.hpp_rp || 0), 0),
|
total_hpp_rp:
|
||||||
|
data.length > 0
|
||||||
|
? data.reduce((acc, item) => acc + (item.hpp_rp || 0), 0)
|
||||||
|
: 0,
|
||||||
total_average_doc_price_rp:
|
total_average_doc_price_rp:
|
||||||
data.length > 0
|
data.length > 0
|
||||||
? data.reduce(
|
? data.reduce(
|
||||||
|
|||||||
Reference in New Issue
Block a user