show total reminders and intervals on admin dash
This commit is contained in:
parent
dda8bd3e10
commit
1a1a0fdefb
@ -133,6 +133,30 @@ pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State<Pool<MySql>>) -> Jso
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.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!({
|
Ok(json!({
|
||||||
"backlog": backlog.backlog,
|
"backlog": backlog.backlog,
|
||||||
"scheduleShort": {
|
"scheduleShort": {
|
||||||
@ -142,6 +166,10 @@ pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State<Pool<MySql>>) -> Jso
|
|||||||
"scheduleLong": {
|
"scheduleLong": {
|
||||||
"once": schedule_once_long,
|
"once": schedule_once_long,
|
||||||
"interval": schedule_interval_long,
|
"interval": schedule_interval_long,
|
||||||
|
},
|
||||||
|
"count": {
|
||||||
|
"reminders": reminder_count.count,
|
||||||
|
"intervals": interval_count.count,
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
.then((resp) => resp.json())
|
.then((resp) => resp.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
document.querySelector("#backlog").textContent = data.backlog;
|
document.querySelector("#backlog").textContent = data.backlog;
|
||||||
|
document.querySelector("#reminders").textContent = data.count.reminders;
|
||||||
|
document.querySelector("#intervals").textContent = data.count.intervals;
|
||||||
|
|
||||||
new Chart(document.getElementById("schedule"), {
|
new Chart(document.getElementById("schedule"), {
|
||||||
type: "bar",
|
type: "bar",
|
||||||
|
@ -46,6 +46,14 @@
|
|||||||
<p>Backlog</p>
|
<p>Backlog</p>
|
||||||
<p class="figure-num" id="backlog">?</p>
|
<p class="figure-num" id="backlog">?</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="stat-box figure">
|
||||||
|
<p>Reminders</p>
|
||||||
|
<p class="figure-num" id="reminders">?</p>
|
||||||
|
</div>
|
||||||
|
<div class="stat-box figure">
|
||||||
|
<p>Intervals</p>
|
||||||
|
<p class="figure-num" id="intervals">?</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<div class="stat-box" style="height: 400px;">
|
<div class="stat-box" style="height: 400px;">
|
||||||
|
Loading…
Reference in New Issue
Block a user