Skip to content

Commit

Permalink
Include maintaining rep tokens for maintainers status (#7053)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored Sep 4, 2024
1 parent 3034d59 commit 8e393fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/commands/track/retrieve_maintainers_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand All @@ -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

0 comments on commit 8e393fd

Please sign in to comment.