File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export const QuizMode: React.FC = observer(() => {
5151 gameStore . allFlags . filter ( f => f . country !== gameStore . currentFlag ?. country ) ,
5252 gameStore . currentFlag ,
5353 3 ,
54- gameStore . originalFlags ,
54+ gameStore . allFlags ,
5555 settingsStore . difficulty
5656 ) ;
5757
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ interface GameState {
1010 isReplayMode : boolean ;
1111 elapsedTime : number ;
1212 nextFlag : Flag | null ;
13+ allFlags : Flag [ ] ;
1314 quizState : {
1415 options : string [ ] ;
1516 translatedOptions : string [ ] ;
Original file line number Diff line number Diff line change @@ -66,7 +66,8 @@ export class GameStore {
6666 quizState : this . quizState ,
6767 typeState : this . typeState ,
6868 elapsedTime : this . elapsedTime ,
69- nextFlag : this . nextFlag
69+ nextFlag : this . nextFlag ,
70+ allFlags : this . allFlags
7071 } ) ;
7172 }
7273
@@ -114,7 +115,12 @@ export class GameStore {
114115 if ( ! answerIsCorrect ) {
115116 this . incorrectFlags . push ( this . currentFlag ! ) ;
116117 }
117-
118+ } ) ;
119+
120+ // Wait for animations to complete before updating flags
121+ await new Promise ( resolve => setTimeout ( resolve , 300 ) ) ;
122+
123+ runInAction ( ( ) => {
118124 // Remove the current flag from remaining flags
119125 this . remainingFlags = this . remainingFlags . slice ( 1 ) ;
120126
@@ -182,7 +188,7 @@ export class GameStore {
182188 }
183189
184190 get scorePercentage ( ) : string {
185- let answeredFlags = this . allFlags . length - this . remainingFlags . length ;
191+ const answeredFlags = this . allFlags . length - this . remainingFlags . length ;
186192 if ( answeredFlags === 0 ) return '0' ;
187193 return ( ( this . correctCount / answeredFlags ) * 100 ) . toFixed ( 0 ) ;
188194 }
You can’t perform that action at this time.
0 commit comments