Factor in new subscoring model
parent
244cac9204
commit
55e9f9b390
|
@ -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);
|
||||
|
|
|
@ -36,6 +36,7 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
|||
roles: number,
|
||||
moderation: number,
|
||||
cloudServices: number,
|
||||
other: number,
|
||||
staff: boolean,
|
||||
inquiries: [{ name: string, reason: string}?],
|
||||
} = {
|
||||
|
@ -45,6 +46,7 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
|||
roles: 0,
|
||||
moderation: 0,
|
||||
cloudServices: 0,
|
||||
other: 0,
|
||||
staff: false,
|
||||
inquiries: [],
|
||||
};
|
||||
|
@ -55,7 +57,7 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
|||
// eslint-disable-next-line prefer-const
|
||||
// eslint-disable-next-line one-var-declaration-per-line
|
||||
// eslint-disable-next-line one-var
|
||||
let total = 0, activity = 0, roles = 0, moderation = 0, cloudServices = 0, staff = 0;
|
||||
let total = 0, activity = 0, roles = 0, moderation = 0, cloudServices = 0, other = 0, staff = 0;
|
||||
cloudServices = 0;
|
||||
|
||||
roles = Math.floor(member.roles.length * 0.50);
|
||||
|
@ -104,9 +106,17 @@ export default async function calculateScore(client: Client): Promise<NodeJS.Tim
|
|||
else cloudServices = Math.floor(positives * 0.61);
|
||||
}
|
||||
|
||||
total = Math.floor(((total + activity + roles + moderation + cloudServices + staff) * 5.13) * 1.87);
|
||||
if (score.inquiries?.length > 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}`);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue