Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double insertion of answers #123

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.3.1 (May 26, 2023)
--------------------
- Fix #123: Fix double insertion of answers

1.3.0 (May 1, 2023)
-------------------
- Fix #122: Hard delete records on disable module
Expand Down Expand Up @@ -111,6 +115,3 @@ Changelog
0.9.11 - 12 April, 2018
------------------------
- Enh: Added `Hide results until poll is closed?` option.



4 changes: 3 additions & 1 deletion models/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ public function saveNewAnswers()
foreach ($this->newAnswers as $answerText) {
$this->addAnswer($answerText);
}

// Reset already inserted answers to avoid their duplicates
$this->newAnswers = null;

// Reset cached answers
unset($this->answers);
}
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Polls",
"description": "Easy to use poll system",
"keywords": ["poll", "voting", "decision making"],
"version": "1.3.0",
"version": "1.3.1",
"humhub": {
"minVersion": "1.14"
},
Expand Down