Skip to content

Commit d53f646

Browse files
authored
Update index.html
1 parent 7f5109c commit d53f646

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

analyze/index.html

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -649,38 +649,33 @@ <h2 class="modal-title" id="modalTitle"></h2>
649649

650650
modalTitle.textContent = difficultyRange + ' Difficulty Problems';
651651

652-
// Get submissions for this difficulty range
652+
// Step 1: Get all problem keys for this difficulty
653653
const rangeObj = difficultyRanges.find(r => r.label === difficultyRange);
654-
const relevantSubmissions = allSubmissions.filter(sub => {
655-
const problemKey = `${sub.problem.contestId}${sub.problem.index}`;
656-
const difficulty = problemDifficulties[problemKey];
657-
if (!difficulty) return false;
658-
659-
const submissionRange = getDifficultyRange(difficulty);
660-
return submissionRange.label === difficultyRange;
654+
const matchingProblemKeys = new Set();
655+
Object.entries(problemDifficulties).forEach(([key, rating]) => {
656+
const range = getDifficultyRange(rating);
657+
if (range.label === difficultyRange) {
658+
matchingProblemKeys.add(key);
659+
}
661660
});
662661

663-
// Group submissions by problem
662+
// Step 2: Group all submissions (even if not part of analysis) that match those problems
664663
const problemMap = {};
665-
relevantSubmissions.forEach(sub => {
666-
const problemKey = `${sub.problem.contestId}${sub.problem.index}`;
667-
if (!problemMap[problemKey]) {
668-
problemMap[problemKey] = {
664+
allSubmissions.forEach(sub => {
665+
const key = `${sub.problem.contestId}${sub.problem.index}`;
666+
if (!matchingProblemKeys.has(key)) return;
667+
668+
if (!problemMap[key]) {
669+
problemMap[key] = {
669670
problem: sub.problem,
670671
contestId: sub.problem.contestId,
671672
index: sub.problem.index,
672-
difficulty: problemDifficulties[problemKey],
673-
inContestSubmissions: [],
674-
outOfContestSubmissions: []
673+
difficulty: problemDifficulties[key],
674+
submissions: []
675675
};
676676
}
677677

678-
// Categorize submissions
679-
if (sub.author.participantType === 'CONTESTANT') {
680-
problemMap[problemKey].inContestSubmissions.push(sub);
681-
} else {
682-
problemMap[problemKey].outOfContestSubmissions.push(sub);
683-
}
678+
problemMap[key].submissions.push(sub);
684679
});
685680

686681
// Sort problems by contest ID and index
@@ -694,12 +689,10 @@ <h2 class="modal-title" id="modalTitle"></h2>
694689
// Create HTML
695690
let html = '';
696691
problems.forEach(problemData => {
697-
const { problem, difficulty, inContestSubmissions, outOfContestSubmissions } = problemData;
692+
const { problem, difficulty, submissions } = problemData;
698693
const problemUrl = `https://codeforces.com/problemset/problem/${problem.contestId}/${problem.index}`;
699-
700-
// Combine and sort all submissions chronologically
701-
const allProblemSubmissions = [...inContestSubmissions, ...outOfContestSubmissions]
702-
.sort((a, b) => a.creationTimeSeconds - b.creationTimeSeconds);
694+
695+
const allProblemSubmissions = submissions.sort((a, b) => a.creationTimeSeconds - b.creationTimeSeconds);
703696

704697
html += `
705698
<div class="problem-item">
@@ -803,8 +796,12 @@ <h2 class="modal-title" id="modalTitle"></h2>
803796
return;
804797
}
805798

806-
// Store all submissions for drill-down
807-
allSubmissions = contestSubmissions;
799+
// Store all matching submissions regardless of contest type for problem drill-down
800+
allSubmissions = submissions.filter(sub => {
801+
if (!sub.contestId || !problemDifficulties[`${sub.problem.contestId}${sub.problem.index}`]) return false;
802+
if (!isWithinDateRange(sub.creationTimeSeconds, startDate, endDate)) return false;
803+
return true;
804+
});
808805

809806
// Analyze by difficulty
810807
const analysis = analyzeDifficultyPerformance(contestSubmissions);

0 commit comments

Comments
 (0)