Skip to content

Commit ca514c2

Browse files
use Math floor after dividing (#14)
1 parent cdd3991 commit ca514c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ponder/src/api/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ponder.get("/stats", async (c) => {
88
const usersCount = await c.db.select({ value: count() }).from(c.tables.User);
99
const challengesCount = await c.db.select({ value: count() }).from(c.tables.Challenge);
1010

11-
const lastMonth = (Date.now() - (30 * 24 * 60 * 60 * 1000)) / 1000;
11+
const lastMonth = Math.floor(Date.now() / 1000) - (30 * 24 * 60 * 60);
1212

1313
const usersCountLastMonth = await c.db.select({ value: count() }).from(c.tables.User).where(gte(c.tables.User.updated, lastMonth));
1414
const challengesCountLastMonth = await c.db.select({ value: count() }).from(c.tables.Challenge).where(gte(c.tables.Challenge.timestamp, lastMonth));

0 commit comments

Comments
 (0)