mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-12 22:26:12 -05:00
Reshow ranked team MMR's
This commit is contained in:
@@ -47,6 +47,19 @@ function toTwoDecimals(value: number) {
|
||||
return Number(value.toFixed(2));
|
||||
}
|
||||
|
||||
export function teamHasSkill(teamSkills: TeamSkill[]) {
|
||||
let hasSkill = false;
|
||||
|
||||
for (const { user } of teamSkills) {
|
||||
if (user.skill.length > 0) {
|
||||
hasSkill = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hasSkill;
|
||||
}
|
||||
|
||||
interface AdjustSkill {
|
||||
mu: number;
|
||||
sigma: number;
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Tab } from "~/components/Tab";
|
||||
import { LFG_GROUP_FULL_SIZE } from "~/constants";
|
||||
import {
|
||||
skillToMMR,
|
||||
teamHasSkill,
|
||||
teamSkillToApproximateMMR,
|
||||
teamSkillToExactMMR,
|
||||
} from "~/core/mmr/utils";
|
||||
@@ -223,7 +224,7 @@ export const loader: LoaderFunction = async ({ context }) => {
|
||||
new Set<string>()
|
||||
);
|
||||
|
||||
const isRanked = groupsOfType.every((g) => g.ranked);
|
||||
const isRanked = groupsOfType.some((g) => g.ranked);
|
||||
const ownGroupWithMembers = groupsOfType.find((g) => g.id === ownGroup.id);
|
||||
invariant(ownGroupWithMembers, "ownGroupWithMembers is undefined");
|
||||
const ownGroupForResponse: LookingLoaderDataGroup = {
|
||||
@@ -238,7 +239,7 @@ export const loader: LoaderFunction = async ({ context }) => {
|
||||
}),
|
||||
ranked: ownGroup.ranked ?? undefined,
|
||||
teamMMR:
|
||||
lookingForMatch && isRanked
|
||||
lookingForMatch && isRanked && teamHasSkill(ownGroupWithMembers.members)
|
||||
? {
|
||||
exact: true,
|
||||
value: teamSkillToExactMMR(ownGroupWithMembers.members),
|
||||
@@ -289,7 +290,7 @@ export const loader: LoaderFunction = async ({ context }) => {
|
||||
}),
|
||||
ranked: ranked(),
|
||||
teamMMR:
|
||||
lookingForMatch && isRanked
|
||||
lookingForMatch && group.ranked && teamHasSkill(group.members)
|
||||
? {
|
||||
exact: false,
|
||||
value: teamSkillToApproximateMMR(group.members),
|
||||
|
||||
Reference in New Issue
Block a user