mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-25 12:49:26 -05:00
Fix leaderboards off-season tiers
This commit is contained in:
@@ -5,8 +5,8 @@ import type { MainWeaponId } from "~/modules/in-game-lists";
|
||||
import { weaponCategories } from "~/modules/in-game-lists";
|
||||
import type { TeamSPLeaderboardItem } from "../queries/teamSPLeaderboard.server";
|
||||
|
||||
export function addTiers(entries: UserSPLeaderboardItem[]) {
|
||||
const tiers = freshUserSkills();
|
||||
export function addTiers(entries: UserSPLeaderboardItem[], season: number) {
|
||||
const tiers = freshUserSkills(season);
|
||||
|
||||
const encounteredTiers = new Set<string>();
|
||||
return entries.map((entry) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
type RankedModeShort,
|
||||
} from "~/modules/in-game-lists";
|
||||
import { rankedModesShort } from "~/modules/in-game-lists/modes";
|
||||
import { allSeasons, currentSeason } from "~/features/mmr/season";
|
||||
import { allSeasons } from "~/features/mmr/season";
|
||||
import {
|
||||
addPlacementRank,
|
||||
addTiers,
|
||||
@@ -103,10 +103,8 @@ export const loader = async ({ request }: LoaderArgs) => {
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
async getFreshValue() {
|
||||
const leaderboard = userSPLeaderboard(0);
|
||||
// TODO: handle viewing during off-season
|
||||
const withTiers = currentSeason(new Date())
|
||||
? addTiers(leaderboard)
|
||||
: leaderboard.map((e) => ({ ...e, tier: undefined }));
|
||||
// TODO: dynamic season
|
||||
const withTiers = addTiers(leaderboard, 0);
|
||||
|
||||
return addWeapons(withTiers, seasonPopularUsersWeapon(0));
|
||||
},
|
||||
|
||||
@@ -70,6 +70,7 @@ import { Tab, Tabs } from "~/components/Tabs";
|
||||
import { useAutoRefresh } from "~/hooks/useAutoRefresh";
|
||||
import { groupHasMatch } from "../queries/groupHasMatch.server";
|
||||
import { findRecentMatchPlayersByUserId } from "../queries/findRecentMatchPlayersByUserId.server";
|
||||
import { previousOrCurrentSeason } from "~/features/mmr/season";
|
||||
|
||||
export const handle: SendouRouteHandle = {
|
||||
i18n: ["q"],
|
||||
@@ -316,9 +317,11 @@ export const loader = async ({ request }: LoaderArgs) => {
|
||||
likes: findLikes(currentGroup.id),
|
||||
});
|
||||
|
||||
const season = previousOrCurrentSeason(new Date());
|
||||
|
||||
const groupsWithSkills = addSkillsToGroups({
|
||||
groups: dividedGroups,
|
||||
...(await userSkills()),
|
||||
...(await userSkills(season!.nth)),
|
||||
});
|
||||
|
||||
const compatibleGroups = groupIsFull
|
||||
|
||||
@@ -13,7 +13,6 @@ import { Main } from "~/components/Main";
|
||||
import { SubNav, SubNavLink } from "~/components/SubNav";
|
||||
import { db } from "~/db";
|
||||
import { countArtByUserId } from "~/features/art";
|
||||
import { currentSeason } from "~/features/mmr";
|
||||
import { userTopPlacements } from "~/features/top-search";
|
||||
import { findVods } from "~/features/vods";
|
||||
import { useTranslation } from "~/hooks/useTranslation";
|
||||
|
||||
Reference in New Issue
Block a user