DemocracyOS/app — pull request #487 by jfresco (2014-12-03 21:03:07+00:00)
Title: [model:law] Safer way to store votes. Related to #394.

On the `vote` method I replaced `MongooseArray#push` call by [`MongooseArray#addToSet`](http://mongoosejs.com/docs/api.html#types_array_MongooseArray-addToSet), which avoids duplicates.
Also, I've found a weird thing related to the call to `unvote`. The `this.save(cb)` method was never been called because `cb` is always `undefined`. I replaced the condition by `votes.length`, that seems more proper. I've tested it and it made no difference.
I couldn't reproduce the case that generates the error, it's still under analysis.
Also, we need to write a migration script in order to remove n-plicated votes on existing databases.