Fix some sorting and a message id caching issue

This commit is contained in:
Michael 2024-12-23 20:40:34 -06:00
parent 315b02ce0d
commit 6b9f020922
Signed by: TheShadowEevee
GPG key ID: 7A8AA92B3BAFAB75

View file

@ -64,7 +64,7 @@ module.exports = {
// Fetch Messages // Fetch Messages
const sum_messages = []; const sum_messages = [];
let first_id = convertDateToSnowflake(startDate); let first_id = convertDateToSnowflake(startDate);
const messageMap = new Map(); let messageMap = new Map();
let continueFetching = true; let continueFetching = true;
while (continueFetching) { while (continueFetching) {
@ -76,7 +76,7 @@ module.exports = {
sum_messages.push(...messages.values()); sum_messages.push(...messages.values());
for (const [snowflake, message] of messages) { for (const [snowflake, message] of messages) {
if (message.author.id === threadStarterMessage.member.id) { if (message.author.id === threadStarterMessage.author.id) {
const messageDate = convertSnowflakeToDate(snowflake); const messageDate = convertSnowflakeToDate(snowflake);
let monthName = ''; let monthName = '';
@ -114,6 +114,8 @@ module.exports = {
} }
} }
messageMap = new Map([...messageMap.entries()].sort());
// Start Commit Checking // Start Commit Checking
let validString = ''; let validString = '';
let invalidString = ''; let invalidString = '';
@ -165,7 +167,7 @@ module.exports = {
} }
if (dateVerified) { if (dateVerified) {
validString = `${date}: ${verifyReason}\n` + validString; validString += `${date}: ${verifyReason}\n`;
validDays.push(date); validDays.push(date);
} }
} }
@ -196,7 +198,6 @@ module.exports = {
while (currentDate <= endDate) { while (currentDate <= endDate) {
allDays.push(new Date(currentDate)); allDays.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1); currentDate.setDate(currentDate.getDate() + 1);
console.log(allDays);
} }
for (const day of allDays) { for (const day of allDays) {
@ -218,7 +219,6 @@ module.exports = {
invalidString += `${formattedDay}\n`; invalidString += `${formattedDay}\n`;
dayMap.set(formattedDay, false); dayMap.set(formattedDay, false);
} }
console.log(dayMap);
} }
let streakCount = 0; let streakCount = 0;