Skip to content

Commit

Permalink
orphaned answers added to answer pile
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshiel committed Aug 29, 2023
1 parent bffc860 commit 19d370a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 2 additions & 5 deletions client/src/hooks/graphql/use-with-review-answer-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function useWithReviewAnswerState(
);
const mentorQuestions = useQuestions(
(state) => state.questions,
mentorAnswers?.map((a) => a.question)
[...(mentorAnswers || []).map((a) => a.question)]
);
const questionsLoading = isQuestionsLoading(
mentorAnswers?.map((a) => a.question)
Expand All @@ -108,10 +108,7 @@ export function useWithReviewAnswerState(
}, [mentorSubjects]);

useEffect(() => {
setAnswers([
...(mentorAnswers || []).map((a) => ({ ...a })),
...(mentorOrphanedCompleteAnswers || []).map((a) => ({ ...a })),
]);
setAnswers([...(mentorAnswers || []).map((a) => ({ ...a }))]);
}, [mentorAnswers]);

useEffect(() => {
Expand Down
5 changes: 4 additions & 1 deletion client/src/types-gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ export function convertMentorGQL(gql: MentorGQL): Mentor {
? convertSubjectGQL(gql.defaultSubject)
: undefined,
subjects: gql.subjects?.map((s) => convertSubjectGQL(s)),
answers: gqlAnswers.map((a) => convertAnswerGQL(a)),
answers: [
...gqlAnswers.map((a) => convertAnswerGQL(a)),
...gql.orphanedCompleteAnswers.map((a) => convertAnswerGQL(a)),
],
orphanedCompleteAnswers: gql.orphanedCompleteAnswers?.map((a) =>
convertAnswerGQL(a)
),
Expand Down
2 changes: 1 addition & 1 deletion cypress/cypress/integration/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe("Index page", () => {
});
});

it("answers that do not belong to any subject exist in their own recording card", () => {
it.only("answers that do not belong to any subject exist in their own recording card", () => {
cyMockDefault(cy, {
mentor: {
...clint,
Expand Down

0 comments on commit 19d370a

Please sign in to comment.