From a8596e9b68c147ce4c3e5a92c9246ad269848144 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Mon, 26 Aug 2013 10:28:44 -0600 Subject: [PATCH] cache some settings we can SIGHUP if we ever change them Change-Id: I0e7d0fa63ce0e368e890eb7ea8d5e657fa3820a1 Reviewed-on: https://gerrit.instructure.com/23729 Reviewed-by: Zach Wily Reviewed-by: Brian Palmer QA-Review: Rob Orton Product-Review: Cody Cutrer Tested-by: Cody Cutrer --- app/models/account.rb | 6 +++--- app/models/content_participation_count.rb | 2 +- app/presenters/grade_summary_presenter.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index 28cbe09b5ef..40bcc2cf314 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -232,15 +232,15 @@ class Account < ActiveRecord::Base end def terms_of_use_url - Setting.get('terms_of_use_url', 'http://www.instructure.com/policies/terms-of-use') + Setting.get_cached('terms_of_use_url', 'http://www.instructure.com/policies/terms-of-use') end def privacy_policy_url - Setting.get('privacy_policy_url', 'http://www.instructure.com/policies/privacy-policy-instructure') + Setting.get_cached('privacy_policy_url', 'http://www.instructure.com/policies/privacy-policy-instructure') end def terms_required? - Setting.get('terms_required', 'true') == 'true' + Setting.get_cached('terms_required', 'true') == 'true' end def require_acceptance_of_terms?(user) diff --git a/app/models/content_participation_count.rb b/app/models/content_participation_count.rb index 0598b838a1f..3a5cd54e0d9 100644 --- a/app/models/content_participation_count.rb +++ b/app/models/content_participation_count.rb @@ -117,7 +117,7 @@ class ContentParticipationCount < ActiveRecord::Base # - unmuting an assignment with submissions # - deleting a discussion/announcement/assignment/submission def ttl - Setting.get('content_participation_count_ttl', 30.minutes).to_i + Setting.get_cached('content_participation_count_ttl', 30.minutes).to_i end private :ttl end diff --git a/app/presenters/grade_summary_presenter.rb b/app/presenters/grade_summary_presenter.rb index bc40419e135..0e7f750d524 100644 --- a/app/presenters/grade_summary_presenter.rb +++ b/app/presenters/grade_summary_presenter.rb @@ -172,7 +172,7 @@ class GradeSummaryPresenter protected def allow_loading_all_submissions? - threshold = Setting.get('grade_distributions_submission_count_threshold', '0').to_i + threshold = Setting.get_cached('grade_distributions_submission_count_threshold', '0').to_i @context.allows_gradebook_uploads? && (threshold == 0 || @context.submissions.count < threshold) end end