diff options
author | dartcafe <github@dartcafe.de> | 2020-05-23 12:12:07 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-05-23 12:12:07 +0300 |
commit | fd89f6aa5bfb20d9b1a1ec268d426594f2541abc (patch) | |
tree | 99779036463e54f7d2058f3bd8937b42eb463efc /lib | |
parent | 716fbb82b0658ffebe2472464dd31c6f8717f2a1 (diff) |
again fix reordering
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/OptionController.php | 9 | ||||
-rw-r--r-- | lib/Db/Option.php | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/Controller/OptionController.php b/lib/Controller/OptionController.php index 10466bb7..d256a1f9 100644 --- a/lib/Controller/OptionController.php +++ b/lib/Controller/OptionController.php @@ -179,7 +179,14 @@ class OptionController extends Controller { $updateOption->setPollOptionText(trim(htmlspecialchars($option['pollOptionText']))); $updateOption->setTimestamp($option['timestamp']); - $updateOption->setOrder($option['timestamp'],$option['order']); + + if ($option['timestamp']) { + $updateOption->setOrder($option['timestamp']); + } else { + $updateOption->setOrder($option['order']); + } + + if ($option['confirmed']) { // do not update confirmation date, if option is already confirmed diff --git a/lib/Db/Option.php b/lib/Db/Option.php index 72d1bdf2..8f4d4fcf 100644 --- a/lib/Db/Option.php +++ b/lib/Db/Option.php @@ -74,7 +74,7 @@ class Option extends Entity implements JsonSerializable { 'pollId' => intval($this->pollId), 'pollOptionText' => htmlspecialchars_decode($this->pollOptionText), 'timestamp' => intval($timestamp), - 'order' => $this->setOrder(intval($this->timestamp), intval($this->order)), + 'order' => $this->orderCorrection(intval($this->timestamp), intval($this->order)), 'confirmed' => intval($this->confirmed), 'no' => 0, 'yes' => 0, @@ -91,7 +91,7 @@ class Option extends Entity implements JsonSerializable { * Make sure, order is eqal to timestamp in date polls */ // TODO: remove by time - private function setOrder($timestamp, $order) { + private function orderCorrection($timestamp, $order) { if ($timestamp) { return $timestamp; } else { |