From 91657f7519502fc57ba0628ca37a851c76b81150 Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Mon, 6 Jan 2025 20:51:36 +0100 Subject: [PATCH] Fixed ot-sqlite-database plugin stats not working --- src/core/api/modules/stat.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/api/modules/stat.ts b/src/core/api/modules/stat.ts index 0c1fe37..fb91120 100644 --- a/src/core/api/modules/stat.ts +++ b/src/core/api/modules/stat.ts @@ -112,12 +112,12 @@ export class ODStatScope extends ODManager { if (mode == "set" || typeof value != "number"){ await this.database.set(this.id.value+"_"+stat.id.value,scopeId,value) }else if (mode == "increase"){ - const currentValue = this.getStat(id,scopeId) - if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0) + const currentValue = await this.getStat(id,scopeId) + if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0+value) else await this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue+value) }else if (mode == "decrease"){ - const currentValue = this.getStat(id,scopeId) - if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0) + const currentValue = await this.getStat(id,scopeId) + if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0-value) else await this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue-value) } return true