|
|
|
|
@ -221,19 +221,19 @@ class MarathonProvider extends ChangeNotifier {
|
|
|
|
|
getCorrectAnswerAndUpdateAnswerColor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (totalCurrentQuestionTime == currentGapTime) {
|
|
|
|
|
if (totalCurrentQuestionTime - currentGapTime == -2) {
|
|
|
|
|
updateCardStatusToAnswer();
|
|
|
|
|
|
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
|
if (AppState().getIsDemoMarathon || isUserOutOfGame) {
|
|
|
|
|
await callNextQuestionApi();
|
|
|
|
|
} else {
|
|
|
|
|
await callSubmitOptionApi().then((bool value) async {
|
|
|
|
|
updateIsUserOutOfGame = !value;
|
|
|
|
|
await callNextQuestionApi();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// scheduleMicrotask(() async {
|
|
|
|
|
// if (AppState().getIsDemoMarathon || isUserOutOfGame) {
|
|
|
|
|
// await callNextQuestionApi();
|
|
|
|
|
// } else {
|
|
|
|
|
// await callSubmitOptionApi().then((bool value) async {
|
|
|
|
|
// updateIsUserOutOfGame = !value;
|
|
|
|
|
// await callNextQuestionApi();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
if (currentQuestionNumber == (AppState().getIsDemoMarathon ? demoMarathonDetailModel.totalQuestions! : marathonDetailModel.totalQuestions!)) {
|
|
|
|
|
isGettingQualifiers = true;
|
|
|
|
|
@ -253,7 +253,7 @@ class MarathonProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
if (totalCurrentQuestionTime != currentGapTime) {
|
|
|
|
|
if (totalCurrentQuestionTime - currentGapTime != -2) {
|
|
|
|
|
totalCurrentQuestionTime--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -414,11 +414,32 @@ class MarathonProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
void getCorrectAnswerAndUpdateAnswerColor() {
|
|
|
|
|
if (selectedOptionIndex != null) {
|
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
|
if (AppState().getIsDemoMarathon) {
|
|
|
|
|
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
|
|
|
|
|
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, selectedOptionIndex!);
|
|
|
|
|
} else {
|
|
|
|
|
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.wrong, selectedOptionIndex!);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
await callSubmitOptionApi().then((bool value) async {
|
|
|
|
|
updateIsUserOutOfGame = !value;
|
|
|
|
|
if (value) {
|
|
|
|
|
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, selectedOptionIndex!);
|
|
|
|
|
} else {
|
|
|
|
|
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.wrong, selectedOptionIndex!);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (!AppState().getIsDemoMarathon) {
|
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
|
await callSubmitOptionApi().then((bool value) async {
|
|
|
|
|
updateIsUserOutOfGame = !value;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -427,7 +448,16 @@ class MarathonProvider extends ChangeNotifier {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selectedOptionIndex != null) {
|
|
|
|
|
scheduleMicrotask(() async {
|
|
|
|
|
await callNextQuestionApi();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (selectedOptionIndex == null) {
|
|
|
|
|
updateQuestionCardStatus(QuestionCardStatus.skippedAnswer);
|
|
|
|
|
updateAnswerStatusesList(QuestionCardStatus.skippedAnswer);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (AppState().getIsDemoMarathon) {
|
|
|
|
|
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
|
|
|
|
|
updateQuestionCardStatus(QuestionCardStatus.correctAnswer);
|
|
|
|
|
updateAnswerStatusesList(QuestionCardStatus.correctAnswer);
|
|
|
|
|
@ -435,10 +465,15 @@ class MarathonProvider extends ChangeNotifier {
|
|
|
|
|
updateQuestionCardStatus(QuestionCardStatus.wrongAnswer);
|
|
|
|
|
updateAnswerStatusesList(QuestionCardStatus.wrongAnswer);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
updateQuestionCardStatus(QuestionCardStatus.skippedAnswer);
|
|
|
|
|
updateAnswerStatusesList(QuestionCardStatus.skippedAnswer);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!isUserOutOfGame) {
|
|
|
|
|
updateQuestionCardStatus(QuestionCardStatus.correctAnswer);
|
|
|
|
|
updateAnswerStatusesList(QuestionCardStatus.correctAnswer);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
updateQuestionCardStatus(QuestionCardStatus.wrongAnswer);
|
|
|
|
|
updateAnswerStatusesList(QuestionCardStatus.wrongAnswer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void resetValues() async {
|
|
|
|
|
|