Commit a4608df8 by Miles Steele

make year_of_birth graph bigger, add display names to analytics, remove extra…

make year_of_birth graph bigger, add display names to analytics, remove extra context, fix typos & formatting
parent f77ebc82
...@@ -15,7 +15,7 @@ AVAILABLE_FEATURES = STUDENT_FEATURES + PROFILE_FEATURES ...@@ -15,7 +15,7 @@ AVAILABLE_FEATURES = STUDENT_FEATURES + PROFILE_FEATURES
def enrolled_students_profiles(course_id, 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) # enrollments = CourseEnrollment.objects.filter(course_id=course_id)
# students = [enrollment.user for enrollment in enrollments] # students = [enrollment.user for enrollment in enrollments]
......
...@@ -14,7 +14,12 @@ def profile_distribution(course_id, feature): ...@@ -14,7 +14,12 @@ def profile_distribution(course_id, feature):
Retrieve distribution of students over a given feature. Retrieve distribution of students over a given feature.
feature is one of AVAILABLE_PROFILE_FEATURES. 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 display_names is only return for EASY_CHOICE type eatuers
note no_data instead of None to be compatible with the json spec. note no_data instead of None to be compatible with the json spec.
data types e.g. data types e.g.
......
...@@ -80,7 +80,7 @@ def update_forum_role_membership(course_id, user, rolename, mode): ...@@ -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] 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) role = Role.objects.get(course_id=course_id, name=rolename)
......
...@@ -33,19 +33,17 @@ def instructor_dashboard_2(request, course_id): ...@@ -33,19 +33,17 @@ def instructor_dashboard_2(request, course_id):
"""Display the instructor dashboard for a course.""" """Display the instructor dashboard for a course."""
course = get_course_by_id(course_id, depth=None) 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 = { access = {
'instructor': instructor_access, 'admin': request.user.is_staff,
'staff': staff_access, 'instructor': has_access(request.user, course, 'instructor'), # an instructor can manage staff lists
'forum_admin': forum_admin_access, '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 = [ sections = [
_section_course_info(course_id), _section_course_info(course_id),
_section_membership(course_id, access), _section_membership(course_id, access),
...@@ -56,15 +54,9 @@ def instructor_dashboard_2(request, course_id): ...@@ -56,15 +54,9 @@ def instructor_dashboard_2(request, course_id):
context = { context = {
'course': course, 'course': course,
'staff_access': True, # 'cohorts_ajax_url': reverse('cohorts', kwargs={'course_id': course_id}),
'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}),
'old_dashboard_url': reverse('instructor_dashboard', 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) return render_to_response('courseware/instructor_dashboard_2/instructor_dashboard_2.html', context)
......
...@@ -82,7 +82,7 @@ class Analytics ...@@ -82,7 +82,7 @@ class Analytics
grid_data = _.map feature_res.data, (value, key) -> grid_data = _.map feature_res.data, (value, key) ->
datapoint = {} datapoint = {}
datapoint[feature] = key datapoint[feature] = feature_res.display_names[key]
datapoint['count'] = value datapoint['count'] = value
datapoint datapoint
......
...@@ -53,6 +53,9 @@ setup_instructor_dashboard = (idash_content) => ...@@ -53,6 +53,9 @@ setup_instructor_dashboard = (idash_content) =>
section.addClass CSS_ACTIVE_SECTION section.addClass CSS_ACTIVE_SECTION
$(this).addClass CSS_ACTIVE_SECTION $(this).addClass CSS_ACTIVE_SECTION
# tracking
# analytics.pageview "instructor_#{section_name}"
# write deep link # write deep link
location.hash = "#{HASH_LINK_PREFIX}#{section_name}" location.hash = "#{HASH_LINK_PREFIX}#{section_name}"
......
...@@ -246,8 +246,8 @@ ...@@ -246,8 +246,8 @@
.distribution-display-graph { .distribution-display-graph {
.year-of-birth { .year-of-birth {
width: 500px; width: 750px;
height: 200px; height: 250px;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment