Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### Fix
- 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.

## v4.2.0

**Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**
Expand Down
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
Loading