From a3171eb8d87e2123d21310f0eaa891f586f06da5 Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Thu, 23 Oct 2014 14:41:23 -0400 Subject: [PATCH] Removed Analytics API Client Instructors should use Insights instead. --- .../instructor/views/instructor_dashboard.py | 38 +------------------ lms/envs/common.py | 6 +-- lms/envs/dev.py | 4 -- lms/envs/devstack.py | 4 -- .../instructor_analytics.html | 12 ------ requirements/edx/github.txt | 1 - 6 files changed, 3 insertions(+), 62 deletions(-) diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index cdcf2b4e31..190e10fb7b 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -15,7 +15,7 @@ from django.views.decorators.cache import cache_control from edxmako.shortcuts import render_to_response from django.core.urlresolvers import reverse from django.utils.html import escape -from django.http import Http404, HttpResponse, HttpResponseNotFound +from django.http import Http404 from django.conf import settings from util.json_request import JsonResponse @@ -35,13 +35,10 @@ from course_modes.models import CourseMode, CourseModesArchive from student.roles import CourseFinanceAdminRole from class_dashboard.dashboard_data import get_section_display_name, get_array_section_has_problem - -from analyticsclient.client import Client -from analyticsclient.exceptions import ClientError - from .tools import get_units_with_due_date, title_or_url, bulk_email_is_enabled_for_course from opaque_keys.edx.locations import SlashSeparatedCourseKey + log = logging.getLogger(__name__) @@ -368,9 +365,6 @@ def _section_analytics(course, access): 'proxy_legacy_analytics_url': reverse('proxy_legacy_analytics', kwargs={'course_id': course_key.to_deprecated_string()}), } - if settings.FEATURES.get('ENABLE_ANALYTICS_ACTIVE_COUNT'): - _update_active_students(course_key, section_data) - return section_data @@ -389,31 +383,3 @@ def _section_metrics(course, access): 'post_metrics_data_csv_url': reverse('post_metrics_data_csv'), } return section_data - - -def _update_active_students(course_key, section_data): - auth_token = settings.ANALYTICS_DATA_TOKEN - base_url = settings.ANALYTICS_DATA_URL - - section_data['active_student_count'] = 'N/A' - section_data['active_student_count_start'] = 'N/A' - section_data['active_student_count_end'] = 'N/A' - - try: - client = Client(base_url=base_url, auth_token=auth_token) - course = client.courses(unicode(course_key)) - - recent_activity = course.recent_activity() - section_data['active_student_count'] = recent_activity['count'] - - def format_date(value): - return value.split('T')[0] - - start = recent_activity['interval_start'] - end = recent_activity['interval_end'] - - section_data['active_student_count_start'] = format_date(start) - section_data['active_student_count_end'] = format_date(end) - - except (ClientError, KeyError) as e: - log.exception(e) diff --git a/lms/envs/common.py b/lms/envs/common.py index 1ad593393d..97900cd92a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -268,10 +268,6 @@ FEATURES = { # nonzero grade cutoff is met 'SHOW_PROGRESS_SUCCESS_BUTTON': False, - # Analytics Data API (for active student count) - # Default to false here b/c dev environments won't have the api, will override in aws.py - 'ENABLE_ANALYTICS_ACTIVE_COUNT': False, - # When a logged in user goes to the homepage ('/') should the user be # redirected to the dashboard - this is default Open edX behavior. Set to # False to not redirect the user @@ -1833,7 +1829,7 @@ ADVANCED_SECURITY_CONFIG = {} SHIBBOLETH_DOMAIN_PREFIX = 'shib:' OPENID_DOMAIN_PREFIX = 'openid:' -### Analytics data api settings +### Analytics Data API + Dashboard (Insights) settings ANALYTICS_DATA_URL = "" ANALYTICS_DATA_TOKEN = "" ANALYTICS_DASHBOARD_URL = "" diff --git a/lms/envs/dev.py b/lms/envs/dev.py index 6432027b73..b01890f273 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -274,10 +274,6 @@ PIPELINE_SASS_ARGUMENTS = '--debug-info --require {proj_dir}/static/sass/bourbon ANALYTICS_SERVER_URL = "http://127.0.0.1:9000/" ANALYTICS_API_KEY = "" -ANALYTICS_DATA_URL = "http://127.0.0.1:8080" -ANALYTICS_DATA_TOKEN = "" -FEATURES['ENABLE_ANALYTICS_ACTIVE_COUNT'] = False - ##### Segment.io ###### # If there's an environment variable set, grab it and turn on Segment.io diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 9a9e9b417c..1eef9116f5 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -37,10 +37,6 @@ FEATURES['REQUIRE_COURSE_EMAIL_AUTH'] = False # Give all courses email (don't r ANALYTICS_SERVER_URL = "http://127.0.0.1:9000/" ANALYTICS_API_KEY = "" -ANALYTICS_DATA_URL = "http://127.0.0.1:8080" -ANALYTICS_DATA_TOKEN = "" -FEATURES['ENABLE_ANALYTICS_ACTIVE_COUNT'] = False - # Set this to the dashboard URL in order to display the link from the # dashboard to the Analytics Dashboard. ANALYTICS_DASHBOARD_URL = None diff --git a/lms/templates/instructor/instructor_dashboard_2/instructor_analytics.html b/lms/templates/instructor/instructor_dashboard_2/instructor_analytics.html index 8b3d18165d..07c86b7809 100644 --- a/lms/templates/instructor/instructor_dashboard_2/instructor_analytics.html +++ b/lms/templates/instructor/instructor_dashboard_2/instructor_analytics.html @@ -15,18 +15,6 @@ -%if settings.FEATURES.get('ENABLE_ANALYTICS_ACTIVE_COUNT'): -
-

${_("Active Students")}

- ${_("The count of students who interacted at least once by opening pages, playing videos, posting in discussions, submitting problems, or completing other activities. The date range includes all activities from midnight on the start date (inclusive) though midnight on the end date (exclusive).")} -

- ${ section_data['active_student_count'] } - for the week of (${ section_data['active_student_count_start'] } - ${ section_data['active_student_count_end'] }) -
-%endif - -
- %if settings.FEATURES['ENABLE_INSTRUCTOR_ANALYTICS']: