-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bity reporting #40
Conversation
Use PAGE_SIZE constant Change inputAmount to a number
@@ -28,12 +29,12 @@ async function fetchBity (swapFuncParams: SwapFuncParams) { | |||
if (!swapFuncParams.useCache) { | |||
console.log('Fetching Bity from JSON...') | |||
} | |||
let diskCache = { txs: [] } | |||
let diskCache = { txs: [], offset: {lastCheckedMonth: queryMonth, lastCheckedYear: queryYear} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastCheckedMonth and lastCheckedYear can go directly into diskCache, no need for the offset object
@@ -91,9 +92,16 @@ async function fetchBity (swapFuncParams: SwapFuncParams) { | |||
newTransactions.push(ssTx) | |||
} | |||
|
|||
if (monthlyTxs.length < 100 && queryMonth === todayMonth && queryYear === todayYear) { | |||
if (monthlyTxs.length < PAGE_SIZE && queryMonth === todayMonth && queryYear === todayYear) { | |||
if (queryMonth === '1') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic belongs on line 116. You shouldnt assign the diskCache in the middle of your inner loop. Instead, do it before assigning diskCache into the out
object.
Also, you really should create addMonth/subMonth functions. This will clean up and make your inner loop much more readable.
No description provided.