Changeset 4899
- Timestamp:
- 02/10/2017 01:26:17 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js
r3857 r4899 100 100 101 101 render: function() { 102 var data = { 103 'income': 0, 104 'expenses': 0, 105 'variance': 0, 106 'variance_raw': 0, 107 'per_person': 0 108 }; 102 var attendees = wcb.table.collection.findWhere({type: 'meta', name: 'attendees'}), 103 days = wcb.table.collection.findWhere({type: 'meta', name: 'days'}), 104 data = { 105 'income': 0, 106 'expenses': 0, 107 'variance': 0, 108 'variance_raw': 0, 109 'per_person': 0 110 }; 109 111 110 112 _.each(wcb.table.collection.where({type: 'income'}), function(item) { … … 118 120 data['variance'] = data['income'] - data['expenses']; 119 121 data['variance_raw'] = data['variance']; 120 var attendees = wcb.table.collection.findWhere({type: 'meta', name: 'attendees'}); 121 data['per_person'] = attendees ? data['expenses'] / attendees.get('value') : 0; 122 data['per_person'] = (attendees && days) ? data['expenses'] / attendees.get('value') / days.get('value'): 0; 122 123 123 124 data = _.mapObject(data, function(v, k) {
Note: See TracChangeset
for help on using the changeset viewer.