Skip to content

Commit ee6c76d

Browse files
author
John Pinto
committed
Fix to exclude downloads of public plans with no user id associated with
download, as most of these downloads are associated with robots. Change: - We exclude the count of downloads in export_plans table for which user_id is nil.
1 parent 56759df commit ee6c76d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
### Fix
4+
- Fix for removing from statistics the count of the download of plans that lack an user id in exported_plans table. Most of such downloads will have been associated with robots harvesting.
5+
36
## v4.2.0
47

58
**Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**

app/models/stat_exported_plan/create_or_update.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ def org_plan_ids(org_id:, filtered:)
4040
.uniq
4141
end
4242

43+
# Exclude plans harvested by robots, by excluding plans that have a user_id nil.
4344
def exported_plans(start_date:, end_date:, org_id:, filtered:)
4445
ExportedPlan.where(plan_id: org_plan_ids(org_id: org_id, filtered: filtered))
4546
.where(created_at: start_date..end_date)
47+
.where.not(user_id: nil)
4648
.count
4749
end
4850
end

0 commit comments

Comments
 (0)