From 7008b44a0033f2fa8205ee654cb120996ff9a69b Mon Sep 17 00:00:00 2001
From: Taken
Date: Tue, 2 Sep 2025 22:00:59 +0200
Subject: [PATCH] Updated ratios to use devide
---
.../(stats)/player/[ign]/_stats/bedwars/bedwars.tsx | 10 +++++-----
src/app/(stats)/player/[ign]/_stats/duels/duels.tsx | 8 ++++----
src/app/(stats)/player/[ign]/_stats/duels/stats.tsx | 6 +++---
.../(stats)/player/[ign]/_stats/skywars/skywars.tsx | 6 +++---
src/app/(stats)/player/[ign]/_stats/skywars/stats.tsx | 7 ++++---
5 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx b/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx
index 33dca6e..ae02aa1 100644
--- a/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx
+++ b/src/app/(stats)/player/[ign]/_stats/bedwars/bedwars.tsx
@@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
import { getBWLevelForExp, getTotalExpForLevel } from "@/lib/hypixel/bedwars/level"
-import { getProgress } from "@/lib/hypixel/general"
+import { devide, getProgress } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats"
import { BedwarsLevel, BedwarsProgress } from "./components"
@@ -13,10 +13,10 @@ import BedwarsStatTable from "./table"
export default function BedwarsStats({ stats }: { stats: NonNullStats["Bedwars"] }) {
if (!stats) return null
- const kd = formatNumber(stats.kills_bedwars / stats.deaths_bedwars)
- const fkd = formatNumber(stats.final_kills_bedwars / stats.final_deaths_bedwars)
- const wl = formatNumber(stats.wins_bedwars / stats.losses_bedwars)
- const bbl = formatNumber(stats.beds_broken_bedwars / stats.beds_lost_bedwars)
+ const kd = formatNumber(devide(stats.kills_bedwars, stats.deaths_bedwars))
+ const fkd = formatNumber(devide(stats.final_kills_bedwars, stats.final_deaths_bedwars))
+ const wl = formatNumber(devide(stats.wins_bedwars, stats.losses_bedwars))
+ const bbl = formatNumber(devide(stats.beds_broken_bedwars, stats.beds_lost_bedwars))
const level = getBWLevelForExp(stats.Experience)
const current = getTotalExpForLevel(level)
diff --git a/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx b/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx
index b84f0ed..665540b 100644
--- a/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx
+++ b/src/app/(stats)/player/[ign]/_stats/duels/duels.tsx
@@ -3,7 +3,7 @@ import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
import { getAllDivisions, getMostPlayed } from "@/lib/hypixel/duels/duels"
-import { romanize } from "@/lib/hypixel/general"
+import { devide, romanize } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats"
import DuelsGeneralStats from "./stats"
@@ -12,8 +12,8 @@ import DuelsStatsTable from "./table"
export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] }) {
if (!stats) return null
- const wl = stats.wins / stats.losses
- const kd = stats.kills / stats.deaths
+ const wl = formatNumber(devide(stats.wins, stats.losses))
+ const kd = formatNumber(devide(stats.kills, stats.deaths))
const div = getAllDivisions(stats)
const mostPlayed = getMostPlayed(stats)
@@ -61,7 +61,7 @@ export default function DuelsStats({ stats }: { stats: NonNullStats["Duels"] })
},
{
title: WL
,
- stat: {formatNumber(wl)}
+ stat: {wl}
}
]}
/>
diff --git a/src/app/(stats)/player/[ign]/_stats/duels/stats.tsx b/src/app/(stats)/player/[ign]/_stats/duels/stats.tsx
index 77ac316..af26c1c 100644
--- a/src/app/(stats)/player/[ign]/_stats/duels/stats.tsx
+++ b/src/app/(stats)/player/[ign]/_stats/duels/stats.tsx
@@ -6,7 +6,7 @@ import { cn } from "@/lib/utils"
import { BasicStat } from "../../_components/Stats"
export default function DuelsGeneralStats(
- { statsChecked, div, kd, wl }: { statsChecked: NonNullStats["Duels"], div: Div | null, kd: number, wl: number }
+ { statsChecked, div, kd, wl }: { statsChecked: NonNullStats["Duels"], div: Div | null, kd: string, wl: string }
) {
const stats = statsChecked!
@@ -27,7 +27,7 @@ export default function DuelsGeneralStats(
-
+
@@ -46,7 +46,7 @@ export default function DuelsGeneralStats(
-
+
diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx
index e62b1ec..bf1b2d2 100644
--- a/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx
+++ b/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx
@@ -2,7 +2,7 @@ import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/
import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
-import { getProgress } from "@/lib/hypixel/general"
+import { devide, getProgress } from "@/lib/hypixel/general"
import { getSkywarsLevel, getSkywarsXpForLevel } from "@/lib/hypixel/skywars/level"
import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats"
@@ -16,8 +16,8 @@ export default function SkyWarsStats(
if (!stats) return null
const level = getSkywarsLevel(stats.skywars_experience)
- const kd = formatNumber(stats.kills / stats.deaths)
- const wl = formatNumber(stats.wins / stats.losses)
+ const kd = formatNumber(devide(stats.kills, stats.deaths))
+ const wl = formatNumber(devide(stats.wins, stats.losses))
const current = getSkywarsXpForLevel(Math.floor(level))
const next = getSkywarsXpForLevel(Math.floor(level + 1))
diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/stats.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/stats.tsx
index 5ed5d27..ac4626e 100644
--- a/src/app/(stats)/player/[ign]/_stats/skywars/stats.tsx
+++ b/src/app/(stats)/player/[ign]/_stats/skywars/stats.tsx
@@ -1,4 +1,5 @@
import { formatNumber } from "@/lib/formatters"
+import { devide } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player"
import { BasicStat, Stat } from "../../_components/Stats"
import { SkywarsPrestige } from "./components"
@@ -46,7 +47,7 @@ export default function SkyWarsGeneralStats({
-
+
@@ -64,8 +65,8 @@ export default function SkyWarsGeneralStats({
-
-
+
+