fix
parent
cffc8f76c9
commit
fff29389f0
|
@ -123,7 +123,7 @@ export default class Report extends Route {
|
|||
else if (data.report.total > 800) total = 800;
|
||||
else total = Math.round(data.report.total);
|
||||
|
||||
if (member.activity < 10) activity = 0;
|
||||
if (data.report.activity < 10) activity = 0;
|
||||
else if (data.report.activity > Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12))) activity = Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12));
|
||||
else activity = Math.round(data.report.activity);
|
||||
|
||||
|
@ -303,7 +303,7 @@ export default class Report extends Route {
|
|||
else if (data.report.total > 800) total = 800;
|
||||
else total = Math.round(data.report.total);
|
||||
|
||||
if (member.activity < 10) activity = 0;
|
||||
if (data.report.activity < 10) activity = 0;
|
||||
else if (data.report.activity > Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12))) activity = Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12));
|
||||
else activity = Math.round(data.report.activity);
|
||||
|
||||
|
@ -532,6 +532,36 @@ export default class Report extends Route {
|
|||
|
||||
const historical = await this.server.client.db.ScoreHistorical.find({ userID: score.userID }).lean().exec();
|
||||
|
||||
for (const data of historical) {
|
||||
let total: number;
|
||||
let activity: number;
|
||||
const moderation = Math.round(data.report.moderation);
|
||||
let role: number;
|
||||
let cloud: number;
|
||||
const other = Math.round(data.report.other);
|
||||
let misc: number;
|
||||
|
||||
if (data.report.total < 200) total = 0;
|
||||
else if (data.report.total > 800) total = 800;
|
||||
else total = Math.round(data.report.total);
|
||||
|
||||
if (data.report.activity < 10) activity = 0;
|
||||
else if (data.report.activity > Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12))) activity = Math.floor((Math.log1p(3000 + 300 + 200 + 100) * 12));
|
||||
else activity = Math.round(data.report.activity);
|
||||
|
||||
if (data.report.roles <= 0) role = 0;
|
||||
else if (data.report.roles > 54) role = 54;
|
||||
else activity = Math.round(data.report.roles);
|
||||
|
||||
if (data.report.staff <= 0) role = 0;
|
||||
else activity = Math.round(data.report.staff);
|
||||
|
||||
if (data.report.cloudServices === 0) cloud = 0;
|
||||
else if (data.report.cloudServices > 10) cloud = 10;
|
||||
else cloud = Math.round(data.report.cloudServices);
|
||||
|
||||
data.report.total = total; data.report.activity = activity; data.report.moderation = moderation; data.report.roles = role; data.report.cloudServices = cloud; data.report.other = other; data.report.staff = misc;
|
||||
}
|
||||
|
||||
return res.status(200).json({
|
||||
name: `${member.username}#${member.discriminator}`,
|
||||
|
|
Loading…
Reference in New Issue