fix(admin): timesteampz
This commit is contained in:
@@ -64,12 +64,13 @@ export async function getAdminDashboardData(
|
||||
): Promise<AdminDashboardData> {
|
||||
const { todayStart, tomorrowStart, last7DaysStart } =
|
||||
getDashboardDateWindows(now);
|
||||
const nowSql = now.toISOString();
|
||||
const todayStartSql = toPostgresTimestamp(todayStart);
|
||||
const tomorrowStartSql = toPostgresTimestamp(tomorrowStart);
|
||||
const last7DaysStartSql = toPostgresTimestamp(last7DaysStart);
|
||||
const totalResponses = sql<number>`count(${submissions.id})::integer`;
|
||||
const acceptingSubmissions = sql<boolean>`${forms.isOpen} and (
|
||||
${forms.closesAt} is null or ${forms.closesAt} > ${now}
|
||||
${forms.closesAt} is null or ${forms.closesAt} > ${nowSql}::timestamptz
|
||||
)`;
|
||||
const responsesToday = sql<number>`count(${submissions.id}) filter (
|
||||
where ${submissions.submittedAt} >= ${todayStartSql}::timestamp
|
||||
|
||||
Reference in New Issue
Block a user