[#4604] Timestamp the last caching run
This commit is contained in:
@@ -80,6 +80,7 @@ class Rate < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
end
|
||||
store_cache_timestamp('last_caching_run', Time.now.to_s)
|
||||
end
|
||||
|
||||
private
|
||||
@@ -121,6 +122,10 @@ class Rate < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def self.store_cache_timestamp(cache_name, timestamp)
|
||||
Setting.plugin_redmine_rate = Setting.plugin_redmine_rate.merge({cache_name => timestamp})
|
||||
end
|
||||
|
||||
if Rails.env.test?
|
||||
public
|
||||
generator_for :date_in_effect => Date.today
|
||||
|
||||
7
init.rb
7
init.rb
@@ -29,7 +29,12 @@ Redmine::Plugin.register :redmine_rate do
|
||||
version '0.1.0'
|
||||
|
||||
requires_redmine :version_or_higher => '0.8.0'
|
||||
|
||||
|
||||
# These settings are set automatically when caching
|
||||
settings(:default => {
|
||||
'last_caching_run' => nil
|
||||
})
|
||||
|
||||
permission :view_rate, { }
|
||||
end
|
||||
|
||||
|
||||
@@ -292,6 +292,13 @@ class RateTest < ActiveSupport::TestCase
|
||||
|
||||
end
|
||||
|
||||
should "timestamp a successful run"
|
||||
should "timestamp a successful run" do
|
||||
assert_equal nil, Setting.plugin_redmine_rate['last_caching_run']
|
||||
|
||||
Rate.update_all_time_entries_with_missing_cost
|
||||
|
||||
assert Setting.plugin_redmine_rate['last_caching_run'], "Last run not timestamped"
|
||||
assert Time.parse(Setting.plugin_redmine_rate['last_caching_run']), "Last run timestamp not parseable"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user