From d42eb29cade6dc67c52ac50fd467ec335e2e3584 Mon Sep 17 00:00:00 2001 From: hotate29 Date: Fri, 9 Feb 2024 03:05:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=95=E3=83=AD=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=83=89=E3=81=AB=E3=81=8A=E3=81=91=E3=82=8B?= =?UTF-8?q?Algo=20Rated=E3=81=AE=E5=88=A4=E5=AE=9A=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E3=82=92=E3=83=90=E3=83=83=E3=82=AF=E3=82=A8=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=81=A8=E5=90=8C=E7=AD=89=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- atcoder-problems-frontend/src/utils/ContestClassifier.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atcoder-problems-frontend/src/utils/ContestClassifier.ts b/atcoder-problems-frontend/src/utils/ContestClassifier.ts index 705e6e1e7..2dba0acbd 100644 --- a/atcoder-problems-frontend/src/utils/ContestClassifier.ts +++ b/atcoder-problems-frontend/src/utils/ContestClassifier.ts @@ -27,7 +27,7 @@ export const isRatedContest = ( return ( contest.rate_change !== "-" && contest.start_epoch_second >= AGC_001_START && - problemCount >= 2 + problemCount >= 3 ); }; From 89c14827a13d068dabb886983c4f557a27d55cb2 Mon Sep 17 00:00:00 2001 From: hotate29 Date: Fri, 9 Feb 2024 03:10:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=AF=E3=82=A8?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=81=8B=E3=82=89=E5=8F=96=E5=BE=97=E3=81=97?= =?UTF-8?q?=E3=81=9FRated=20Point=20Sum=E3=82=92=E4=BD=BF=E3=81=86?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/UserPage/AchievementBlock/index.tsx | 37 ++----------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/atcoder-problems-frontend/src/pages/UserPage/AchievementBlock/index.tsx b/atcoder-problems-frontend/src/pages/UserPage/AchievementBlock/index.tsx index 58b650de9..6c7dfb170 100644 --- a/atcoder-problems-frontend/src/pages/UserPage/AchievementBlock/index.tsx +++ b/atcoder-problems-frontend/src/pages/UserPage/AchievementBlock/index.tsx @@ -2,8 +2,6 @@ import React from "react"; import { Badge, Col, Row, UncontrolledTooltip } from "reactstrap"; import { useUserACRank, - useContests, - useContestToProblems, useFastRanking, useFirstRanking, useProblemModelMap, @@ -12,22 +10,16 @@ import { useUserSumRank, useUserSubmission, } from "../../../api/APIClient"; -import { - caseInsensitiveUserId, - isAccepted, - ordinalSuffixOf, -} from "../../../utils"; +import { caseInsensitiveUserId, ordinalSuffixOf } from "../../../utils"; import { formatMomentDate, getToday } from "../../../utils/DateUtil"; import { RankingEntry } from "../../../interfaces/RankingEntry"; -import { ContestId, ProblemId } from "../../../interfaces/Status"; +import { ProblemId } from "../../../interfaces/Status"; import ProblemModel, { isProblemModelWithTimeModel, } from "../../../interfaces/ProblemModel"; import { calculateTopPlayerEquivalentEffort } from "../../../utils/ProblemModelUtil"; -import Problem from "../../../interfaces/Problem"; import * as UserUtils from "../UserUtils"; import { calcStreak, countUniqueAcByDate } from "../../../utils/StreakCounter"; -import { isRatedContest } from "../../../utils/ContestClassifier"; const findFromRanking = ( ranking: RankingEntry[], @@ -53,9 +45,6 @@ interface Props { } export const AchievementBlock: React.FC = (props) => { - const contests = useContests().data ?? []; - const contestToProblems = - useContestToProblems() ?? new Map(); const userSubmissions = useUserSubmission(props.userId) ?? []; const problemModels = useProblemModelMap(); const dailyCount = countUniqueAcByDate(userSubmissions); @@ -74,29 +63,9 @@ export const AchievementBlock: React.FC = (props) => { const firstRank = findFromRanking(firstRanking, props.userId); const fastRank = findFromRanking(fastRanking, props.userId); - const ratedProblemIds = new Set( - contests - .flatMap((contest) => { - const contestProblems = contestToProblems.get(contest.id); - const isRated = isRatedContest(contest, contestProblems?.length ?? 0); - return isRated && contestProblems ? contestProblems : []; - }) - .map((problem) => problem.id) - ); - const acceptedRatedSubmissions = userSubmissions - .filter((s) => isAccepted(s.result)) - .filter((s) => ratedProblemIds.has(s.problem_id)); - acceptedRatedSubmissions.sort((a, b) => a.id - b.id); - const ratedPointMap = new Map(); - acceptedRatedSubmissions.forEach((s) => { - ratedPointMap.set(s.problem_id, s.point); - }); - const ratedPointSum = Array.from(ratedPointMap.values()).reduce( - (sum, point) => sum + point, - 0 - ); const sumRankEntry = useUserSumRank(props.userId); const sumRank = sumRankEntry.data?.rank; + const ratedPointSum = sumRankEntry.data?.count; const achievements = [ {