app/models/esa/context.rb in event_sourced_accounting-0.1.3 vs app/models/esa/context.rb in event_sourced_accounting-0.1.4

- old
+ new

@@ -69,10 +69,12 @@ end def check_freshness(depth=0) if self.is_update_needed? self.update! + else + self.update_freshness_timestamp! end if depth > 0 and self.last_transaction_time.present? self.subcontexts.each do |sub| if sub.freshness.nil? or sub.freshness <= self.last_transaction_time @@ -102,9 +104,14 @@ checker.check(self) end end self.update_name + self.save if self.can_be_persisted? + end + + def update_freshness_timestamp! + self.freshness = Time.zone.now self.save if self.can_be_persisted? end def subcontext_namespaces self.subcontexts.pluck(:namespace).compact.uniq