Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions api/src/compute/generic_pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const getGenericPipeline = (pipelineProps: PipelineProps) => {

const match: any = {
survey,
[key]: { $nin: [null, '', [], {}] },
...generateFiltersQuery(filters)
}

Expand All @@ -39,16 +38,28 @@ export const getGenericPipeline = (pipelineProps: PipelineProps) => {
// { $count: 'questionRespondents' },
{
$unwind: {
path: `$${key}`
path: `$${key}`,
preserveNullAndEmptyArrays: true
}
},
{
$set: {
[`${key}`]: { $cond: [ { $not: [`$${key}`] }, "no_answer", `$${key}` ] }
}
},
...(facetPath
? [
{
$unwind: {
path: `$${facetPath}`
}
}
{
$unwind: {
path: `$${facetPath}`,
preserveNullAndEmptyArrays: true
}
},
{
$set: {
[`${facetPath}`]: { $cond: [ { $not: [`$${facetPath}`] }, "no_answer", `$${facetPath}` ] }
}
}
]
: []),
{
Expand Down
9 changes: 5 additions & 4 deletions api/src/data/keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ gender:
- non_binary
- not_listed


race_ethnicity:
# - biracial
- black_african
Expand Down Expand Up @@ -106,14 +107,14 @@ feature:
- heard
- used

happiness:
happiness:
- 0
- 1
- 2
- 3
- 4

opinions:
opinions:
- 0
- 1
- 2
Expand All @@ -132,12 +133,12 @@ graphql_experience:
- range_3_5
- range_6_10

code_generation_type:
code_generation_type:
- code_first
- schema_first
- database_first

css_js_balance:
css_js_balance:
- 0
- 1
- 2
Expand Down