Skip to content

Commit

Permalink
Dev: merged assessments
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Apr 18, 2017
1 parent 67db23b commit 634cc8a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions application/helpers/frontend_helper.php
Expand Up @@ -1815,6 +1815,9 @@ function doAssessment($surveyid, $returndataonly=false)

foreach ($fieldmap as $field){

// Init Assessment Value
$assessmentValue = NULL;

if (in_array($field['type'],array('1','F','H','W','Z','L','!','M','O','P'))){

$fieldmap[$field['fieldname']]['assessment_value'] = 0;
Expand All @@ -1825,21 +1828,24 @@ function doAssessment($surveyid, $returndataonly=false)
if (($field['type'] == "M") || ($field['type'] == "P")){
if ($_SESSION['survey_'.$surveyid][$field['fieldname']] == "Y"){

$aAttributes = getQuestionAttributeValues($field['qid']);
$fieldmap[$field['fieldname']]['assessment_value'] = (int)$aAttributes['assessment_value'];
$total = $total+(int)$aAttributes['assessment_value'];
$aAttributes = getQuestionAttributeValues($field['qid']);
$assessmentValue = (int)$aAttributes['assessment_value'];
$total = $total+(int)$aAttributes['assessment_value'];
$assessmentValue = (int)$aAttributes['assessment_value'];
}
}else{
// Single choice question
$usquery = "SELECT assessment_value FROM {{answers}} where qid=".$field['qid']." and language='$baselang' and code=".dbQuoteAll($_SESSION['survey_'.$surveyid][$field['fieldname']]);
$usresult = dbExecuteAssoc($usquery); //Checked

if ($usresult){
$usrow = $usresult->read();
$fieldmap[$field['fieldname']]['assessment_value'] = $usrow['assessment_value'];
$total = $total+$usrow['assessment_value'];
$usrow = $usresult->read();
$assessmentValue = $usrow['assessment_value'];
$total = $total+$usrow['assessment_value'];
}
}

$fieldmap[$field['fieldname']]['assessment_value'] = $assessmentValue;
}
$groups[] = $field['gid'];
}
Expand Down Expand Up @@ -2202,7 +2208,7 @@ function checkCompletedQuota($surveyid,$return=false)
$thissurvey['aQuotas']['bShowNavigator'] = !$closeSurvey;
$thissurvey['aQuotas']['sQuotaStep'] = isset($_SESSION['survey_'.$surveyid]['step'])?$_SESSION['survey_'.$surveyid]['step']:0; // Surely not needed
$thissurvey['aQuotas']['sClientToken'] = $sClientToken;
$thissurvey['aQuotas']['aPostedQuotaFields'] = $aPostedQuotaFields;
$thissurvey['aQuotas']['aPostedQuotaFields'] = isset($aPostedQuotaFields)?$aPostedQuotaFields:'';
$thissurvey['aQuotas']['sPluginBlocks'] = implode("\n", $blocks);
$thissurvey['aQuotas']['sUrlDescription'] = $sUrlDescription;
$thissurvey['aQuotas']['sUrl'] = $sUrl;
Expand Down

0 comments on commit 634cc8a

Please sign in to comment.