Skip to content

Commit

Permalink
Merge pull request #842 from bounswe/MOBILE-839
Browse files Browse the repository at this point in the history
refactor(mobile): update quiz result integration
  • Loading branch information
kaanyolcu22 authored Dec 15, 2024
2 parents a8cb2e5 + 857964e commit 0e56bf9
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions mobile/bulingo/app/(tabs)/quizzes/quizResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,33 @@ const QuizResults = () => {
const styles = getStyles(colorScheme);

const [quizResult, setQuizResult] = useState<{
quiz: { id: number; title: string };
score: number;
time_taken: number;
level: string;
question_count: number;
questions: {
choice_images: any[];
choices: any[];
correct_choice: number;
is_correct: boolean;
question_image: string | null;
question_number: number;
question_text: string;
user_answer: number | null;
}[];
quiz_result: {
author: { id: number; username: string };
id: number;
is_bookmarked: boolean;
is_liked: boolean;
level: string;
like_count: number;
question_count: number;
quiz: { id: number; title: string };
quiz_progress: number;
score: number;
time_taken: number;
user: { id: number; username: string };
};
quiz_title_image: string | null;
} | null>(null);


const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);
Expand Down Expand Up @@ -118,10 +139,10 @@ const QuizResults = () => {
<View style={styles.resultsCardContainer}>
{quizResult ? (
<QuizResultsCard
quizName={quizResult.quiz.title}
tags={[quizResult.level || 'A1']}
score={quizResult.score}
maxScore={quizResult.question_count}
quizName={quizResult.quiz_result.quiz.title}
tags={[quizResult.quiz_result.level || 'A1']}
score={quizResult.quiz_result.score}
maxScore={quizResult.quiz_result.question_count}
styles={{ styles }}
/>
) : (
Expand Down

0 comments on commit 0e56bf9

Please sign in to comment.