changes/fixes

master
Matthew 2021-07-08 16:48:19 -04:00
parent f74a0fd07e
commit d7895cb8c7
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
4 changed files with 984 additions and 980 deletions

View File

@ -139,10 +139,8 @@ export default class Report extends Route {
const judgements = await this.server.client.db.Judgement.find({ userID: member.userID }).lean().exec(); const judgements = await this.server.client.db.Judgement.find({ userID: member.userID }).lean().exec();
const historicalData = await this.server.client.db.ScoreHistorical.find({ userID: member.userID }).lean().exec(); const historicalData = await this.server.client.db.ScoreHistorical.find({ userID: member.userID }).lean().exec();
const array: ScoreHistoricalRaw[] | ScoreHistoricalInterface[] = []; const array: ScoreHistoricalRaw[] = [];
for (const data of historicalData) { for (const data of historicalData) {
delete data.report?.softInquiries;
let total: number; let total: number;
let activity: number; let activity: number;
const moderation = Math.round(data.report.moderation); const moderation = Math.round(data.report.moderation);
@ -294,9 +292,6 @@ export default class Report extends Route {
const historicalData = await this.server.client.db.ScoreHistorical.find({ userID: report.userID }).lean().exec(); const historicalData = await this.server.client.db.ScoreHistorical.find({ userID: report.userID }).lean().exec();
const array: ScoreHistoricalRaw[] = []; const array: ScoreHistoricalRaw[] = [];
for (const data of historicalData) { for (const data of historicalData) {
delete data.report?.softInquiries;
delete data.report?.inquiries;
let total: number; let total: number;
let activity: number; let activity: number;
const moderation = Math.round(data.report.moderation); const moderation = Math.round(data.report.moderation);

View File

@ -32,7 +32,15 @@ export default class Queue {
const inqs = await this.client.db.Inquiry.find({ userID: report.userID }); const inqs = await this.client.db.Inquiry.find({ userID: report.userID });
const data = new this.client.db.ScoreHistorical({ const data = new this.client.db.ScoreHistorical({
userID: report.userID, userID: report.userID,
report, report: {
total: report.total,
activity: report.activity,
roles: report.roles,
moderation: report.moderation,
cloudServices: report.cloudServices,
staff: report.staff,
other: report.other,
},
inquiries: inqs.map((inq) => inq._id), inquiries: inqs.map((inq) => inq._id),
date: startDate, date: startDate,
}); });

View File

@ -28,6 +28,7 @@ export default class Score_Hist extends Command {
const sc = await this.client.db.Score.findOne({ pin: [Number(args[0].split('-')[0]), Number(args[0].split('-')[1]), Number(args[0].split('-')[2])] }); const sc = await this.client.db.Score.findOne({ pin: [Number(args[0].split('-')[0]), Number(args[0].split('-')[1]), Number(args[0].split('-')[2])] });
user = this.client.util.resolveMember(sc.userID, this.mainGuild)?.user; user = this.client.util.resolveMember(sc.userID, this.mainGuild)?.user;
} }
const score = await this.client.db.Score.findOne({ userID: user.id }).lean().exec();
if (!user) return this.error(message.channel, 'Member not found.'); if (!user) return this.error(message.channel, 'Member not found.');
const hists = await this.client.db.ScoreHistorical.find({ userID: user.id }).limit(31).lean().exec(); const hists = await this.client.db.ScoreHistorical.find({ userID: user.id }).limit(31).lean().exec();
if (!hists) return this.error(message.channel, 'No history found.'); if (!hists) return this.error(message.channel, 'No history found.');
@ -95,7 +96,7 @@ export default class Score_Hist extends Command {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
if (testDate > new Date()) hardInquiries++; if (testDate > new Date()) hardInquiries++;
}); });
data += `__CommScore™:__ ${totalScore}\n__Activity:__ ${activityScore}\n__Roles:__ ${roleScore}\n__Moderation:__ ${moderationScore}\n__Cloud Services:__ ${cloudServicesScore}\n__Other:__ ${otherScore}\n__Misc:__ ${miscScore}\n\n__Hard Inquiries:__ ${hardInquiries}\n__Soft Inquiries:__ ${hist.report.softInquiries?.length ?? '0'}`; data += `__CommScore™:__ ${totalScore}\n__Activity:__ ${activityScore}\n__Roles:__ ${roleScore}\n__Moderation:__ ${moderationScore}\n__Cloud Services:__ ${cloudServicesScore}\n__Other:__ ${otherScore}\n__Misc:__ ${miscScore}\n\n__Hard Inquiries:__ ${hardInquiries}\n__Soft Inquiries:__ ${score.softInquiries?.length ?? '0'}`;
histArray.push({ name: moment(hist.date).calendar(), value: data }); histArray.push({ name: moment(hist.date).calendar(), value: data });
} }
} }