diff --git a/src/commands/score.ts b/src/commands/score.ts index 60111cb..bf84bb7 100644 --- a/src/commands/score.ts +++ b/src/commands/score.ts @@ -56,6 +56,7 @@ export default class Score extends Command { let moderationScore = '0'; let roleScore = '0'; let cloudServicesScore = '0'; + let otherScore = '0'; let miscScore = '0'; if (score) { @@ -73,13 +74,16 @@ export default class Score extends Command { moderationScore = `${score.moderation}`; + if (score.other === 0) otherScore = '---'; + else otherScore = `${score.other}`; + if (score.staff <= 0) miscScore = '---'; else miscScore = `${score.staff}`; if (score.cloudServices === 0) cloudServicesScore = '---'; - else if (score.cloudServices > 50) cloudServicesScore = '50'; + else if (score.cloudServices > 10) cloudServicesScore = '10'; else cloudServicesScore = `${score.cloudServices}`; - } else return this.error(message.channel, 'Community Score has not been calculated yet.'); + } // else return this.error(message.channel, 'Community Score has not been calculated yet.'); const embed = new RichEmbed(); embed.setTitle('Community Score'); @@ -105,11 +109,12 @@ export default class Score extends Command { if (score.total >= 500) { color = '🟡'; embed.setColor('FFFF00'); } if (score.total >= 700) { color = '🟢'; embed.setColor('66FF66'); } embed.addField('Total | 200 to 800', `${color} ${totalScore}`, true); - embed.addField(`Activity | 10 to ${Math.floor(Math.log1p(5000 + 300 + 200 + 100) * 12)}`, activityScore, true); - embed.addField('Roles | 1 to N/A', roleScore, true); - embed.addField('Moderation | N/A to 2', moderationScore, true); - embed.addField('Cloud Services | N/A to 10', cloudServicesScore, true); - embed.addField('Misc', miscScore, true); + embed.addField(`Activity | 10 to ${Math.floor(Math.log1p(5000 + 300 + 200 + 100) * 12)}`, activityScore || 'N/C', true); + embed.addField('Roles | 1 to N/A', roleScore || 'N/C', true); + embed.addField('Moderation | N/A to 2' || 'N/C', moderationScore, true); + embed.addField('Cloud Services | N/A to 10', cloudServicesScore || 'N/C', true); + embed.addField('Other', otherScore || 'N/C', true); + embed.addField('Misc', miscScore || 'N/C', true); if (score.lastUpdate) { embed.setFooter('Report last updated', this.client.user.avatarURL); embed.setTimestamp(score.lastUpdate); diff --git a/src/intervals/score.ts b/src/intervals/score.ts index 38f2f2e..4915f4a 100644 --- a/src/intervals/score.ts +++ b/src/intervals/score.ts @@ -36,6 +36,7 @@ export default async function calculateScore(client: Client): Promise 0) { + for (const inq of score.inquiries) { + const testDate = (new Date(new Date(inq.date).setHours(2190))); + if (testDate > new Date()) other -= 1.5; + } + other = Math.floor(other * 1.15); + } - await score.updateOne({ $set: { total, activity, roles, moderation, cloudServices, staff, lastUpdate: new Date() } }); + 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() } }); // client.util.signale.debug(`SCORE SET - ${member.username}\nTotal: ${total}\nActivity: ${activity}\nRoles: ${roles}\nModeration: ${moderation}\nCloud Services: ${cloudServices}\nStaff: ${staff}`); } };