Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/usage_data_counters/hll_redis_counter.rb')
-rw-r--r--lib/gitlab/usage_data_counters/hll_redis_counter.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb
index 573ad1dce35..b61720c7638 100644
--- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb
+++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb
@@ -336,12 +336,10 @@ module Gitlab
end
def weekly_redis_keys(events:, start_date:, end_date:, context: '')
- weeks = end_date.to_date.cweek - start_date.to_date.cweek
- weeks = 1 if weeks == 0
-
- (0..(weeks - 1)).map do |week_increment|
- events.map { |event| redis_key(event, start_date + week_increment * 7.days, context) }
- end.flatten
+ end_date = end_date.end_of_week - 1.week
+ (start_date.to_date..end_date.to_date).map do |date|
+ events.map { |event| redis_key(event, date, context) }
+ end.flatten.uniq
end
end
end