我已经开始在Sinatra-Padrino的我的PivotalTracker中使用Ruby了。
它提供了非常好的API,但我被困在了一个需求中。我想要the sum of the points/estimates of all the stories which are features。
我尝试过的(project是PT项目的一个实例):
project.stories.all({ :story_type => ['feature'], :includedone=>true }).sum(:estimate)但是这会抛出一个错误
undefined method `+' for #<PivotalTracker::Story:0x00000003aae9e0>然后,我也尝试将estimate作为筛选器参数进行传递,但返回了一个内部服务器错误。
现在,我的问题出在我开始的地方。有没有办法达到上述要求?如果没有,请推荐其他可以提供特性/功能的gem来满足上述要求。
发布于 2012-06-07 18:02:58
不确定这是否是最好的方法,但您可以尝试:
project.stories.all({ :story_type => ['feature'], :includedone=>true }).map(&:estimate).sumhttps://stackoverflow.com/questions/10927164
复制相似问题