Skip to content

Commit

Permalink
Merge pull request #108 from renproject/fix/volume-data-all-time-issue
Browse files Browse the repository at this point in the history
add periodOption when calculating volume data
  • Loading branch information
jazg authored Dec 7, 2022
2 parents b9360af + 9508167 commit eb28c30
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/controllers/pages/networkStatsPage/DoughnutChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const DoughnutChart: React.FC<Props> = ({
() => getOptions(data, quoteCurrency),
[data, quoteCurrency],
);
console.log(options);

return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const NetworkStatsPage = () => {
TrackerVolumeType.Locked,
quoteCurrency,
tokenPrices,
volumePeriod,
).difference;
}, [allVolumeData, tokenPrices, quoteCurrency]);

Expand Down
2 changes: 2 additions & 0 deletions src/controllers/pages/networkStatsPage/VolumeData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ export const VolumeStats: React.FC<VolumeStatsProps> = ({
trackerChain,
quoteCurrency,
tokenPrices,
volumePeriod
);
}
return snapshotDataToAllChainVolumeData(
volumeData,
trackerType,
quoteCurrency,
tokenPrices,
volumePeriod
);
}
return fallback;
Expand Down
5 changes: 4 additions & 1 deletion src/lib/graphQL/queries/renVmTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export const snapshotDataToVolumeData = (
chain: TrackerChain,
currency: TokenAmountType | Currency,
tokenPrices: TokenPrices,
period: PeriodOption,
) => {
const snapshots = getSnapshots(data);
const { first, last } = getFirstAndLastSnapshot(snapshots);
Expand All @@ -411,7 +412,7 @@ export const snapshotDataToVolumeData = (
let difference = new BigNumber(0);
let differenceStandard = new BigNumber(0);
let differenceQuote = new BigNumber(0);
if (lastEntry && firstEntry) {
if (lastEntry && firstEntry && period !== PeriodOption.ALL) {
differenceQuote = new BigNumber(
getQuoteAmount(lastEntry, currency, assetsData, tokenPrices),
).minus(
Expand Down Expand Up @@ -508,6 +509,7 @@ export const snapshotDataToAllChainVolumeData = (
type: TrackerVolumeType,
currency: TokenAmountType | Currency,
tokenPrices: TokenPrices,
period: PeriodOption,
) => {
const assetsData = getAssetsData(data);
let sum = new BigNumber(0);
Expand All @@ -519,6 +521,7 @@ export const snapshotDataToAllChainVolumeData = (
chain,
currency,
tokenPrices,
period,
);
sum = sum.plus(difference);
records = mergeAmountRecords(assetsData, records, amountRecords);
Expand Down

0 comments on commit eb28c30

Please sign in to comment.