Skip to content

Commit 7f3ff66

Browse files
authored
Merge pull request #1089 from kichi2004/feature/fix-abc-ex
ABC の Ex 問題の配置を修正
2 parents c90811e + 14ca098 commit 7f3ff66

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

atcoder-problems-frontend/src/pages/TablePage/AtCoderRegularTable.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
combineTableColorList,
1818
} from "../../utils/TableColor";
1919
import { ProblemLink } from "../../components/ProblemLink";
20-
import { ContestLink } from "../../components/ContestLink";
20+
import { ContestLink, getRatedTarget } from "../../components/ContestLink";
2121
import ProblemModel from "../../interfaces/ProblemModel";
2222
import { SubmitTimespan } from "../../components/SubmitTimespan";
2323
import { RatingInfo } from "../../utils/RatingInfo";
@@ -36,9 +36,11 @@ interface Props {
3636
userRatingInfo: RatingInfo;
3737
}
3838

39-
const getProblemHeaderAlphabetFromTitle = (problem: MergedProblem) => {
39+
const getProblemHeaderAlphabet = (problem: MergedProblem, contest: Contest) => {
4040
const list = problem.title.split(".");
41-
return list.length === 0 ? "" : list[0];
41+
if (list.length === 0) return "";
42+
if (list[0] === "H" && getRatedTarget(contest) < 2000) return "Ex";
43+
return list[0];
4244
};
4345

4446
const AtCoderRegularTableSFC: React.FC<Props> = (props) => {
@@ -80,7 +82,7 @@ const AtCoderRegularTableSFC: React.FC<Props> = (props) => {
8082
});
8183
const problemStatus = new Map(
8284
problemStatusList.map((status) => {
83-
const alphabet = getProblemHeaderAlphabetFromTitle(status.problem);
85+
const alphabet = getProblemHeaderAlphabet(status.problem, contest);
8486
return [alphabet, status];
8587
})
8688
);
@@ -107,11 +109,17 @@ const AtCoderRegularTableSFC: React.FC<Props> = (props) => {
107109
);
108110

109111
const headerList = props.contests
110-
.flatMap((contest) => props.contestToProblems.get(contest.id) ?? [])
111-
.map((problem) => getProblemHeaderAlphabetFromTitle(problem))
112+
.flatMap((contest) =>
113+
(props.contestToProblems.get(contest.id) ?? []).map((problem) =>
114+
getProblemHeaderAlphabet(problem, contest)
115+
)
116+
)
112117
.filter((alphabet) => alphabet.length > 0);
113118

114-
const header = Array.from(new Set(headerList)).sort();
119+
let header = Array.from(new Set(headerList));
120+
if (header.includes("Ex"))
121+
header = header.filter((c) => c != "Ex").concat("Ex");
122+
115123
return (
116124
<Row className="my-4">
117125
<h2>{props.title}</h2>

0 commit comments

Comments
 (0)