We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 174233c commit 6596178Copy full SHA for 6596178
src/components/HomePage/index.tsx
@@ -11,9 +11,11 @@ import { useMediaQuery } from 'react-responsive';
11
const getDifficultyCounts = () => {
12
const counts = { easy: 0, medium: 0, hard: 0 };
13
challenges.forEach(challenge => {
14
- if (challenge.difficulty === 1) counts.easy++;
15
- else if (challenge.difficulty === 2) counts.medium++;
16
- else if (challenge.difficulty === 3) counts.hard++;
+ // 匹配挑战列表页面的难度分类:
+ // easy: 1-2星, medium: 3-4星, hard: 5星
+ if (challenge.difficulty <= 2) counts.easy++;
17
+ else if (challenge.difficulty <= 4) counts.medium++;
18
+ else if (challenge.difficulty === 5) counts.hard++;
19
});
20
return counts;
21
};
0 commit comments