From 988122c5d6f94a4abf6446b0a8a7132ddb12737c Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 5 Apr 2022 22:10:56 -0500 Subject: sort farming contests by newest first --- src/cleaners/skyblock/farmingContents.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/cleaners') diff --git a/src/cleaners/skyblock/farmingContents.ts b/src/cleaners/skyblock/farmingContents.ts index 3727621..039c725 100644 --- a/src/cleaners/skyblock/farmingContents.ts +++ b/src/cleaners/skyblock/farmingContents.ts @@ -49,7 +49,11 @@ export function cleanFarmingContests(data: typedHypixelApi.SkyBlockProfileMember contestsByDate[contestByDateKey].push(cropData) } - const contests: PlayerFarmingContestStats[] = Object.entries(contestsByDate).map(([contestDateKey, crops]) => { + const contestsByDateEntries = Object.entries(contestsByDate) + // this is to sort by newest first + contestsByDateEntries.reverse() + + const contests: PlayerFarmingContestStats[] = contestsByDateEntries.map(([contestDateKey, crops]) => { const [year, month, day] = contestDateKey.split(':') return { year: parseInt(year), -- cgit