From 122b69c7311b3bc16652de9b1bd9a91aed6dcda7 Mon Sep 17 00:00:00 2001 From: Romulus21 Date: Fri, 6 Mar 2026 12:15:15 +0100 Subject: [PATCH] restore years total --- .../js/components/rainfall/YearRainfaill.tsx | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/resources/js/components/rainfall/YearRainfaill.tsx b/resources/js/components/rainfall/YearRainfaill.tsx index 3bd7a6e..54452ea 100644 --- a/resources/js/components/rainfall/YearRainfaill.tsx +++ b/resources/js/components/rainfall/YearRainfaill.tsx @@ -46,23 +46,23 @@ const YearRainfall: FC = ({loadedAt}) => { {months.find(m => m.year === ((new Date).getFullYear() - 1) && m.month === Number(month))?.values} )} - {/**/} - {/* Total*/} - {/* {Object.entries(data).at(0).at(1).map(i => i.year)*/} - {/* .sort((a,b) => b > a)*/} - {/* .map(year => */} - {/* {Object.entries(data).reduce((acc, item) => {*/} - {/* console.log(item.at(1), year)*/} - {/* item.at(1).forEach(month => {*/} - {/* console.log(month)*/} - {/* if(month.year === year) {*/} - {/* acc += month.values*/} - {/* }*/} - {/* })*/} - {/* return acc*/} - {/* }, 0)}*/} - {/* )}*/} - {/**/} + + Total + {Object.entries(data).at(0)?.at(1).map(i => i.year) + .sort((a,b) => b > a) + .map(year => + {Object.entries(data).reduce((acc, item) => { + console.log(item.at(1), year) + item.at(1).forEach(month => { + console.log(month) + if(month.year === year) { + acc += month.values + } + }) + return acc + }, 0)} + )} +