diff options
author | dartcafe <github@dartcafe.de> | 2021-10-16 12:35:31 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-10-16 12:35:31 +0300 |
commit | 2120d555e3c2e44a9964f16c7fdbfd842a48f17d (patch) | |
tree | 29e5735714e273c7bf54f2dee4de33bb98e3da0a | |
parent | eb795e43f1c007cf511da7d934012877a63af5cf (diff) |
move vot chack from shares to votes
Signed-off-by: dartcafe <github@dartcafe.de>
-rw-r--r-- | src/js/components/Shares/SharesEffective.vue | 2 | ||||
-rw-r--r-- | src/js/store/modules/shares.js | 1 | ||||
-rw-r--r-- | src/js/store/modules/votes.js | 2 |
3 files changed, 2 insertions, 3 deletions
diff --git a/src/js/components/Shares/SharesEffective.vue b/src/js/components/Shares/SharesEffective.vue index 31d3aed7..a49f2154 100644 --- a/src/js/components/Shares/SharesEffective.vue +++ b/src/js/components/Shares/SharesEffective.vue @@ -85,7 +85,7 @@ export default { computed: { ...mapGetters({ invitationShares: 'shares/invitation', - hasVoted: 'shares/hasVoted', + hasVoted: 'votes/hasVoted', }), }, diff --git a/src/js/store/modules/shares.js b/src/js/store/modules/shares.js index ad037d37..f40d00e7 100644 --- a/src/js/store/modules/shares.js +++ b/src/js/store/modules/shares.js @@ -67,7 +67,6 @@ const getters = { unsentInvitations: (state) => state.list.filter((share) => (share.emailAddress || share.type === 'group' || share.type === 'contactGroup' || share.type === 'circle') && !share.invitationSent), public: (state) => state.list.filter((share) => ['public'].includes(share.type)), - hasVoted: (state, getters, rootState, rootGetters) => (userId) => rootGetters['poll/participantsVoted'].find((participant) => participant.userId === userId), } const actions = { diff --git a/src/js/store/modules/votes.js b/src/js/store/modules/votes.js index f375f6ec..02eb72ca 100644 --- a/src/js/store/modules/votes.js +++ b/src/js/store/modules/votes.js @@ -75,7 +75,7 @@ const getters = { relevant: (state, getters, rootState) => state.list.filter((vote) => rootState.options.list.some((option) => option.pollId === vote.pollId && option.pollOptionText === vote.voteOptionText)), countVotes: (state, getters, rootState) => (answer) => getters.relevant.filter((vote) => vote.userId === rootState.poll.acl.userId && vote.voteAnswer === answer).length, countAllVotes: (state, getters) => (answer) => getters.relevant.filter((vote) => vote.voteAnswer === answer).length, - + hasVoted: (state) => (userId) => state.list.findIndex((vote) => vote.userId === userId) > -1, getVote: (state) => (payload) => { const found = state.list.find((vote) => (vote.userId === payload.userId && vote.voteOptionText === payload.option.pollOptionText)) |