@@ -43,7 +43,7 @@ const buildScores = (branch) => {
4343 branch . questions . forEach ( ( a ) => {
4444 if ( a . prgVarName ) {
4545 const num = `#{${ a . prgVarName } }*${ a . scoreNum } ` ;
46- const den = `d2:countIfZeroPos ('${ a . prgVarName } ')*${ a . scoreDen } ` ;
46+ const den = `d2:count ('${ a . prgVarName } ')*${ a . scoreDen } ` ;
4747 if ( a . isCritical == "Yes" ) {
4848 numC . push ( num ) ;
4949 denC . push ( den ) ;
@@ -693,7 +693,7 @@ const labelsRulesLogic = (hideShowLabels, programId, uidPool) => {
693693 * @param {String } useCompetencyClass: Flag to include or not the competency class realated items
694694 * @returns {Array } programRuleVariables: <Array>{name,programRuleVariableSourceType,useCodeForOptionSet,program,|dataElement|}
695695 */
696- export const buildProgramRuleVariables = ( sections , compositeScores , programId , useCompetencyClass = "Yes" ) => {
696+ export const buildProgramRuleVariables = ( { sections, compositeScores, programId, useCompetencyClass = "Yes" , uidPool } ) => {
697697 // const criticalStepCalculations = sections.find(s => s.name == "Critical Step Calculations");
698698 // const scores = sections.find(s => s.name == "Scores");
699699 // sections = sections.filter(s => s.name != "Scores" && s.name != "Critical Steps Calculations");
@@ -704,6 +704,7 @@ export const buildProgramRuleVariables = (sections, compositeScores, programId,
704704 sections . forEach ( ( section , secIdx ) => {
705705 section . dataElements . forEach ( ( dataElement , deIdx ) => {
706706 programRuleVariables . push ( {
707+ id : uidPool . shift ( ) ,
707708 name : `_S${ padValue ( secIdx + 1 , "00" ) } Q${ padValue ( deIdx + 1 , "000" ) } ` ,
708709 programRuleVariableSourceType : "DATAELEMENT_CURRENT_EVENT" ,
709710 useCodeForOptionSet : dataElement . optionSet ?. id ? true : false ,
@@ -716,6 +717,7 @@ export const buildProgramRuleVariables = (sections, compositeScores, programId,
716717 // Calculated Values
717718 compositeScores . forEach ( cs => {
718719 programRuleVariables . push ( {
720+ id : uidPool . shift ( ) ,
719721 name : `_CV_CS${ cs } ` ,
720722 programRuleVariableSourceType : "CALCULATED_VALUE" ,
721723 useCodeForOptionSet : false ,
@@ -726,24 +728,28 @@ export const buildProgramRuleVariables = (sections, compositeScores, programId,
726728 // Critical Steps Calculations
727729 const criticalVariables = [
728730 {
731+ id : uidPool . shift ( ) ,
729732 name : "_NoncriticalNewest" ,
730733 programRuleVariableSourceType : "DATAELEMENT_NEWEST_EVENT_PROGRAM" ,
731734 program : { id : programId } ,
732735 dataElement : { id : NON_CRITICAL_STEPS }
733736 } ,
734737 {
738+ id : uidPool . shift ( ) ,
735739 name : "_criticalNewest" ,
736740 programRuleVariableSourceType : "DATAELEMENT_NEWEST_EVENT_PROGRAM" ,
737741 program : { id : programId } ,
738742 dataElement : { id : CRITICAL_STEPS } ,
739743 } ,
740744 {
745+ id : uidPool . shift ( ) ,
741746 name : "_CV_NonCriticalQuestions" ,
742747 programRuleVariableSourceType : "CALCULATED_VALUE" ,
743748 useCodeForOptionSet : "false" ,
744749 program : { id : programId }
745750 } ,
746751 {
752+ id : uidPool . shift ( ) ,
747753 name : "_CV_CriticalQuestions" ,
748754 programRuleVariableSourceType : "CALCULATED_VALUE" ,
749755 useCodeForOptionSet : "false" ,
@@ -755,6 +761,7 @@ export const buildProgramRuleVariables = (sections, compositeScores, programId,
755761 if ( useCompetencyClass == "Yes" ) {
756762 criticalVariables . push (
757763 {
764+ id : uidPool . shift ( ) ,
758765 name : "_competencyNewest" ,
759766 programRuleVariableSourceType : "DATAELEMENT_NEWEST_EVENT_PROGRAM" ,
760767 useCodeForOptionSet : true ,
@@ -766,7 +773,7 @@ export const buildProgramRuleVariables = (sections, compositeScores, programId,
766773 return programRuleVariables . concat ( criticalVariables )
767774}
768775
769- export const buildProgramRules = ( sections , stageId , programId , compositeValues , scoresMapping , uidPool , useCompetencyClass = "Yes" , healthArea = "FP" , scoreMap = { childs : [ ] } ) => {
776+ export const buildProgramRules = ( { sections, stageId, programId, compositeValues, scoresMapping, uidPool, useCompetencyClass = "Yes" , healthArea = "FP" , scoreMap = { childs : [ ] } } ) => {
770777
771778 var programRules = [ ] ;
772779 var programRuleActions = [ ] ;
@@ -883,7 +890,7 @@ export const buildProgramRules = (sections, stageId, programId, compositeValues,
883890 return { programRules, programRuleActions, scoreMap }
884891}
885892
886- export const buildProgramIndicators = ( programId , programStage , scoreMap , uidPool , useCompetency , sharingSettings , PIAggregationType ) => {
893+ export const buildProgramIndicators = ( { programId, programStage, scoreMap, uidPool, useCompetency, sharingSettings, PIAggregationType } ) => {
887894
888895 const programShortName = programStage . program . shortName ;
889896 // This sectin is for the local analytics
@@ -944,7 +951,7 @@ export const buildProgramIndicators = (programId, programStage, scoreMap, uidPoo
944951 return { programIndicators, indicatorIDs, gsInd : AnalyticGS . id }
945952}
946953
947- export const buildH2BaseVisualizations = ( programId , programShortName , { gsInd, indicatorIDs } , uidPool , useCompetency , currentDashboardId , userOU , ouRoot , stageId , sharingSettings , visualizationLevel , mapLevel , actionPlanID ) => {
954+ export const buildH2BaseVisualizations = ( { programId, programShortName, gsInd, indicatorIDs, uidPool, useCompetency, currentDashboardId, userOU, ouRoot, sharingSettings, visualizationLevel, mapLevel, actionPlanID} ) => {
948955 const series = [ ]
949956 const dataDimensionItems = [ ]
950957 const visualizations = [ ]
0 commit comments