Began replacing calls to helpers with calls to memoized functions

This commit is contained in:
Stefan Zermatten
2015-06-18 15:14:37 +02:00
parent a034cbf30e
commit 86c934e8ac
9 changed files with 58 additions and 48 deletions

View File

@@ -7,7 +7,7 @@ Template.skillRow.helpers({
return "radio-button-off";
},
failSkill: function(){
var charId = Template.parentData(1)._id;
var charId = Template.parentData()._id;
return Effects.find({
charId: charId,
stat: this.skill,
@@ -16,12 +16,13 @@ Template.skillRow.helpers({
}).count();
},
advantage: function(){
var advantage = Template.parentData(1).advantage(this.skill);
var charId = Template.parentData()._id;
var advantage = Characters.calculate.advantage(charId, this.skill);
if (advantage > 0) return "advantage";
if (advantage < 0) return "disadvantage";
},
conditionalCount: function(){
var charId = Template.parentData(1)._id;
var charId = Template.parentData()._id;
return Effects.find({
charId: charId,
stat: this.skill,