From cc8326361eee5da644f67aa1c0cb5dfb02e5ef52 Mon Sep 17 00:00:00 2001 From: Alec LaLonde Date: Wed, 19 May 2021 03:49:51 -0600 Subject: [PATCH] Made xp weekly change more readable (#569) --- packages/discord-bot/src/discord/commands/getXp.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/discord-bot/src/discord/commands/getXp.ts b/packages/discord-bot/src/discord/commands/getXp.ts index ed21953f..6c159006 100644 --- a/packages/discord-bot/src/discord/commands/getXp.ts +++ b/packages/discord-bot/src/discord/commands/getXp.ts @@ -49,6 +49,7 @@ export class GetXpCommand { const userTotalCred = scAccount.totalCred; const numWeeks = scAccount.cred.length; const userWeeklyCred = scAccount.cred; + const variation = (100 * (userWeeklyCred[numWeeks - 1] - userWeeklyCred[numWeeks - 2])) / @@ -87,7 +88,7 @@ export class GetXpCommand { }, { name: 'Weekly Change', - value: `${variation.toPrecision(2)}%`, + value: `${Math.round(variation)}%`, inline: true, }, )