Skip to content
Snippets Groups Projects
Commit 29b90f77 authored by Dima Rifai's avatar Dima Rifai
Browse files

Issue #479 - Set granularity to daily

parent 4ebff3b5
No related branches found
No related tags found
1 merge request!587Delrifai/#479 use aggregated balance api
Pipeline #117677 canceled
...@@ -135,59 +135,6 @@ export default function BalanceHistory() { ...@@ -135,59 +135,6 @@ export default function BalanceHistory() {
effectiveToBlock 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 { const {
aggregatedAccountBalanceHistory: chartData, aggregatedAccountBalanceHistory: chartData,
isAggregatedAccountBalanceHistoryLoading: isChartDataLoading, isAggregatedAccountBalanceHistoryLoading: isChartDataLoading,
...@@ -195,7 +142,7 @@ export default function BalanceHistory() { ...@@ -195,7 +142,7 @@ export default function BalanceHistory() {
} = useAggregatedBalanceHistory( } = useAggregatedBalanceHistory(
accountNameFromRoute, accountNameFromRoute,
paramsState.coinType, paramsState.coinType,
getGranularityPeriod(), 'daily',
"asc", "asc",
effectiveFromBlock, effectiveFromBlock,
effectiveToBlock effectiveToBlock
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment