@@ -6,21 +6,14 @@ import { useProgressiveLogic } from "../utils/useProgressiveLogic";
66import SingleMode from " ../components/SingleMode.vue" ;
77import { progressiveKeys } from " ../utils/pinyin" ;
88
9- const CONFIG = {
10- TARGET_ACCURACY: 0.95 ,
11- TARGET_COUNT: 20 ,
12- TARGET_SPEED: 35 ,
13- };
14-
159const getTargetCount = (index : number ) => {
1610 const PREVIEW_SIZE = 10 ;
1711 const MIN_TRAINING_SIZE = 15 ;
1812 const difficultyBonus = Math .floor (index / 3 ) * 5 ;
1913 return PREVIEW_SIZE + MIN_TRAINING_SIZE + difficultyBonus ;
2014};
21-
2215const store = useStore ();
23- const { currentProgressiveIndex } = storeToRefs (store );
16+ const { currentProgressiveIndex, settings } = storeToRefs (store );
2417const singleModeRef = ref ();
2518
2619const { hanziList, getNextChar } = useProgressiveLogic (currentProgressiveIndex );
@@ -32,17 +25,20 @@ const isPerformanceMet = (stats: {
3225}) => {
3326 const targetCount = getTargetCount (currentProgressiveIndex .value );
3427 const currentKey = progressiveKeys [currentProgressiveIndex .value ];
28+
29+ const targetAcc = settings .value .targetAccuracy / 100 ;
30+ const targetSpd = settings .value .targetSpeed ;
31+
3532 const keyStat = latestKeysAccuracy .value .find (
3633 (item ) => item .key === currentKey ,
3734 );
38- const isKeyMastered = keyStat
39- ? keyStat .accuracy >= CONFIG .TARGET_ACCURACY
40- : false ;
35+
36+ const isKeyMastered = keyStat ? keyStat .accuracy >= targetAcc : false ;
4137
4238 return (
43- stats .accuracy >= CONFIG . TARGET_ACCURACY &&
39+ stats .accuracy >= targetAcc &&
4440 isKeyMastered &&
45- stats .speed >= CONFIG . TARGET_SPEED &&
41+ stats .speed >= targetSpd &&
4642 stats .count >= targetCount
4743 );
4844};
0 commit comments