Skip to content

Commit

Permalink
Dev: attempt to reduce double posting resulting in empty resonse sets
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Mar 14, 2018
1 parent 0fbe67a commit 60cee17
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -5518,8 +5518,15 @@ private function _UpdateValuesInDatabase($finished=false)
if (isset($_SESSION[$this->sessid]['srid']) && $this->surveyOptions['active'])
{
$query .= $_SESSION[$this->sessid]['srid'];

//If the responses already have been submitted once they are marked as completed already, so they shouldn't be changed.
$oSurveyResponse = SurveyDynamic::model($this->sid)->findByAttributes(['id' => $_SESSION[$this->sessid]['srid']]);
$result = true;
if ($oSurveyResponse->submitdate == null || $this->surveyOptions['alloweditaftercompletion'] == 'Y') {
$result = !dbExecuteAssoc($query);
}

if (!dbExecuteAssoc($query))
if ($result)
{
// TODO: This kills the session if adminemail is defined, so the queries below won't work.
$message = submitfailed('', $query); // TODO - report SQL error?
Expand Down Expand Up @@ -5567,7 +5574,7 @@ private function _UpdateValuesInDatabase($finished=false)
}
else
{
if ($finished) {
if ($finished && ($oSurveyResponse->submitdate == null || $this->surveyOptions['alloweditaftercompletion'] == 'Y')) {
$sQuery = 'UPDATE '.$this->surveyOptions['tablename'] . " SET ";
if($this->surveyOptions['datestamp'])
{
Expand Down

1 comment on commit 60cee17

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke needed double check in full index : https://bugs.limesurvey.org/view.php?id=14855

Please sign in to comment.