diff --git a/postman/src/sender.rs b/postman/src/sender.rs index 08e83e9..9149604 100644 --- a/postman/src/sender.rs +++ b/postman/src/sender.rs @@ -445,30 +445,9 @@ WHERE }; error!("[Reminder {}] {}", self.id, message); - - if *LOG_TO_DATABASE { - sqlx::query!( - "INSERT INTO stat (type, reminder_id, message) VALUES ('reminder_failed', ?, ?)", - self.id, - message, - ) - .execute(pool) - .await - .expect("Could not log error to database"); - } } - async fn log_success(&self, pool: impl Executor<'_, Database = Database> + Copy) { - if *LOG_TO_DATABASE { - sqlx::query!( - "INSERT INTO stat (type, reminder_id) VALUES ('reminder_sent', ?)", - self.id, - ) - .execute(pool) - .await - .expect("Could not log success to database"); - } - } + async fn log_success(&self, pool: impl Executor<'_, Database = Database> + Copy) {} async fn set_sent(&self, pool: impl Executor<'_, Database = Database> + Copy) { sqlx::query!("UPDATE reminders SET `status` = 'sent' WHERE `id` = ?", self.id) diff --git a/web/src/routes/admin.rs b/web/src/routes/admin.rs index ee5303f..6470874 100644 --- a/web/src/routes/admin.rs +++ b/web/src/routes/admin.rs @@ -137,38 +137,6 @@ pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State>) -> Jso .await .unwrap(); - let history = sqlx::query_as_unchecked!( - TimeFrame, - "SELECT - FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`utc_time`) / 86400) * 86400) AS `time_key`, - COUNT(1) AS `count` - FROM stat - WHERE - `utc_time` > DATE_SUB(NOW(), INTERVAL 31 DAY) AND - `type` = 'reminder_sent' - GROUP BY `time_key` - ORDER BY `time_key`" - ) - .fetch_all(pool.inner()) - .await - .unwrap(); - - let history_failed = sqlx::query_as_unchecked!( - TimeFrame, - "SELECT - FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`utc_time`) / 86400) * 86400) AS `time_key`, - COUNT(1) AS `count` - FROM stat - WHERE - `utc_time` > DATE_SUB(NOW(), INTERVAL 31 DAY) AND - `type` = 'reminder_failed' - GROUP BY `time_key` - ORDER BY `time_key`" - ) - .fetch_all(pool.inner()) - .await - .unwrap(); - let interval_count = sqlx::query!( "SELECT COUNT(1) AS count FROM reminders @@ -206,10 +174,6 @@ pub async fn bot_data(cookies: &CookieJar<'_>, pool: &State>) -> Jso "once": schedule_once_long, "interval": schedule_interval_long, }, - "historyLong": { - "sent": history, - "failed": history_failed, - }, "count": { "reminders": reminder_count.count, "intervals": interval_count.count,