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
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-01-12 02:11:25 +0300
committerdartcafe <github@dartcafe.de>2021-01-12 02:14:01 +0300
commit6ae7fa45af9c589f52ae3e9d0a49241092c6d55b (patch)
tree040d5042d04da9ae6a0871c9c4ce186f434d33e4 /src/js/store
parente43afa2df944a521a902db3c6d43463a39a22dd3 (diff)
changed limits check and make sure only valid votes are counted
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/store')
-rw-r--r--src/js/store/modules/subModules/votes.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/js/store/modules/subModules/votes.js b/src/js/store/modules/subModules/votes.js
index cfddad12..426adbf1 100644
--- a/src/js/store/modules/subModules/votes.js
+++ b/src/js/store/modules/subModules/votes.js
@@ -62,6 +62,14 @@ const mutations = {
const getters = {
+ relevant: (state, getters, rootState) => {
+ return state.list.filter((vote) => {
+ return rootState.poll.options.list.some((option) => {
+ return option.pollId === vote.pollId && option.pollOptionText === vote.voteOptionText
+ })
+ })
+ },
+
ranked: (state, getters, rootState) => {
let votesRank = []
rootState.poll.options.list.forEach(function(option) {
@@ -88,7 +96,7 @@ const getters = {
},
countYesVotes: (state, getters, rootState) => {
- return state.list.filter(vote => vote.userId === rootState.poll.acl.userId && vote.voteAnswer === 'yes').length
+ return getters.relevant.filter(vote => vote.userId === rootState.poll.acl.userId && vote.voteAnswer === 'yes').length
},
getVote: (state) => (payload) => {