jude/orphan-reminders #1

Merged
jude merged 10 commits from jude/orphan-reminders into next 2023-09-16 17:09:34 +00:00
7 changed files with 20 additions and 40 deletions
Showing only changes of commit adf29dca5d - Show all commits

View File

@ -310,7 +310,7 @@ WHERE
reminders reminders
WHERE WHERE
reminders.`utc_time` <= NOW() AND reminders.`utc_time` <= NOW() AND
reminders.`channel_id` NOT NULL AND reminders.`channel_id` IS NOT NULL AND
`status` = 'pending' AND `status` = 'pending' AND
( (
reminders.`interval_seconds` IS NOT NULL reminders.`interval_seconds` IS NOT NULL

View File

@ -624,7 +624,7 @@ pub async fn get_reminder_errors(
reminders.channel_id AS channel reminders.channel_id AS channel
FROM reminders FROM reminders
LEFT JOIN channels ON channels.id = reminders.channel_id LEFT JOIN channels ON channels.id = reminders.channel_id
WHERE (`status` != 'pending' OR reminders.channel_id IS NULL) AND reminders.guild_id = (SELECT id FROM guilds WHERE guild = ?)", WHERE (`status` = 'failed' OR reminders.channel_id IS NULL) AND reminders.guild_id = (SELECT id FROM guilds WHERE guild = ?)",
id id
) )
.fetch_all(pool.inner()) .fetch_all(pool.inner())

View File

@ -18,6 +18,7 @@ const $downloader = document.querySelector("a#downloader");
const $uploader = document.querySelector("input#uploader"); const $uploader = document.querySelector("input#uploader");
let channels = []; let channels = [];
let reminderErrors = [];
let guildNames = {}; let guildNames = {};
let roles = []; let roles = [];
let templates = {}; let templates = {};
@ -36,6 +37,12 @@ function guildId() {
return document.querySelector(".guildList a.is-active").dataset["guild"]; return document.querySelector(".guildList a.is-active").dataset["guild"];
} }
function loadErrors() {
return fetch(`/dashboard/api/guild/${guildId()}/errors`).then((response) =>
response.json()
);
}
function colorToInt(r, g, b) { function colorToInt(r, g, b) {
return (r << 16) + (g << 8) + b; return (r << 16) + (g << 8) + b;
} }
@ -476,6 +483,9 @@ document.addEventListener("guildSwitched", async (e) => {
fetch_roles(e.detail.guild_id); fetch_roles(e.detail.guild_id);
fetch_templates(e.detail.guild_id); fetch_templates(e.detail.guild_id);
fetch_reminders(e.detail.guild_id); fetch_reminders(e.detail.guild_id);
loadErrors().then((res) => {
console.log(res);
});
document.querySelectorAll("p.pageTitle").forEach((el) => { document.querySelectorAll("p.pageTitle").forEach((el) => {
el.textContent = `${e.detail.guild_name} Reminders`; el.textContent = `${e.detail.guild_name} Reminders`;

View File

@ -1,19 +0,0 @@
let _reminderErrors = [];
const reminderErrors = () => {
return _reminderErrors;
}
const guildId = () => {
let selected = document.querySelector(".guildList a.is-active");
return selected.dataset["guild"];
}
function loadErrors() {
fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
}
document.addEventListener('DOMContentLoaded', () => {
})

View File

@ -1,19 +0,0 @@
let _reminderErrors = [];
const reminderErrors = () => {
return _reminderErrors;
}
const guildId = () => {
let selected: HTMLElement = document.querySelector(".guildList a.is-active");
return selected.dataset["guild"];
}
function loadErrors() {
fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
}
document.addEventListener('DOMContentLoaded', () => {
})

View File

@ -385,6 +385,10 @@
{% include "reminder_dashboard/guild_reminder" %} {% include "reminder_dashboard/guild_reminder" %}
</template> </template>
<template id="guildError">
</template>
<script src="/static/js/iro.js"></script> <script src="/static/js/iro.js"></script>
<script src="/static/js/dtsel.js"></script> <script src="/static/js/dtsel.js"></script>

View File

@ -46,6 +46,10 @@
<div id="guildReminders"> <div id="guildReminders">
</div> </div>
<div id="guildErrors">
</div>
</div> </div>
<script src="/static/js/sort.js"></script> <script src="/static/js/sort.js"></script>