Skip to content

Commit

Permalink
Disable innactive areabased (#2028)
Browse files Browse the repository at this point in the history
* filter no active

* disable switch

* disable

* Update core/survey/_survey/surveyAnalysis.js

* Update core/survey/_survey/surveyAnalysis.js

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
ramirobg94 and mergify[bot] authored Dec 22, 2021
1 parent 85099ca commit d133d09
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions core/survey/_survey/surveyAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getAnalysisNodeDefs =
showSamplingNodeDefs = true,
hideSamplingNodeDefsWithoutSibilings = true,
hideAreaBasedEstimate = true,
showInactiveResultVariables = false
showInactiveResultVariables = false,
}) =>
(survey) => {
const _nodeDefs = SurveyNodeDefs.getNodeDefsArray(survey)
Expand Down Expand Up @@ -55,12 +55,22 @@ export const getAnalysisNodeDefs =
if (!hasAnalysisSibilings) return false
}

if(hideAreaBasedEstimate && NodeDef.isAreaBasedEstimatedOf(nodeDef)){
if (hideAreaBasedEstimate && NodeDef.isAreaBasedEstimatedOf(nodeDef)) {
return false
}

if(!showInactiveResultVariables && !NodeDef.getActive(nodeDef)){
return false
if (!showInactiveResultVariables && !NodeDef.getActive(nodeDef)) {
return false
}

if (
NodeDef.isAreaBasedEstimatedOf(nodeDef) &&
!showInactiveResultVariables &&
!NodeDef.getActive(
_nodeDefs.find((_nodeDef) => NodeDef.getUuid(_nodeDef) === NodeDef.getAreaBasedEstimatedOf(nodeDef))
)
) {
return false
}

return true
Expand Down

0 comments on commit d133d09

Please sign in to comment.