Skip to content

Commit

Permalink
fix: check participation before registering to a quiz
Browse files Browse the repository at this point in the history
  • Loading branch information
reorr committed Apr 17, 2024
1 parent af59311 commit d8c840e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/lib/services/quiz_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ class QuizService {
final registeredUserSnapshot =
await db.collection('registered_user').doc(currentUserUID).get();

final checkParticipation = await db
.collection('weekly_quiz_participation')
.where(
'quiz_id',
isEqualTo: snapshot['id'],
)
.where(
'user_uid',
isEqualTo: currentUserUID,
)
.get();
if (checkParticipation.docs.isNotEmpty) {
return;
}

// background task untuk fetch task untuk sesuai minggu dan level
// yang akan didaftarkan agar bisa dipakai offline
// for (final taskId in snapshot['tasks'][level] as List<dynamic>) {
Expand Down

0 comments on commit d8c840e

Please sign in to comment.