From dda12528e388c2355ee61908300f937bcca06bb4 Mon Sep 17 00:00:00 2001 From: Atsuya Uchida Date: Fri, 20 Jan 2023 04:30:10 +0900 Subject: [PATCH 1/3] added contest tabs to ProblemSetGenerator. --- .../src/components/ProblemSetGenerator.tsx | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx b/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx index f643b1dfb..b0382db71 100644 --- a/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx +++ b/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx @@ -1,5 +1,6 @@ import { Button, + ButtonGroup, Col, DropdownItem, DropdownMenu, @@ -90,6 +91,15 @@ export const ProblemSetGenerator: React.FC = (props) => { ); const [excludeExperimental, setExcludeExperimental] = useState(false); const [excludeOption, setExcludeOption] = useState("Exclude"); + const [contestTypeOption, setContestTypeOption] = useState({ + ABC: true, + ARC: true, + AGC: true, + ABC_Like: true, + ARC_Like: true, + AGC_Like: true, + Other_Sponsored: true, + }); const [selectedPreset, setSelectedPreset] = useState(ABC_PRESET); const problems = useProblems() ?? []; const problemModels = useProblemModelMap(); @@ -98,6 +108,16 @@ export const ProblemSetGenerator: React.FC = (props) => { const alreadySolvedProblemIds = new Set(submissions.map((s) => s.problem_id)); const lastSolvedTimeMap = getLastSolvedTimeMap(submissions); + const contestTypeKeyToDisplayName = (key: string) => { + if (key.includes("Like")) { + return key.replace("_", "-"); + } else if (key === "Other_Sponsored") { + return "Other Sponsored"; + } else { + return key; + } + }; + return (
@@ -142,6 +162,31 @@ export const ProblemSetGenerator: React.FC = (props) => { + + + + + + {Object.keys(contestTypeOption).map((contestType) => { + return ( + + ); + })} + + + + From f9e01e662155b896907591d272ceece83e6f8341 Mon Sep 17 00:00:00 2001 From: Atsuya Uchida Date: Fri, 20 Jan 2023 05:33:12 +0900 Subject: [PATCH 2/3] added filter for virtual contests problems. --- .../src/components/ProblemSetGenerator.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx b/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx index b0382db71..ad82a8110 100644 --- a/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx +++ b/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx @@ -16,11 +16,13 @@ import { } from "reactstrap"; import React, { useState } from "react"; import { + useContests, useMultipleUserSubmissions, useProblemModelMap, useProblems, } from "../api/APIClient"; import Problem from "../interfaces/Problem"; +import Contest from "../interfaces/Contest"; import { shuffleArray } from "../utils"; import { ExcludeOption, @@ -30,6 +32,7 @@ import { getLastSolvedTimeMap, getMaximumExcludeElapsedSecond, } from "../utils/LastSolvedTime"; +import { classifyContest } from "../utils/ContestClassifier"; import { isProblemModelWithDifficultyModel } from "../interfaces/ProblemModel"; interface Props { @@ -107,6 +110,7 @@ export const ProblemSetGenerator: React.FC = (props) => { useMultipleUserSubmissions(props.expectedParticipantUserIds).data ?? []; const alreadySolvedProblemIds = new Set(submissions.map((s) => s.problem_id)); const lastSolvedTimeMap = getLastSolvedTimeMap(submissions); + const { data: contests } = useContests(); const contestTypeKeyToDisplayName = (key: string) => { if (key.includes("Like")) { @@ -323,6 +327,26 @@ export const ProblemSetGenerator: React.FC = (props) => { }); } + let candidateContests: Contest[] = []; + Object.keys(contestTypeOption).forEach((contestType) => { + if (contestTypeOption[contestType]) { + const filteredContests = contests.filter((contest) => { + return ( + contestTypeKeyToDisplayName(contestType) === + classifyContest(contest) + ); + }); + candidateContests = candidateContests.concat( + filteredContests + ); + } + }); + candidateProblems = candidateProblems.filter((p) => { + return candidateContests + .map((contest) => contest.id) + .includes(p.problem.contest_id); + }); + candidateProblems = candidateProblems.filter((p) => { if (excludeOption === "Exclude submitted") { return !alreadySolvedProblemIds.has(p.problem.id); From 4cc9649897dbcc8f5e5a2fb2a533d10a8898a7eb Mon Sep 17 00:00:00 2001 From: Atsuya Uchida Date: Fri, 20 Jan 2023 06:03:02 +0900 Subject: [PATCH 3/3] Removed Other Sponsored from filter tab on Virtual Contests. --- .../src/components/ProblemSetGenerator.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx b/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx index ad82a8110..9a67bf3c2 100644 --- a/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx +++ b/atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx @@ -101,7 +101,6 @@ export const ProblemSetGenerator: React.FC = (props) => { ABC_Like: true, ARC_Like: true, AGC_Like: true, - Other_Sponsored: true, }); const [selectedPreset, setSelectedPreset] = useState(ABC_PRESET); const problems = useProblems() ?? []; @@ -115,8 +114,6 @@ export const ProblemSetGenerator: React.FC = (props) => { const contestTypeKeyToDisplayName = (key: string) => { if (key.includes("Like")) { return key.replace("_", "-"); - } else if (key === "Other_Sponsored") { - return "Other Sponsored"; } else { return key; }