3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 23:25:02 +00:00

Add a warning when the user has >= specified amount of warns

This commit is contained in:
Nils Blömeke 2019-05-24 16:38:12 +02:00
parent 2f89d3ae25
commit 930dabf5cd
2 changed files with 25 additions and 0 deletions

View file

@ -266,4 +266,19 @@ export class CasesPlugin extends ZeppelinPlugin<ICasesPluginConfig> {
return null;
}
}
public async getCaseTypeAmountForUserId(userID: string, type: CaseTypes) {
const cases = (await this.cases.getByUserId(userID)).filter(c => !c.is_hidden);
let typeAmount = 0;
if (cases.length > 0) {
cases.forEach(singleCase => {
if (singleCase.type == type.valueOf()) {
typeAmount++;
}
});
}
return typeAmount;
}
}