Skip to content

Commit

Permalink
Fix scheduled rewards rendering (#1825)
Browse files Browse the repository at this point in the history
* fix live scheduled rewards date comparison being time zone dependent

* fix scheduled rewards dropping off on payout
  • Loading branch information
juliangruber authored Sep 17, 2024
1 parent 9809dae commit 2999d94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions renderer/src/hooks/StationRewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ const useStationRewards = () => {
let todayRewards = rewards[rewards.length - 1]
if (
!todayRewards ||
new Date(todayRewards.timestamp).getDate() !== new Date().getDate() ||
new Date(todayRewards.timestamp).getMonth() !== new Date().getMonth() ||
new Date(todayRewards.timestamp).getFullYear() !== new Date().getFullYear()
Number(todayRewards.timestamp.split('T')[0].split('-')[2]) !== new Date().getDate() ||
Number(todayRewards.timestamp.split('T')[0].split('-')[1]) - 1 !== new Date().getMonth() ||
Number(todayRewards.timestamp.split('T')[0].split('-')[0]) !== new Date().getFullYear()
) {
todayRewards = {
timestamp: new Date().toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/pages/dashboard/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Chart = ({
getRewardValue(historicalRewards[index - 1].totalRewardsReceived, moduleId)
acc.scheduled.push(
isPayout
? getRewardValue(record.totalScheduledRewards, moduleId)
? getRewardValue(record.totalRewardsReceived, moduleId)
: getRewardValue(record.totalScheduledRewards, moduleId) +
getRewardValue(record.totalRewardsReceived, moduleId)
)
Expand Down

0 comments on commit 2999d94

Please sign in to comment.