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-13 23:51:48 +0300
committerdartcafe <github@dartcafe.de>2020-05-13 23:51:48 +0300
commitf4ca68368b15f68d18b138c6f46b195b7ac86f32 (patch)
treea496655c2cc8ae11cacc37528d205aae0e59fb6f /lib
parent4cfe462cd988df66e09a4b3c792687f819349229 (diff)
fix text reordering
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/OptionController.php14
-rw-r--r--lib/Controller/PollController.php2
-rw-r--r--lib/Db/Option.php6
3 files changed, 6 insertions, 16 deletions
diff --git a/lib/Controller/OptionController.php b/lib/Controller/OptionController.php
index 1b3309b0..21cd183a 100644
--- a/lib/Controller/OptionController.php
+++ b/lib/Controller/OptionController.php
@@ -149,12 +149,7 @@ class OptionController extends Controller {
$NewOption->setPollId($option['pollId']);
$NewOption->setPollOptionText(trim(htmlspecialchars($option['pollOptionText'])));
$NewOption->setTimestamp($option['timestamp']);
-
- if ($option['timestamp'] === 0) {
- $NewOption->setOrder($option['order']);
- } else {
- $NewOption->setOrder($option['timestamp']);
- }
+ $NewOption->setOrder($option['timestamp'], $option['order']);
$this->optionMapper->insert($NewOption);
$this->logService->setLog($option['pollId'], 'addOption');
@@ -184,12 +179,7 @@ class OptionController extends Controller {
$updateOption->setPollOptionText(trim(htmlspecialchars($option['pollOptionText'])));
$updateOption->setTimestamp($option['timestamp']);
-
- if ($option['timestamp'] === 0) {
- $updateOption->setOrder($option['order']);
- } else {
- $updateOption->setOrder($option['timestamp']);
- }
+ $updateOption->setOrder($option['timestamp'],$option['order']);
if ($option['confirmed']) {
// do not update confirmation date, if option is already confirmed
diff --git a/lib/Controller/PollController.php b/lib/Controller/PollController.php
index 00e8ebfa..601bc9ec 100644
--- a/lib/Controller/PollController.php
+++ b/lib/Controller/PollController.php
@@ -206,7 +206,7 @@
return new DataResponse([
'acl' => $this->acl,
'comments' => $comments,
- 'options' => $this->optionMapper->findByPoll($pollId),
+ 'options' => $options,
'poll' => $this->poll,
'shares' => $shares,
'votes' => $votes
diff --git a/lib/Db/Option.php b/lib/Db/Option.php
index 70c63d4e..72d1bdf2 100644
--- a/lib/Db/Option.php
+++ b/lib/Db/Option.php
@@ -92,10 +92,10 @@ class Option extends Entity implements JsonSerializable {
*/
// TODO: remove by time
private function setOrder($timestamp, $order) {
- if ($timestamp === 0) {
- return $order;
- } else {
+ if ($timestamp) {
return $timestamp;
+ } else {
+ return $order;
}
}
}