Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-05-23 12:12:07 +0300
committerdartcafe <github@dartcafe.de>2020-05-23 12:12:07 +0300
commitfd89f6aa5bfb20d9b1a1ec268d426594f2541abc (patch)
tree99779036463e54f7d2058f3bd8937b42eb463efc /lib
parent716fbb82b0658ffebe2472464dd31c6f8717f2a1 (diff)
again fix reordering
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/OptionController.php9
-rw-r--r--lib/Db/Option.php4
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 {