Fix poll keys when key is a number

jQuery converts data strings into a possible JavaScript value, so keys
like '0' and '1' get converted into numbers, which fails the validation
(it expects a string for a key).
This commit is contained in:
David Liu 2015-08-07 23:56:59 -07:00
parent bb525b0b7f
commit 817d790fea

View file

@ -73,7 +73,7 @@ module.exports = class PollModal extends ModalView
onClickAnswer: (e) ->
$selectedAnswer = $(e.target).closest('.answer')
pollVotes = @userPollsRecord.get('polls') ? {}
pollVotes[@poll.id] = $selectedAnswer.data('answer')
pollVotes[@poll.id] = $selectedAnswer.data('answer').toString()
@userPollsRecord.set 'polls', pollVotes
@updateAnswers true
@userPollsRecord.save {polls: pollVotes}, {success: => @awardRandomGems?()}