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 const getStaticProps = fromPropz(getStaticPropz)
|
||||||
export async function getStaticPropz() {
|
export async function getStaticPropz() {
|
||||||
const numberOfDays = 45
|
const numberOfDays = 45
|
||||||
const today = dayjs(dayjs().format('YYYY-MM-DD'))
|
const tomorrow = dayjs(dayjs().format('YYYY-MM-DD'))
|
||||||
const startDate = today.subtract(numberOfDays, 'day')
|
.add(1, 'day')
|
||||||
|
.subtract(7, 'hours')
|
||||||
|
|
||||||
|
const startDate = tomorrow.subtract(numberOfDays, 'day')
|
||||||
|
|
||||||
const [dailyBets, dailyContracts, dailyComments, dailyNewUsers] =
|
const [dailyBets, dailyContracts, dailyComments, dailyNewUsers] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -144,7 +147,7 @@ export async function getStaticPropz() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
startDate: startDate.valueOf(),
|
startDate: startDate.add(1, 'day').valueOf(),
|
||||||
dailyActiveUsers,
|
dailyActiveUsers,
|
||||||
weeklyActiveUsers,
|
weeklyActiveUsers,
|
||||||
monthlyActiveUsers,
|
monthlyActiveUsers,
|
||||||
|
@ -155,7 +158,7 @@ export async function getStaticPropz() {
|
||||||
weeklyActivationRate,
|
weeklyActivationRate,
|
||||||
monthlyRetention,
|
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