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

Paul/paginate caching #184

Merged
merged 0 commits into from
Mar 13, 2024
Merged

Paul/paginate caching #184

merged 0 commits into from
Mar 13, 2024

Conversation

paullinator
Copy link
Member

@paullinator paullinator commented Feb 12, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

@paullinator paullinator force-pushed the paul/paginateCaching branch 2 times, most recently from 94a452a to 9e03bd8 Compare February 19, 2024 23:45
app.appId,
appAndPartnerId,
timePeriod
'hour,day,month'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if TIME_PERIODS.join(',')?

src/util.ts Outdated
Comment on lines 97 to 124
export const getStartOfMonthsAgo = (
dateString: string,
months: number
): Date => {
const date = new Date(dateString)
const result: Date = new Date(
Date.UTC(date.getUTCFullYear(), date.getUTCMonth() - months, 1)
)
return result
}

export const getStartOfMonthsFromNow = (
dateString: string,
months: number
): Date => {
const date = new Date(dateString)
const year = date.getUTCFullYear()
const month = date.getUTCMonth()
return new Date(Date.UTC(year, month + months, 1, 0, 0, 0, 0))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why in one function do you have more args to Date.UTC and why not keep consistent with the pattern of inlining getUTCFullYear/getUTCMonth calls?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because I created getStartOfMonthsAgo as a copy from elsewhere in the code, and when I created getStartOfMonthsFromNow, I didn't like the difficulty reading the args inline so I broke them out. Just never changed getStartOfMonthsAgo

Comment on lines 24 to 27
const birthdayStart = getStartOfMonthsAgo(
new Date('2017-01Z').toISOString(),
0
).toISOString()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're using this 2017 date commonly as a epoch birthday of some kind that we start querying from or back to... Maybe it would make sense to move these constants to a file of all the various types of these dates (string, ms timestamp, second timestamps, date object, etc), and then we can comment on the reasoning behind this 2017 date. That'd be helpful for documentation purpose and re-use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of, but I do change the date for different plugins since I don't got as far back as 2017 if I for sure know that we added the provider in 2022.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we do this? Add reasoning to the commit message.

@paullinator paullinator force-pushed the paul/paginateCaching branch 3 times, most recently from 6f92b13 to 8f3d3b4 Compare March 12, 2024 00:07
@paullinator
Copy link
Member Author

/rebase

@github-actions github-actions bot closed this Mar 13, 2024
@github-actions github-actions bot force-pushed the paul/paginateCaching branch from 8f3d3b4 to 5f7f2a3 Compare March 13, 2024 01:51
@paullinator paullinator merged commit 2e687c4 into master Mar 13, 2024
@paullinator paullinator deleted the paul/paginateCaching branch March 30, 2024 06:18
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