From 007a03b05d0b849dc47fd3742077c1fd1e1aef7b Mon Sep 17 00:00:00 2001
From: Kalle <38327916+Sendouc@users.noreply.github.com>
Date: Fri, 4 Mar 2022 21:19:57 +0200
Subject: [PATCH] Clean up unused code
---
app/components/play/GroupCard.tsx | 6 ------
app/constants.ts | 1 -
app/core/mmr/utils.ts | 8 --------
app/core/play/utils.ts | 16 +---------------
app/routes/play/looking.tsx | 17 +----------------
5 files changed, 2 insertions(+), 46 deletions(-)
diff --git a/app/components/play/GroupCard.tsx b/app/components/play/GroupCard.tsx
index 27e522be2..56e4dd0ea 100644
--- a/app/components/play/GroupCard.tsx
+++ b/app/components/play/GroupCard.tsx
@@ -68,12 +68,6 @@ export function GroupCard({
)}
- {group.teamMMR && (
-
- SP: {!group.teamMMR.exact && <>~>}
- {group.teamMMR.value}
-
- )}
{group.MMRRelation && !group.replay && (
)}
diff --git a/app/constants.ts b/app/constants.ts
index f530891a5..1b7e04f00 100644
--- a/app/constants.ts
+++ b/app/constants.ts
@@ -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;
diff --git a/app/core/mmr/utils.ts b/app/core/mmr/utils.ts
index 8d0040bc4..36671de8b 100644
--- a/app/core/mmr/utils.ts
+++ b/app/core/mmr/utils.ts
@@ -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));
}
diff --git a/app/core/play/utils.ts b/app/core/play/utils.ts
index a718939cb..d3a3c1e9e 100644
--- a/app/core/play/utils.ts
+++ b/app/core/play/utils.ts
@@ -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;
- 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(
diff --git a/app/routes/play/looking.tsx b/app/routes/play/looking.tsx
index f7457632f..5b6278bf5 100644
--- a/app/routes/play/looking.tsx
+++ b/app/routes/play/looking.tsx
@@ -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,