From d4319ea072e0793a32dbddb1d456227cf481e42c Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Wed, 14 Aug 2024 17:20:09 -0400 Subject: [PATCH] fix: sqlite condition in MonthlyUsageService --- src/backend/src/services/sla/MonthlyUsageService.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/src/services/sla/MonthlyUsageService.js b/src/backend/src/services/sla/MonthlyUsageService.js index 1718039a..696f311c 100644 --- a/src/backend/src/services/sla/MonthlyUsageService.js +++ b/src/backend/src/services/sla/MonthlyUsageService.js @@ -33,6 +33,7 @@ class MonthlyUsageService extends BaseService { const month = new Date().getUTCMonth() + 1; const maybe_app_id = actor.type.app?.id; + const stringified = JSON.stringify(extra); // UPSERT increment count await this.db.write( @@ -45,8 +46,8 @@ class MonthlyUsageService extends BaseService { 'DO UPDATE SET `count` = `count` + 1, `extra` = ?', }), [ - year, month, key, actor.type.user.id, maybe_app_id ?? null, JSON.stringify(extra), - ...this.db.case({ mysql: [JSON.stringify(extra)], otherwise: [JSON.stringify({ a: 1 })] }), + year, month, key, actor.type.user.id, maybe_app_id ?? null, stringified, + stringified, ] ); }