@dhyasama/totem-models 5.10.5 → 5.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/Deal.js +15 -0
  2. package/package.json +1 -1
package/lib/Deal.js CHANGED
@@ -95,6 +95,21 @@ module.exports = function(mongoose, config) {
95
95
 
96
96
  });
97
97
 
98
+ Deal.virtual('voteValue').get(function () {
99
+
100
+ var self = this;
101
+
102
+ if(!self.votes || self.votes.length == 0) return null;
103
+
104
+ var voteValue = 0;
105
+ _.each(self.votes, function(vote) {
106
+ voteValue += vote.value;
107
+ });
108
+
109
+ return voteValue;
110
+
111
+ });
112
+
98
113
  ///////////////////////////////////////////////////////////////////////////////////////
99
114
  // METHODS
100
115
  // Methods operate on a single document that has already been returned
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "5.10.5",
3
+ "version": "5.10.6",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",