     return
 
   #bind conditions to question
-  bindConditions: ($triggerElement, rule) ->
+  bindConditions: ($triggerElement, rule, $ruleContainer) ->
     $triggerElement.on "change", ->
-#     console.log(rule)
       ## If this is a calculation rule, we don't care about conditional logic, we just want to re-run the calculations since a value has changed
       if rule.type == "Hanuman::CalculationRule"
-        self.updateCalculation(rule)
+        self.updateCalculation(rule, $ruleContainer)
         return
 
       # pop out of condition into rules to handle all conditions defined in the rule


  ## AN May 2020 - Start calculated fields code
  # This method triggers an update of the calculations for the given rule's target question
  updateCalculation: (rule) ->
    parameters = {} # used to store the survey data object passed to the calculated fields expresssion
    $target = $('[data-question-id="' + rule.question_id + '"]').find('.form-control') # the question we are calculating a value for
    $targetRepeater = $target.closest(".form-container-repeater") # the parent repeater of the target, if it exists
    targetType = $('[data-question-id="' + rule.question_id + '"]').data('element-type') # the form control type of the target

    $.each rule.conditions, (index, condition) ->


              inRepeater = true

          if rule.type == "Hanuman::CalculationRule"
            self.updateCalculation(rule, $ruleContainer)
          else
            self.checkConditionsAndHideShow(rule.conditions, ancestorId, $ruleContainer, $ruleContainer, inRepeater, matchType, rule)

