Skip to content

Commit

Permalink
Enhance Test History (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
HansGabriel authored Dec 6, 2023
1 parent bc54195 commit 7cefdd1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/expo/src/screens/play-test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const PlayTestScreen: FC<RootStackScreenProps<"PlayTest">> = ({
const mappedChoices = choices.map((choice) => ({
text: choice.text ?? "",
isCorrect: choice.isCorrect,
isChosen: choice.isSelected,
isChosen: selectedChoice?.id === choice.id,
}));
return prevQuestionHistories.concat([
{
Expand Down Expand Up @@ -269,7 +269,7 @@ export const PlayTestScreen: FC<RootStackScreenProps<"PlayTest">> = ({
const mappedChoices = choices.map((choice) => ({
text: choice.text ?? "",
isCorrect: choice.isCorrect,
isChosen: choice.isSelected,
isChosen: choiceStatus[choice.id] ?? false,
}));
return prevQuestionHistories.concat([
{
Expand Down
7 changes: 7 additions & 0 deletions apps/expo/src/screens/test-history/question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ export const QuestionHistoryScreen: FC<QuestionHistoryProps> = ({
))
.exhaustive()}
</View>
<Text className="mx-6 mb-5 mt-10 text-center text-xl font-bold leading-loose text-black">
Your Answer:{" "}
{question.choices
.filter((choice) => choice.isChosen)
.map((choice) => choice.text)
.join(", ")}
</Text>
</ScrollView>
</SafeAreaView>
</>
Expand Down
3 changes: 3 additions & 0 deletions packages/api/src/router/testHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export const testHistoryRouter = router({
},
},
},
orderBy: {
createdAt: "desc",
},
});
}),

Expand Down

0 comments on commit 7cefdd1

Please sign in to comment.