From e0600c2d63a8015eadde5372025defe3158d072a Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sun, 6 Sep 2020 00:21:09 -0400 Subject: [PATCH] fixes to score --- src/commands/score.ts | 4 ++-- src/intervals/score.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/score.ts b/src/commands/score.ts index cf9a895..2816374 100644 --- a/src/commands/score.ts +++ b/src/commands/score.ts @@ -28,7 +28,7 @@ export default class Score extends Command { else totalScore = `${score.total}`; if (score.activity < 10) activityScore = '---'; - else if (score.activity > 55) activityScore = '55'; + else if (score.activity > Math.floor((Math.log1p(1000 + 300 + 200) * 12))) activityScore = String(Math.floor((Math.log1p(1000 + 300 + 200) * 12))); else activityScore = `${score.activity}`; if (score.roles <= 0) roleScore = '---'; @@ -48,7 +48,7 @@ export default class Score extends Command { const embed = new RichEmbed(); embed.setTitle('Community Score'); embed.addField('Total | 200 - 800', totalScore, true); - embed.addField('Activity | 10 - 55', activityScore, true); + embed.addField(`Activity | 10 - ${Math.floor(Math.log1p(1000 + 300 + 200) * 12)}`, activityScore, true); embed.addField('Roles | 1 - 54', roleScore, true); embed.addField('Moderation | -50 - 2', moderationScore, true); embed.addField('Cloud Services | -20 - 50', cloudServicesScore, true); diff --git a/src/intervals/score.ts b/src/intervals/score.ts index b368b93..0571e43 100644 --- a/src/intervals/score.ts +++ b/src/intervals/score.ts @@ -46,16 +46,16 @@ export default async function calculateScore(client: Client): Promise 54) roles = 54; const moderations = await client.db.Moderation.find({ userID: member.user.id }); if (moderations?.length > 0) moderation = -moderations.length * 8; else moderation = 2; - const activityTotal = (general.filter((m) => m.member?.id === member.id).length + programmingSupport.filter((m) => m.member?.id === member.id).length + cloudSupport.filter((m) => m.member?.id === member.id).length) * 0.485; - activity = Math.floor(activityTotal); - if (activity > 55) activity = 55; + const activityTotal = (general.filter((m) => m.member?.id === member.id).length + programmingSupport.filter((m) => m.member?.id === member.id).length + cloudSupport.filter((m) => m.member?.id === member.id).length); + activity = Math.floor(Math.log1p(activityTotal) * 12); + if (activity > (Math.log1p(1000 + 300 + 200) * 12)) activity = Math.floor((Math.log1p(1000 + 300 + 200) * 12)); if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) staff = 20; total = Math.floor(((total + activity + roles + moderation + cloudServices + staff) * 5.13) * 1.87);