Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes incorrect site monthly metrics course completion data #219

Merged
merged 1 commit into from
Jun 11, 2020
Merged
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
1 change: 1 addition & 0 deletions figures/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def get_total_site_users_joined_for_time_period(site, start_date, end_date,
"""returns the number of new enrollments for the time period

NOTE: Untested and not yet used in the general site metrics, but we'll want to add it
TODO: Rename this function to be "new_users" for consistency with the API endpoint
"""
def calc_from_user_model():
filter_args = dict(
Expand Down
5 changes: 4 additions & 1 deletion figures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ def registered_users(self, request):

@list_route()
def new_users(self, request):
"""
TODO: Rename the metrics module function to "new_users" to match this
"""
site = django.contrib.sites.shortcuts.get_current_site(self.request)
date_for = datetime.utcnow().date()
months_back = 6
Expand All @@ -585,7 +588,7 @@ def course_completions(self, request):
months_back = 6

course_completions = metrics.get_monthly_history_metric(
func=metrics.get_total_site_users_for_time_period,
func=metrics.get_total_course_completions_for_time_period,
site=site,
date_for=date_for,
months_back=months_back,
Expand Down