Skip to content

Commit

Permalink
add round number to Question object
Browse files Browse the repository at this point in the history
  • Loading branch information
pearl-truss committed Jan 21, 2025
1 parent 7fc5abb commit af20cd4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions services/app-api/src/domain-models/QuestionsType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const commonQuestionSchema = z.object({
division: divisionType, // DMCO, DMCP, OACT
documents: z.array(document),
responses: z.array(questionResponseType),
round: z.number(),
})

const contractQuestion = commonQuestionSchema.extend({
Expand Down
17 changes: 12 additions & 5 deletions services/app-api/src/postgres/questionResponse/questionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,19 @@ const convertToCommonIndexQuestionsPayload = <
const getDivisionQuestionsEdge = (
division: 'DMCP' | 'DMCO' | 'OACT',
questions: P[]
) => ({
totalCount: questions.filter((q) => q.division === division).length,
edges: questions
) => {
const divisionQuestions = questions
.filter((q) => q.division === division)
.map((question) => ({ node: question })),
})
.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())
.map((question, idx) => {
question.round = idx + 1
return { node: question }
})
return {
totalCount: divisionQuestions.length,
edges: divisionQuestions,
}
}

return {
DMCOQuestions: getDivisionQuestionsEdge('DMCO', questions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fragment contractQuestionEdgeFragment on ContractQuestionEdge {
}
}
division
round
documents {
s3URL
name
Expand Down
1 change: 1 addition & 0 deletions services/app-graphql/src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ type ContractQuestion {
addedBy: CMSUsersUnion!
documents: [Document!]!
division: Division!
round: Int!
# noteText: String
# dueDate: Date
# rateIDs: [String!]
Expand Down

0 comments on commit af20cd4

Please sign in to comment.