Skip to content

Commit

Permalink
Fix for Downloads stats to exclude harvested public plans downloads as
Browse files Browse the repository at this point in the history
they distort Org stats.

Change:
 - We exclude dowloads in export_plans table for which user_id is nil in
   count.
  • Loading branch information
John Pinto committed Oct 14, 2024
1 parent 56759df commit d9a7fd9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/stat_exported_plan/create_or_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def org_plan_ids(org_id:, filtered:)
.uniq
end

# Exclude plans harvested by robots, by excluding plans that have a user_id nil.
def exported_plans(start_date:, end_date:, org_id:, filtered:)
ExportedPlan.where(plan_id: org_plan_ids(org_id: org_id, filtered: filtered))
.where(created_at: start_date..end_date)
.where.not(user_id: nil)
.count
end
end
Expand Down

0 comments on commit d9a7fd9

Please sign in to comment.