Skip to content

Commit

Permalink
change activity definition again to account for preprints
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tordoff committed Sep 23, 2024
1 parent 79b2d23 commit a4e84d3
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions osf/metrics/reporters/institution_summary_monthly.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,19 @@ def get_monthly_logged_in_user_count(self, institution, yearmonth):
).count()

def get_monthly_active_user_count(self, institution, yearmonth):
return institution.get_institution_users().filter(
date_disabled__isnull=True,
logs__created__gte=yearmonth.target_month(),
logs__created__lt=yearmonth.next_month(),
institution_users = institution.get_institution_users().filter(
date_disabled__isnull=True
)

).count()
active_users = institution_users.filter(
Q(
logs__created__gte=yearmonth.target_month(),
logs__created__lt= yearmonth.next_month()
) |
Q(
preprint_logs__created__gte=yearmonth.target_month(),
preprint_logs__created__lt= yearmonth.next_month()
)
).distinct()

return active_users.count()

0 comments on commit a4e84d3

Please sign in to comment.