Don't count hidden cases in !info

This commit is contained in:
Dragory 2019-01-15 04:16:34 +02:00
parent f6f1c29fc1
commit 9a5a9a64da

View file

@ -297,18 +297,16 @@ export class UtilityPlugin extends ZeppelinPlugin {
});
}
const cases = await this.cases.getByUserId(args.userId);
const cases = (await this.cases.getByUserId(args.userId)).filter(c => !c.is_hidden);
if (cases.length > 0) {
cases.sort((a, b) => {
return a.created_at < b.created_at ? 1 : -1;
});
const caseSummary = cases
.filter(c => !c.is_hidden)
.slice(0, 3)
.map(c => {
return `${CaseTypes[c.type]} (#${c.case_number})`;
});
const caseSummary = cases.slice(0, 3).map(c => {
return `${CaseTypes[c.type]} (#${c.case_number})`;
});
const summaryText = cases.length > 3 ? "Last 3 cases" : "Summary";