Skip to content
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

Merged
merged 2 commits into from
Apr 30, 2020
Merged

Add bity reporting #40

merged 2 commits into from
Apr 30, 2020

Conversation

peachbits
Copy link
Contributor

No description provided.

src/bity.js Outdated Show resolved Hide resolved
src/bity.js Outdated Show resolved Hide resolved
src/bity.js Show resolved Hide resolved
src/bity.js Outdated Show resolved Hide resolved
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} }
Copy link
Member

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') {
Copy link
Member

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.

@paullinator paullinator merged commit 409b6c0 into master Apr 30, 2020
@paullinator paullinator deleted the matthew/addBityReporting branch April 30, 2020 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants