mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 07:37:55 -05:00
Clean up unused code
This commit is contained in:
@@ -68,12 +68,6 @@ export function GroupCard({
|
||||
</div>
|
||||
)}
|
||||
<GroupMembers members={group.members} />
|
||||
{group.teamMMR && (
|
||||
<div className="play__card__mmr">
|
||||
SP: {!group.teamMMR.exact && <>~</>}
|
||||
{group.teamMMR.value}
|
||||
</div>
|
||||
)}
|
||||
{group.MMRRelation && !group.replay && (
|
||||
<MMRRelation relation={group.MMRRelation} />
|
||||
)}
|
||||
|
||||
@@ -21,7 +21,6 @@ export const LFG_GROUP_INACTIVE_MINUTES = 30;
|
||||
export const MMR_TOPX_VISIBILITY_CUTOFF = 50;
|
||||
|
||||
export const LFG_AMOUNT_OF_STAGES_TO_GENERATE = 7;
|
||||
// export const LFG_AMOUNT_OF_STAGES_TO_GENERATE = 9;
|
||||
|
||||
export const CLOSE_MMR_LIMIT = 250;
|
||||
export const BIT_HIGHER_MMR_LIMIT = 750;
|
||||
|
||||
@@ -63,14 +63,6 @@ export function teamSkillToExactMMR(teamSkills: TeamSkill[]) {
|
||||
return toTwoDecimals(sum);
|
||||
}
|
||||
|
||||
export function teamSkillToApproximateMMR(teamSkills: TeamSkill[]) {
|
||||
// https://stackoverflow.com/a/58147484
|
||||
const roundToNearest25 = (x: number) => Math.round(x / 25) * 25;
|
||||
|
||||
const teamMMR = teamSkillToExactMMR(teamSkills);
|
||||
return roundToNearest25(teamMMR);
|
||||
}
|
||||
|
||||
export function toTwoDecimals(value: number) {
|
||||
return Number(value.toFixed(2));
|
||||
}
|
||||
|
||||
@@ -13,11 +13,7 @@ import {
|
||||
LookingLoaderDataGroup,
|
||||
} from "~/routes/play/looking";
|
||||
import { Unpacked } from "~/utils";
|
||||
import {
|
||||
skillArrayToMMR,
|
||||
teamSkillToApproximateMMR,
|
||||
teamSkillToExactMMR,
|
||||
} from "../mmr/utils";
|
||||
import { skillArrayToMMR, teamSkillToExactMMR } from "../mmr/utils";
|
||||
import { canUniteWithGroup } from "./validators";
|
||||
|
||||
export interface UniteGroupInfoArg {
|
||||
@@ -132,7 +128,6 @@ export function otherGroupsForResponse({
|
||||
likes,
|
||||
lookingForMatch,
|
||||
ownGroup,
|
||||
useRelativeSkillLevel,
|
||||
recentMatch,
|
||||
user,
|
||||
}: {
|
||||
@@ -143,7 +138,6 @@ export function otherGroupsForResponse({
|
||||
};
|
||||
lookingForMatch: boolean;
|
||||
ownGroup: Unpacked<LFGGroup.FindLookingAndOwnActive>;
|
||||
useRelativeSkillLevel: boolean;
|
||||
recentMatch: LFGMatch.RecentOfUser;
|
||||
user: { id: string };
|
||||
}) {
|
||||
@@ -188,17 +182,9 @@ export function otherGroupsForResponse({
|
||||
MMRRelation:
|
||||
ownGroup.ranked &&
|
||||
group.ranked &&
|
||||
useRelativeSkillLevel &&
|
||||
group.members.length === LFG_GROUP_FULL_SIZE
|
||||
? resolveMMRRelation({ group, ownGroup })
|
||||
: undefined,
|
||||
teamMMR:
|
||||
lookingForMatch && group.ranked && !useRelativeSkillLevel
|
||||
? {
|
||||
exact: false,
|
||||
value: teamSkillToApproximateMMR(group.members),
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
})
|
||||
.reduce(
|
||||
|
||||
@@ -16,7 +16,7 @@ import { GroupCard } from "~/components/play/GroupCard";
|
||||
import { LookingInfoText } from "~/components/play/LookingInfoText";
|
||||
import { Tab } from "~/components/Tab";
|
||||
import { LFG_GROUP_FULL_SIZE } from "~/constants";
|
||||
import { skillArrayToMMR, teamSkillToExactMMR } from "~/core/mmr/utils";
|
||||
import { skillArrayToMMR } from "~/core/mmr/utils";
|
||||
import { addInfoFromOldSendouInk } from "~/core/play/playerInfos/playerInfos.server";
|
||||
import {
|
||||
groupExpirationStatus,
|
||||
@@ -36,8 +36,6 @@ import {
|
||||
validate,
|
||||
} from "~/utils";
|
||||
|
||||
const USE_RELATIVE_SKILL_LEVEL = true;
|
||||
|
||||
export const links: LinksFunction = () => {
|
||||
return [{ rel: "stylesheet", href: styles }];
|
||||
};
|
||||
@@ -214,10 +212,6 @@ export type LookingLoaderDataGroup = {
|
||||
peakXP?: number;
|
||||
peakLP?: number;
|
||||
})[];
|
||||
teamMMR?: {
|
||||
exact: boolean;
|
||||
value: number;
|
||||
};
|
||||
MMRRelation?: "LOWER" | "BIT_LOWER" | "CLOSE" | "BIT_HIGHER" | "HIGHER";
|
||||
ranked?: boolean;
|
||||
replay?: boolean;
|
||||
@@ -253,7 +247,6 @@ export const loader: LoaderFunction = async ({ context }) => {
|
||||
|
||||
const groupsOfType = groups.filter((g) => g.type === ownGroup.type);
|
||||
|
||||
const isRanked = groupsOfType.some((g) => g.ranked);
|
||||
const ownGroupWithMembers = groupsOfType.find((g) => g.id === ownGroup.id);
|
||||
invariant(ownGroupWithMembers, "ownGroupWithMembers is undefined");
|
||||
|
||||
@@ -276,13 +269,6 @@ export const loader: LoaderFunction = async ({ context }) => {
|
||||
};
|
||||
}),
|
||||
ranked: ownGroup.ranked ?? undefined,
|
||||
teamMMR:
|
||||
lookingForMatch && isRanked && !USE_RELATIVE_SKILL_LEVEL
|
||||
? {
|
||||
exact: true,
|
||||
value: teamSkillToExactMMR(ownGroupWithMembers.members),
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
type: ownGroup.type,
|
||||
isCaptain: isGroupAdmin({ group: ownGroup, user }),
|
||||
@@ -290,7 +276,6 @@ export const loader: LoaderFunction = async ({ context }) => {
|
||||
...otherGroupsForResponse({
|
||||
recentMatch,
|
||||
user,
|
||||
useRelativeSkillLevel: USE_RELATIVE_SKILL_LEVEL,
|
||||
groups: groupsOfType,
|
||||
lookingForMatch,
|
||||
ownGroup,
|
||||
|
||||
Reference in New Issue
Block a user