| Only cache results for reporting periods which are in the past. - reportable - … | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit d0baa6eb4e4a8330647bd6ff3f49df472f61188c | |
| parent 82ac39c518135608936c8780b1736801a982bb69 | |
| Author: Dieter Komendera <[email protected]> | |
| Date: Thu, 22 May 2014 11:52:21 +0200 | |
| Only cache results for reporting periods which are in the past. | |
| Diffstat: | |
| M lib/saulabs/reportable/report_cach… | 4 +++- | |
| 1 file changed, 3 insertions(+), 1 deletion(-) | |
| --- | |
| diff --git a/lib/saulabs/reportable/report_cache.rb b/lib/saulabs/reportable/re… | |
| @@ -93,10 +93,12 @@ module Saulabs | |
| while reporting_period < (options[:end_date] ? ReportingPeriod.new(o… | |
| if cached = cached_data.find { |cached| reporting_period == cached… | |
| result << [cached[0].date_time, cached[1]] | |
| - else | |
| + elsif reporting_period.last_date_time.past? | |
| new_cached = build_cached_data(report, options[:grouping], optio… | |
| new_cached.save! | |
| result << [reporting_period.date_time, new_cached.value] | |
| + else | |
| + result << [reporting_period.date_time, find_value(new_data, repo… | |
| end | |
| reporting_period = reporting_period.next | |
| end |