MCPcopy Create free account
hub / github.com/Devographics/Monorepo / getQuestionDataQuery

Function getQuestionDataQuery

shared/fetch/queries/question_data.ts:103–194  ·  view source on GitHub ↗
({
    queryOptions,
    queryArgs = {}
}: {
    queryOptions: QueryOptions
    queryArgs?: QueryArgs
})

Source from the content-addressed store, hash-verified

101}
102
103export const getQuestionDataQuery = ({
104 queryOptions,
105 queryArgs = {}
106}: {
107 queryOptions: QueryOptions
108 queryArgs?: QueryArgs
109}) => {
110 const {
111 surveyId,
112 editionId,
113 sectionId,
114 questionId,
115 fieldId,
116 subField = 'responses',
117 addBucketsEntities = true,
118 allEditions = false,
119 addArgumentsPlaceholder = false,
120 addBucketFacetsPlaceholder = false,
121 addQuestionEntity = false,
122 addQuestionComments = false
123 } = queryOptions
124 const queryArgsString = getQueryArgsString(queryArgs)
125 const editionType = allEditions ? 'allEditions' : 'currentEdition'
126
127 const questionIdString = fieldId ? `${questionId}: ${fieldId}` : questionId
128
129 return `
130query QuestionData {
131 surveys {
132 ${surveyId} {
133 ${editionId} {
134 ${sectionId} {
135 ${questionIdString} {
136 ${addQuestionEntity ? getEntityFragment() : ''}
137 ${addQuestionComments ? getCommentsCountFragment() : ''}
138 ${subField}${queryArgsString} {
139 ${editionType} {
140 ${allEditions ? allEditionsFragment : ''}
141 completion {
142 count
143 percentageSurvey
144 total
145 }
146 buckets {
147 count
148 id
149 percentageQuestion
150 percentageSurvey
151 groupedBuckets {
152 count
153 id
154 token {
155 id
156 parentId
157 name
158 nameHtml
159 nameClean
160 description

Callers 2

getQuestionResponsesFunction · 0.90
getQuestionDataFunction · 0.90

Calls 3

getEntityFragmentFunction · 0.90
getQueryArgsStringFunction · 0.70
getCommentsCountFragmentFunction · 0.70

Tested by

no test coverage detected