Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #77

Merged
merged 3 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class QuizExerciseCubit extends Cubit<QuizExerciseState> {
if (duration == null) {
throw Exception('Duration for selected Challenge Group not found');
}
remainingDuration = duration * 60;
remainingDuration = (duration * 60.0).toInt();
timer = Timer.periodic(const Duration(seconds: 1), (timer) {
if (state is! QuizExerciseShow) {
timer.cancel();
Expand Down Expand Up @@ -176,6 +176,7 @@ class QuizExerciseCubit extends Cubit<QuizExerciseState> {

if (currentProblem.type == 'SHORT_ANSWER' &&
currentProblem.answer.correctAnswer
.map((answer) => answer.toLowerCase())
.contains(shortAnswer.trim().toLowerCase())) {
verdict = 'CORRECT';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _QuizResultPageState extends State<QuizResultPage> {
children: [
Text('Total Nilai: ${state.attempt.score}'),
Text(
'benar: ${state.attempt.totalCorrect}, salah: ${state.attempt.totalIncorrect}'),
'benar: ${state.attempt.totalCorrect}, salah: ${state.attempt.totalIncorrect + state.attempt.totalBlank}'),
const Text('MANTAP!!!')
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class _QuizStartPageState extends State<QuizStartPage> {
Text(
'Alokasi waktu: ${state.quiz.duration_minute[state.participation.challenge_group]} menit'),
Text(
'Sisa coba lagi ${state.participation.quiz_max_attempts - state.participation.attempts.length} / ${state.participation.quiz_max_attempts}'),
'Sisa coba lagi: ${state.participation.quiz_max_attempts - state.participation.attempts.length} dari ${state.participation.quiz_max_attempts} kesempatan'),
const SizedBox(
height: 10,
),
Expand Down
6 changes: 3 additions & 3 deletions app/lib/models/weekly_quiz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class WeeklyQuiz extends Equatable {
final String id;
final String title;
final String created_at;
final Map<String, int> duration_minute;
final Map<String, double> duration_minute;
final String end_at;
final Map<String, int> max_attempts;
final Map<String, List<String>> problems;
Expand All @@ -32,8 +32,8 @@ class WeeklyQuiz extends Equatable {
id: id,
title: json['title'] as String,
created_at: json['created_at'] as String,
duration_minute: (json['duration_minute'] as Map<String, dynamic>)
.map((key, value) => MapEntry(key, value as int)),
duration_minute: (json['duration_minute'] as Map<String, dynamic>).map(
(key, value) => MapEntry(key, (value as num?)?.toDouble() ?? -1.0)),
end_at: json['end_at'] as String,
max_attempts: (json['max_attempts'] as Map<String, dynamic>)
.map((key, value) => MapEntry(key, value as int)),
Expand Down
Loading