From 8e393fd7b58c9d7ca11baa992251debd66da07b0 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 4 Sep 2024 09:48:27 +0200 Subject: [PATCH] Include maintaining rep tokens for maintainers status (#7053) --- app/commands/track/retrieve_maintainers_status.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/commands/track/retrieve_maintainers_status.rb b/app/commands/track/retrieve_maintainers_status.rb index dd7e46383f..97aa920f8b 100644 --- a/app/commands/track/retrieve_maintainers_status.rb +++ b/app/commands/track/retrieve_maintainers_status.rb @@ -6,7 +6,7 @@ class Track::RetrieveMaintainersStatus LAST_NUMBER_OF_MONTHS_FOR_REP = 9 def call - Rails.cache.fetch("Track::RetrieveMaintainersStatus/2", expires_in: 1.day) do + Rails.cache.fetch(CACHE_KEY, expires_in: CACHE_EXPIRY) do tracks.index_with { |track| track_maintainers(track) } end end @@ -81,7 +81,7 @@ def track_contributors includes(user: :data). joins(:track). where('tracks.slug': track_slug). - where(category: :building). + where(category: %i[building maintaining]). where('user_reputation_tokens.created_at > ?', rep_cutoff_date). group(:user). sum(:value). @@ -107,4 +107,8 @@ def track_slugs = tracks.pluck(:slug) memoize def rep_cutoff_date = Time.zone.today - LAST_NUMBER_OF_MONTHS_FOR_REP.months + + CACHE_KEY = "Track::RetrieveMaintainersStatus/3".freeze + CACHE_EXPIRY = 1.day.freeze + private_constant :CACHE_KEY, :CACHE_EXPIRY end