Skip to content

Commit a6b1f3d

Browse files
committed
fix: update difficulty classification to match 1★=easy, 2-3★=medium, 4-5★=hard
1 parent e1a49c4 commit a6b1f3d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/components/ChallengeListPage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ const ChallengeListPage = () => {
214214
if (difficultyParams.length === 1) {
215215
const diffParam = difficultyParams[0];
216216
if (diffParam === 'easy') {
217-
difficultyParams = ['1', '2'];
217+
difficultyParams = ['1'];
218218
} else if (diffParam === 'medium') {
219-
difficultyParams = ['3', '4'];
219+
difficultyParams = ['2', '3'];
220220
} else if (diffParam === 'hard') {
221-
difficultyParams = ['5'];
221+
difficultyParams = ['4', '5'];
222222
}
223223
}
224224

src/components/HomePage/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { useMediaQuery } from 'react-responsive';
1111
const getDifficultyCounts = () => {
1212
const counts = { easy: 0, medium: 0, hard: 0 };
1313
challenges.forEach(challenge => {
14-
// 匹配挑战列表页面的难度分类:
15-
// easy: 1-2星, medium: 3-4星, hard: 5星
16-
if (challenge.difficulty <= 2) counts.easy++;
17-
else if (challenge.difficulty <= 4) counts.medium++;
18-
else if (challenge.difficulty === 5) counts.hard++;
14+
// 匹配新的难度分类:
15+
// easy: 1星, medium: 2-3星, hard: 4-5星
16+
if (challenge.difficulty === 1) counts.easy++;
17+
else if (challenge.difficulty === 2 || challenge.difficulty === 3) counts.medium++;
18+
else if (challenge.difficulty >= 4) counts.hard++;
1919
});
2020
return counts;
2121
};

0 commit comments

Comments
 (0)