lib/place/work_item.rb
# Returns the total sum, for a given +field+, from descendant and workitem itself
# Note: descendants = children with parent role 
Returns the total sum, for a given +field+, from descendant and workitem itself
Note: descendants = children with parent role
Returns the total sum for a given + field + from descendant and workitem itself Note : descendants = children with parent role
def total_on(field)
	return self["_total_on_#{field}"]  unless self["_total_on_#{field}"].nil?
	total = self[field].nil? ? 0 : self[field]
	children.each{|c| total += c.total_on(field) }
	self["_total_on_#{field}"] = total.to_f
	self.save
	total.to_f
  end
def total_on ( field ) return self [ "_total_on_#{field}" ] unless self [ "_total_on_#{field}" ] . nil? total = self [ field ] . nil? ? 0 : self [ field ] children . each { | c | total += c . total_on ( field ) } self [ "_total_on_#{field}" ] = total . to_f self . save total . to_f end
Returns the total sum, for a given +field+, from descendant and workitem itself
Note: descendants = children with parent role
Returns the total sum for a given + field + from descendant and workitem itself Note : descendants = children with parent role
# return a past computed value if present # computing the total # saving (momoizing) for future invocations
field
<not_specific>