From a4608df866c2712f55cfc899a789b70629735e5d Mon Sep 17 00:00:00 2001 From: Miles Steele Date: Mon, 1 Jul 2013 10:58:46 -0400 Subject: [PATCH] make year_of_birth graph bigger, add display names to analytics, remove extra context, fix typos & formatting --- lms/djangoapps/analytics/basic.py | 2 +- lms/djangoapps/analytics/distributions.py | 7 ++++- lms/djangoapps/instructor/access.py | 2 +- .../instructor/views/instructor_dashboard.py | 26 +++++++------------ .../src/instructor_dashboard/analytics.coffee | 2 +- .../instructor_dashboard.coffee | 3 +++ .../sass/course/instructor/_instructor_2.scss | 4 +-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lms/djangoapps/analytics/basic.py b/lms/djangoapps/analytics/basic.py index eae293167a..a32335edac 100644 --- a/lms/djangoapps/analytics/basic.py +++ b/lms/djangoapps/analytics/basic.py @@ -15,7 +15,7 @@ AVAILABLE_FEATURES = STUDENT_FEATURES + PROFILE_FEATURES def enrolled_students_profiles(course_id, features): """ - Return array of student features e.g. [{?}, ...] + Return list of student features e.g. [{?}, ...] """ # enrollments = CourseEnrollment.objects.filter(course_id=course_id) # students = [enrollment.user for enrollment in enrollments] diff --git a/lms/djangoapps/analytics/distributions.py b/lms/djangoapps/analytics/distributions.py index c06e7bdcb0..ba320f0b82 100644 --- a/lms/djangoapps/analytics/distributions.py +++ b/lms/djangoapps/analytics/distributions.py @@ -14,7 +14,12 @@ def profile_distribution(course_id, feature): Retrieve distribution of students over a given feature. feature is one of AVAILABLE_PROFILE_FEATURES. - Returna dictionary {'type': 'SOME_TYPE', 'data': {'key': 'val'}, 'display_names': {'key': 'displaynameval'}} + Return a dictionary { + 'type': 'SOME_TYPE', + 'data': {'key': 'val'}, + 'display_names': {'key': 'displaynameval'} + } + display_names is only return for EASY_CHOICE type eatuers note no_data instead of None to be compatible with the json spec. data types e.g. diff --git a/lms/djangoapps/instructor/access.py b/lms/djangoapps/instructor/access.py index 43326b325f..b07a8b3d39 100644 --- a/lms/djangoapps/instructor/access.py +++ b/lms/djangoapps/instructor/access.py @@ -80,7 +80,7 @@ def update_forum_role_membership(course_id, user, rolename, mode): rolename is one of [FORUM_ROLE_ADMINISTRATOR, FORUM_ROLE_MODERATOR, FORUM_ROLE_COMMUNITY_TA] - mode is one of ['alow', 'revoke'] + mode is one of ['allow', 'revoke'] """ role = Role.objects.get(course_id=course_id, name=rolename) diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 96bee1116f..6d622dd26f 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -33,19 +33,17 @@ def instructor_dashboard_2(request, course_id): """Display the instructor dashboard for a course.""" course = get_course_by_id(course_id, depth=None) - instructor_access = has_access(request.user, course, 'instructor') # an instructor can manage staff lists - staff_access = has_access(request.user, course, 'staff') - forum_admin_access = has_forum_access(request.user, course_id, FORUM_ROLE_ADMINISTRATOR) - - if not staff_access: - raise Http404 access = { - 'instructor': instructor_access, - 'staff': staff_access, - 'forum_admin': forum_admin_access, + 'admin': request.user.is_staff, + 'instructor': has_access(request.user, course, 'instructor'), # an instructor can manage staff lists + 'staff': has_access(request.user, course, 'staff'), + 'forum_admin': has_forum_access(request.user, course_id, FORUM_ROLE_ADMINISTRATOR), } + if not access['staff']: + raise Http404 + sections = [ _section_course_info(course_id), _section_membership(course_id, access), @@ -56,15 +54,9 @@ def instructor_dashboard_2(request, course_id): context = { 'course': course, - 'staff_access': True, - 'admin_access': request.user.is_staff, - 'instructor_access': instructor_access, - 'forum_admin_access': forum_admin_access, - 'djangopid': os.getpid(), - 'mitx_version': getattr(settings, 'MITX_VERSION_STRING', ''), - 'cohorts_ajax_url': reverse('cohorts', kwargs={'course_id': course_id}), + # 'cohorts_ajax_url': reverse('cohorts', kwargs={'course_id': course_id}), 'old_dashboard_url': reverse('instructor_dashboard', kwargs={'course_id': course_id}), - 'sections': sections + 'sections': sections, } return render_to_response('courseware/instructor_dashboard_2/instructor_dashboard_2.html', context) diff --git a/lms/static/coffee/src/instructor_dashboard/analytics.coffee b/lms/static/coffee/src/instructor_dashboard/analytics.coffee index 961994b960..e586a2400a 100644 --- a/lms/static/coffee/src/instructor_dashboard/analytics.coffee +++ b/lms/static/coffee/src/instructor_dashboard/analytics.coffee @@ -82,7 +82,7 @@ class Analytics grid_data = _.map feature_res.data, (value, key) -> datapoint = {} - datapoint[feature] = key + datapoint[feature] = feature_res.display_names[key] datapoint['count'] = value datapoint diff --git a/lms/static/coffee/src/instructor_dashboard/instructor_dashboard.coffee b/lms/static/coffee/src/instructor_dashboard/instructor_dashboard.coffee index 151e368427..705bf630d7 100644 --- a/lms/static/coffee/src/instructor_dashboard/instructor_dashboard.coffee +++ b/lms/static/coffee/src/instructor_dashboard/instructor_dashboard.coffee @@ -53,6 +53,9 @@ setup_instructor_dashboard = (idash_content) => section.addClass CSS_ACTIVE_SECTION $(this).addClass CSS_ACTIVE_SECTION + # tracking + # analytics.pageview "instructor_#{section_name}" + # write deep link location.hash = "#{HASH_LINK_PREFIX}#{section_name}" diff --git a/lms/static/sass/course/instructor/_instructor_2.scss b/lms/static/sass/course/instructor/_instructor_2.scss index a65fe24291..1804511d9a 100644 --- a/lms/static/sass/course/instructor/_instructor_2.scss +++ b/lms/static/sass/course/instructor/_instructor_2.scss @@ -246,8 +246,8 @@ .distribution-display-graph { .year-of-birth { - width: 500px; - height: 200px; + width: 750px; + height: 250px; } }