WIP ModActions
This commit is contained in:
parent
a3d0ec03d9
commit
ebcb28261b
25 changed files with 1162 additions and 6 deletions
|
@ -0,0 +1,22 @@
|
|||
import { PluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
|
||||
export async function getCaseTypeAmountForUserId(
|
||||
pluginData: PluginData<CasesPluginType>,
|
||||
userID: string,
|
||||
type: CaseTypes,
|
||||
): Promise<number> {
|
||||
const cases = (await pluginData.state.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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue