score calculations update

pull/29/head
Matthew 2020-09-22 18:34:36 -04:00
parent 1e1b257460
commit 32a7a554f1
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 11 additions and 1 deletions

View File

@ -123,7 +123,7 @@ export default class Score extends Command {
break; break;
} }
} */ } */
if (score.inquiries?.length > 0) { if (score?.inquiries?.length > 0) {
let desc = '__**Hard Inquiries**__\n*These inquiries will fall off your report within 3 months, try to keep your hard inquiries to a minimum. If you want to file a dispute, please DM Ramirez.*\n\n'; let desc = '__**Hard Inquiries**__\n*These inquiries will fall off your report within 3 months, try to keep your hard inquiries to a minimum. If you want to file a dispute, please DM Ramirez.*\n\n';
score.inquiries.forEach((inq) => { score.inquiries.forEach((inq) => {
const testDate = (new Date(new Date(inq.date).setHours(2190))); const testDate = (new Date(new Date(inq.date).setHours(2190)));

View File

@ -131,6 +131,16 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
other = Math.floor(other * 1.15); other = Math.floor(other * 1.15);
} }
const discordAccountCreatedAtTestDate = (new Date(new Date(new Date(member.user.createdAt)).setHours(730)));
if (discordAccountCreatedAtTestDate > new Date()) {
other -= 10;
}
const joinedAtTestDate = (new Date(new Date(new Date(member.joinedAt)).setHours(420)));
if (joinedAtTestDate > new Date()) {
other -= 30;
}
total = Math.floor(((total + activity + roles + moderation + cloudServices + staff + other) * 5.13) * 1.87); total = Math.floor(((total + activity + roles + moderation + cloudServices + staff + other) * 5.13) * 1.87);
await score.updateOne({ $set: { total, activity, roles, moderation, cloudServices, other, staff, lastUpdate: new Date() } }); await score.updateOne({ $set: { total, activity, roles, moderation, cloudServices, other, staff, lastUpdate: new Date() } });