Skip to content

Commit

Permalink
fixed quiz size on start a new attemp case
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoAlmeida-dev committed Mar 16, 2023
1 parent e16fcf0 commit 3015d05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions lib/pages/quiz/quiz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Quiz extends StatefulWidget {
final int quizNumber;
final int numQuestions;

Quiz({
const Quiz({
Key? key,
required this.trialNumber,
required this.quizNumber,
Expand Down Expand Up @@ -82,7 +82,11 @@ class _QuizState extends State<Quiz> {
Map answer = {"choices": selectedAnswerIds};
LoggerService.instance.debug(answer.toString());
submitted = await QuizService.answerQuestion(
widget.quizNumber, widget.trialNumber, question, answer);
widget.quizNumber,
widget.trialNumber,
question,
answer,
);
if (submitted) {
timer?.cancel();
}
Expand Down Expand Up @@ -159,8 +163,11 @@ class _QuizState extends State<Quiz> {
Text(
"${AppLocalizations.of(context)!.quizPointsOfTrial}: ${response["trial_score"]}"),
DynamicTextButton(
onPressed: Navigator.of(context).pop,
child: Text(AppLocalizations.of(context)!.back)),
onPressed: Navigator.of(context).pop,
child: Text(
AppLocalizations.of(context)!.back,
),
),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/quiz/quiz_list_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class _QuizListState extends State<QuizList> {
isTrialLoading = false;

int newTrialNumber = newTrialInfo["trial_number"];
int numQuestions = newTrialInfo["numQuestions"] ?? 1000;
int numQuestions = newTrialInfo["quiz_size"] ?? 0;
LoggerService.instance.debug(newTrialInfo);
if (mounted) {
Navigator.of(context)
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/quiz/quiz_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../widgets/dialogs/CustomDialogs.dart';

//Main for isolated testing
void main() {
runApp(MaterialApp(
runApp(const MaterialApp(
home: QuizPage(
quizNumber: 1,
trialNumber: 1,
Expand All @@ -21,7 +21,7 @@ class QuizPage extends StatefulWidget {
final int trialNumber;
final int numQuestions;

QuizPage({
const QuizPage({
Key? key,
required this.quizNumber,
required this.trialNumber,
Expand Down

0 comments on commit 3015d05

Please sign in to comment.