Skip to content

Commit

Permalink
Fixed issue #17230: Inconsistent 'willRun' state of the survey when S…
Browse files Browse the repository at this point in the history
…tart date is undefined
  • Loading branch information
c-schmitz committed Apr 7, 2021
1 parent 3912d51 commit 32ddd29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions application/models/Survey.php
Expand Up @@ -1122,13 +1122,13 @@ public function getState()
$sStop = ($this->expires != '') ? date("Y-m-d H:i:s", strtotime(Yii::app()->getConfig('timeadjust'), strtotime($this->expires))) : null;
$sStart = ($this->startdate != '') ? date("Y-m-d H:i:s", strtotime(Yii::app()->getConfig('timeadjust'), strtotime($this->startdate))) : null;

// Time comparaison
// Time comparison
$oNow = new DateTime($sNow);
$oStop = new DateTime($sStop);
$oStart = new DateTime($sStart);

$bExpired = (!is_null($sStop) && $oStop < $oNow);
$bWillRun = (!is_null($oStart) && $oStart > $oNow);
$bWillRun = (!is_null($sStart) && $oStart > $oNow);

if ($bExpired) {
return 'expired';
Expand All @@ -1137,7 +1137,7 @@ public function getState()
// And what happen if $sStop < $sStart : must return something other ?
return 'willRun';
}
if(!is_null($sStop)) {
if (!is_null($sStop)) {
return 'willExpire';
}
}
Expand Down

0 comments on commit 32ddd29

Please sign in to comment.