Skip to content

Commit

Permalink
Fixed issue #17416: Lost of Total and Remaining in multi numeric (#2077)
Browse files Browse the repository at this point in the history
- Re-applied the fix for issue 15978
- Moved processString call to the views

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
  • Loading branch information
gabrieljenik and encuestabizdevgit committed Oct 6, 2021
1 parent 753e669 commit b210dbf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
Expand Up @@ -318,6 +318,20 @@ public function render($sCoreClasses = '')
$dynamicTemplate = "/survey/questions/answer/multiplenumeric/rows/dynamic_slider.twig";
}

$displaytotal = false;
$equals_num_value = false;
if (trim($this->getQuestionAttribute('equals_num_value')) != ''
|| trim($this->getQuestionAttribute('min_num_value')) != ''
|| trim($this->getQuestionAttribute('max_num_value')) != ''
) {
$qinfo = LimeExpressionManager::GetQuestionStatus($this->oQuestion->qid);

if (trim($this->getQuestionAttribute('equals_num_value')) != '') {
$equals_num_value = true;
}
$displaytotal = true;
}

$answer .= Yii::app()->twigRenderer->renderQuestion(
$this->getMainView() . '/answer',
array(
Expand All @@ -326,6 +340,15 @@ public function render($sCoreClasses = '')
'basename' => $this->sSGQA,
'rowTemplate' => $rowTemplate,
'dynamicTemplate' => $dynamicTemplate,
'id' => $this->oQuestion->qid,
'sumRemainingEqn' => $equals_num_value ? $qinfo['sumRemainingEqn'] : '',
'equals_num_value' => $equals_num_value,
'displaytotal' => $displaytotal,
'sumEqn' => $displaytotal ? $qinfo['sumEqn'] : '',
'sLabelWidth' => $this->widthArray['sLabelWidth'],
'sInputContainerWidth' => $this->widthArray['sInputContainerWidth'],
'prefix' => $this->prefix,
'suffix' => $this->suffix,
),
true
);
Expand Down
Expand Up @@ -23,7 +23,7 @@
{% endif %}
<div id="remainingvalue_{{id}}" class="form-control-static numeric dynamic-remaining" data-number="1">
<!-- alternative class : form-control : display like an input:text -->
{{ '{'~sumRemainingEqn~'}' }}
{{ processString('{'~sumRemainingEqn~'}') }}
</div>
{% if suffix %}
<div class="ls-input-group-extra suffix-text suffix">
Expand All @@ -46,7 +46,7 @@
</div>
{% endif %}
<div id="totalvalue_{{id}}" class="form-control-static numeric dynamic-total" data-number="1">
{{ '{'~sumEqn~'}' }}
{{ processString('{'~sumEqn~'}') }}
</div>
{% if suffix %}
<div class="ls-input-group-extra suffix-text suffix hidden">
Expand Down
Expand Up @@ -22,7 +22,7 @@
</div>
{% endif %}
<div id="remainingvalue_{{ id }}" class="form-control-static numeric dynamic-remaining" data-number="1"><!-- alternative class : form-control : display like an input:text -->
{{ '{'~sumRemainingEqn~'}' }}
{{ processString('{'~sumRemainingEqn~'}') }}
</div>
{% if suffix %}
<div class="suffix-text suffix">
Expand All @@ -40,7 +40,7 @@
{{gT('Total:')}}
</div>
<div id="totalvalue_{{ id }}" class="form-control-static numeric dynamic-total" data-number="1">
{{ '{'~sumEqn~'}' }}
{{ processString('{'~sumEqn~'}') }}
</div>
</div>
</li>
Expand Down

0 comments on commit b210dbf

Please sign in to comment.