From 29b90f774497c201ff86ff8f7ae559f7f46d7ff1 Mon Sep 17 00:00:00 2001
From: Dima Rifai <dima.rifai@gmail.com>
Date: Thu, 13 Mar 2025 08:33:29 +0200
Subject: [PATCH] Issue #479 - Set granularity to daily

---
 pages/balanceHistory/[accountName].tsx | 55 +-------------------------
 1 file changed, 1 insertion(+), 54 deletions(-)

diff --git a/pages/balanceHistory/[accountName].tsx b/pages/balanceHistory/[accountName].tsx
index f00ae57d..634a6ad1 100644
--- a/pages/balanceHistory/[accountName].tsx
+++ b/pages/balanceHistory/[accountName].tsx
@@ -135,59 +135,6 @@ export default function BalanceHistory() {
     effectiveToBlock
   );
 
-  const getGranularityPeriod = () => {
-    if (paramsState.fromDate) {
-      const fromDate = new Date(paramsState.fromDate);
-      const now = new Date();
-      const diffInDays = Math.floor(
-        (Number(now) - Number(fromDate)) / (1000 * 60 * 60 * 24)
-      );
-
-      if (diffInDays > 90) {
-        // more than 3 months
-        return "monthly";
-      } else {
-        return "daily";
-      }
-    } else if (paramsState.rangeSelectKey == "lastTime") {
-      if (
-        paramsState.timeUnit === "hours" &&
-        paramsState.lastTime &&
-        paramsState.lastTime > 2160
-      ) {
-        // more than 3 months
-        return "monthly";
-      } else if (
-        paramsState.timeUnit === "days" &&
-        paramsState.lastTime &&
-        paramsState.lastTime > 90
-      ) {
-        // more than 3 months
-        return "monthly";
-      } else if (
-        paramsState.timeUnit === "weeks" &&
-        paramsState.lastTime &&
-        paramsState.lastTime > 16
-      ) {
-        // more than 3 months
-        return "monthly";
-      } else if (
-        paramsState.timeUnit === "months" &&
-        paramsState.lastTime &&
-        paramsState.lastTime > 48
-      ) {
-        // more than 4 months
-        return "yearly";
-      } else if (paramsState.timeUnit === "months") {
-        return "monthly";
-      } else {
-        return "daily";
-      }
-    } else {
-      return "daily";
-    }
-  };
-
   const {
     aggregatedAccountBalanceHistory: chartData,
     isAggregatedAccountBalanceHistoryLoading: isChartDataLoading,
@@ -195,7 +142,7 @@ export default function BalanceHistory() {
   } = useAggregatedBalanceHistory(
     accountNameFromRoute,
     paramsState.coinType,
-    getGranularityPeriod(),
+    'daily',
     "asc",
     effectiveFromBlock,
     effectiveToBlock
-- 
GitLab