fixes to score

pull/29/head
Matthew 2020-09-06 00:21:09 -04:00
parent 5ab7ae118a
commit e0600c2d63
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -46,16 +46,16 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
let total = 0, activity = 0, roles = 0, moderation = 0, cloudServices = 0, staff = 0;
cloudServices = 0;
roles = Math.floor(member.roles.length * 0.87);
roles = Math.floor(member.roles.length * 0.50);
if (roles > 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);