show total reminders and intervals on admin dash
This commit is contained in:
@ -133,6 +133,30 @@ pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State<Pool<MySql>>) -> Jso
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let interval_count = sqlx::query!(
|
||||
"SELECT COUNT(1) AS count
|
||||
FROM reminders
|
||||
WHERE
|
||||
`interval_seconds` IS NOT NULL OR
|
||||
`interval_months` IS NOT NULL OR
|
||||
`interval_days` IS NOT NULL"
|
||||
)
|
||||
.fetch_one(pool.inner())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let reminder_count = sqlx::query!(
|
||||
"SELECT COUNT(1) AS count
|
||||
FROM reminders
|
||||
WHERE
|
||||
`interval_seconds` IS NULL AND
|
||||
`interval_months` IS NULL AND
|
||||
`interval_days` IS NULL"
|
||||
)
|
||||
.fetch_one(pool.inner())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Ok(json!({
|
||||
"backlog": backlog.backlog,
|
||||
"scheduleShort": {
|
||||
@ -142,6 +166,10 @@ pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State<Pool<MySql>>) -> Jso
|
||||
"scheduleLong": {
|
||||
"once": schedule_once_long,
|
||||
"interval": schedule_interval_long,
|
||||
},
|
||||
"count": {
|
||||
"reminders": reminder_count.count,
|
||||
"intervals": interval_count.count,
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
Reference in New Issue
Block a user