Skip to content

Commit

Permalink
Fixed issue #11434: The numbers of the statistics are wrong (no compl…
Browse files Browse the repository at this point in the history
…etion selector)

New feature: Completion selector for simple stats
  • Loading branch information
LouisGac committed Jul 18, 2016
1 parent 2b62e51 commit 9ff5371
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
11 changes: 11 additions & 0 deletions application/controllers/admin/statistics.php
Expand Up @@ -803,6 +803,17 @@ public function simpleStatistics($surveyid)
echo $this->_renderWrappedTemplate('export', 'statistics_user_view', $aData);
}


public function setIncompleteanswers()
{
$sIncompleteAnswers = Yii::app()->request->getPost('state');
if (in_array($sIncompleteAnswers,array('all', 'complete', 'incomplete')))
{
Yii::app()->session['incompleteanswers']= $sIncompleteAnswers;
}

}

/**
* Renders template(s) wrapped in header and footer
*
Expand Down
Expand Up @@ -9,7 +9,7 @@
<label for='completionstate' class="col-sm-4 control-label"><?php eT("Include:"); ?> </label>
<?php $this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'completionstate',
'value'=> 'all' ,
'value'=> incompleteAnsFilterState(),
'selectOptions'=>array(
"all"=>gT("All responses",'unescaped'),
"complete"=>gT("Complete only",'unescaped'),
Expand Down
20 changes: 20 additions & 0 deletions application/views/admin/export/statistics_user_view.php
Expand Up @@ -13,6 +13,26 @@
<span class="glyphicon glyphicon-stats"></span> &nbsp;&nbsp;&nbsp;
<?php eT("Statistics"); ?>
</h3>
<div class="panel panel-primary" id="pannel-1">
<div class="panel-heading">
<h4 class="panel-title"><?php eT("Data selection"); ?></h4>
</div>
<div class="panel-body">
<div class='form-group'>
<input type="hidden" id="completionstateSimpleStat" data-grid-display-url="<?php echo App()->createUrl('/admin/statistics/sa/setIncompleteanswers/');?>" />
<label for='completionstate' class="col-sm-4 control-label"><?php eT("Include:"); ?> </label>
<?php $this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'completionstate',
'value'=> incompleteAnsFilterState(),
'selectOptions'=>array(
"all"=>gT("All responses",'unescaped'),
"complete"=>gT("Complete only",'unescaped'),
"incomplete"=>gT("Incomplete only",'unescaped'),
),
));?>
</div>
</div>
</div>

<div class="row">
<div class="col-lg-12 content-right">
Expand Down
1 change: 0 additions & 1 deletion scripts/admin/listresponse.js
Expand Up @@ -23,7 +23,6 @@ $(document).ready(function(){
$that = $(this);
$actionUrl = $(this).data('url');
$display = ($that.val()=='extended')?'extended':'compact';
console.log('select value:'+$display);
$postDatas = {state:$display};
$.ajax({
url : $actionUrl,
Expand Down
26 changes: 26 additions & 0 deletions scripts/admin/statistics.js
Expand Up @@ -182,6 +182,32 @@ function init_chart_js_graph_with_datas($type,$qid)

$(document).ready(function() {

if ($('#completionstateSimpleStat').length>0)
{
$actionUrl = $('#completionstateSimpleStat').data('grid-display-url');
$("#completionstate > .btn").on("click", function(){
$display = $(this).find('input').val();
$postDatas = {state:$display};

$.ajax({
url : $actionUrl,
type : 'POST',
data : $postDatas,

// html contains the buttons
success : function(html, statut){
// Reload page
location.reload();
},
error : function(html, statut){
console.log('error');
console.log(html);
}
});

});
}

if($('.chartjs-container').length>0)
{
$elChartJsContainer = $('.chartjs-container').first();
Expand Down

0 comments on commit 9ff5371

Please sign in to comment.