fix for NaN totalpoints maybe

This commit is contained in:
Erik 2023-05-12 20:53:20 +03:00
parent 289d3c7f3b
commit e0879e4548
Signed by untrusted user: Navy.gif
GPG Key ID: 2532FBBB61C65A68
2 changed files with 3 additions and 3 deletions

View File

@ -249,8 +249,8 @@ class ModerationManager {
let points = 0, let points = 0,
expiration = 0; expiration = 0;
if (modpoints.enabled) { if (modpoints.enabled) {
points = info.points || modpoints.points[type]; points = (info.points || modpoints.points[type]) ?? 0;
expiration = info.expiration || modpoints.expirations[type]; expiration = (info.expiration || modpoints.expirations[type]) ?? 0;
if(reason) for (const [phrase, amount] of Object.entries(modpoints.associations)) { if(reason) for (const [phrase, amount] of Object.entries(modpoints.associations)) {
if (reason.toLowerCase().includes(phrase)) { if (reason.toLowerCase().includes(phrase)) {
points = amount; points = amount;

View File

@ -42,7 +42,7 @@ class UserWrapper {
filter, filter,
{ projection: { id: 1, points: 1, expiration: 1 } } { projection: { id: 1, points: 1, expiration: 1 } }
); );
if (find.length) { if (find.length) {
for (const { points: p, expiration, id } of find) { for (const { points: p, expiration, id } of find) {
let points = p; let points = p;