Make analytics show data up to current hour
This commit is contained in:
parent
e9ee7e2355
commit
6a30a41b10
|
@ -19,8 +19,11 @@ import { getDailyNewUsers } from 'web/lib/firebase/users'
|
|||
export const getStaticProps = fromPropz(getStaticPropz)
|
||||
export async function getStaticPropz() {
|
||||
const numberOfDays = 45
|
||||
const today = dayjs(dayjs().format('YYYY-MM-DD'))
|
||||
const startDate = today.subtract(numberOfDays, 'day')
|
||||
const tomorrow = dayjs(dayjs().format('YYYY-MM-DD'))
|
||||
.add(1, 'day')
|
||||
.subtract(7, 'hours')
|
||||
|
||||
const startDate = tomorrow.subtract(numberOfDays, 'day')
|
||||
|
||||
const [dailyBets, dailyContracts, dailyComments, dailyNewUsers] =
|
||||
await Promise.all([
|
||||
|
@ -144,7 +147,7 @@ export async function getStaticPropz() {
|
|||
|
||||
return {
|
||||
props: {
|
||||
startDate: startDate.valueOf(),
|
||||
startDate: startDate.add(1, 'day').valueOf(),
|
||||
dailyActiveUsers,
|
||||
weeklyActiveUsers,
|
||||
monthlyActiveUsers,
|
||||
|
@ -155,7 +158,7 @@ export async function getStaticPropz() {
|
|||
weeklyActivationRate,
|
||||
monthlyRetention,
|
||||
},
|
||||
revalidate: 12 * 60 * 60, // regenerate after half a day
|
||||
revalidate: 60 * 60, // Regenerate after an hour
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user