Skip to content

Commit

Permalink
Merge pull request #27 from edx/andytr1/intervention-filter-program
Browse files Browse the repository at this point in the history
filter on masters track only and correct column names
  • Loading branch information
Andytr1 authored Aug 26, 2019
2 parents 55ac754 + 794da3c commit dadd546
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Change Log
in this file. It adheres to the structure of http://keepachangelog.com/ ,
but in reStructuredText instead of Markdown (for ease of incorporation into
Sphinx documentation and the PyPI description).
This project adheres to Semantic Versioning (http://semver.org/).

.. There should always be an "Unreleased" section for changes pending release.
Expand All @@ -16,6 +16,10 @@ Unreleased

*

[0.5.8] - 2019-08-26
~~~~~~~~~~~~~~~~~~~~
* Make intervention masters track nly. Some clan up.

[0.5.3] - 2019-08-16
~~~~~~~~~~~~~~~~~~~~
* Add support for filters to Interventions CSV report endpoint, mirroring bulk management filters
Expand All @@ -38,7 +42,7 @@ Added ability to filter by subsection & assignment grading type for bulk managem

[0.1.4] - 2019-07-02
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added an endpoint for this history of bulk management operations on grade overrides.
Added an endpoint for this history of bulk management operations on grade overrides.

[0.1.0] - 2019-05-24
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion bulk_grades/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import, unicode_literals

__version__ = '0.5.7'
__version__ = '0.5.8'

default_app_config = 'bulk_grades.apps.BulkGradesConfig' # pylint: disable=invalid-name
12 changes: 7 additions & 5 deletions bulk_grades/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,11 @@ def get_rows_to_export(self):

class InterventionCSVProcessor(CSVProcessor):
"""
CSV Processor for intervention report grades.
CSV Processor for intervention report grades for masters track only.
"""

MASTERS_TRACK = 'masters'

def __init__(self, **kwargs):
"""
Create InterventionCSVProcessor.
Expand All @@ -368,7 +370,7 @@ def __init__(self, **kwargs):
'number of forum posts overall', 'number of forum posts last week',
'date last active']
self.course_id = None
self.track = self.cohort = self.subsection = \
self.cohort = self.subsection = \
self.assignment_type = self.subsection_grade_min = \
self.subsection_grade_max = self.course_grade_min = \
self.course_grade_max = None
Expand Down Expand Up @@ -404,7 +406,7 @@ def get_rows_to_export(self):
"""
Return iterator of rows to export.
"""
enrollments = list(_get_enrollments(self._course_key, track=self.track, cohort=self.cohort))
enrollments = list(_get_enrollments(self._course_key, track=self.MASTERS_TRACK, cohort=self.cohort))
grades_api.prefetch_course_and_subsection_grades(self._course_key, [enroll['user'] for enroll in enrollments])
client = LearnerAPIClient()
intervention_list = client.courses(self.course_id).user_engagement().get()
Expand Down Expand Up @@ -451,8 +453,8 @@ def get_rows_to_export(self):
'number of problems last week': int_user.get('problems_last_week', 0),
'number of correct problems overall': int_user.get('correct_problems_overall', 0),
'number of correct problems last week': int_user.get('correct_problems_last_week', 0),
'number of problem attempts overall': int_user.get('problem_attempts_overall', 0),
'number of problem attempts last week': int_user.get('problem_attempts_last_week', 0),
'number of problem attempts overall': int_user.get('problems_attempts_overall', 0),
'number of problem attempts last week': int_user.get('problems_attempts_last_week', 0),
'number of forum posts overall': int_user.get('forum_posts_overall', 0),
'number of forum posts last week': int_user.get('forum_posts_last_week', 0),
'date last active': int_user.get('date_last_active', 0),
Expand Down
1 change: 0 additions & 1 deletion bulk_grades/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def initialize_processor(self, request, course_id):
self.processor = api.InterventionCSVProcessor(
course_id=course_id,
_user=request.user,
track=request.GET.get('track'),
cohort=request.GET.get('cohort'),
subsection=request.GET.get('assignment'),
assignment_type=request.GET.get('assignmentType'),
Expand Down
12 changes: 6 additions & 6 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ def test_export(self, mocked_api, mocked_course_grade_factory):
'[email protected]': {'videos_overall': 2, 'videos_last_week': 0, 'problems_overall': 10,
'problems_last_week': 5,
'correct_problems_overall': 66, 'correct_problems_last_week': 44,
'problem_attempts_overall': 233, 'problem_attempts_last_week': 221,
'correct_problem_attempts_overall': 101, 'correct_problem_attempts_last_week': 99,
'problems_attempts_overall': 233, 'problems_attempts_last_week': 221,
'correct_problems_attempts_overall': 101, 'correct_problems_attempts_last_week': 99,
'forum_posts_overall': 2, 'forum_posts_last_week': 0, 'date_last_active': 2},
'[email protected]': {'videos_overall': 12, 'videos_last_week': 0, 'problems_overall': 10,
'problems_last_week': 5,
'correct_problems_overall': 66, 'correct_problems_last_week': 44,
'problem_attempts_overall': 233, 'problem_attempts_last_week': 221,
'correct_problem_attempts_overall': 101,
'correct_problem_attempts_last_week': 99,
'problems_attempts_overall': 233, 'problems_attempts_last_week': 221,
'correct_problems_attempts_overall': 101,
'correct_problems_attempts_last_week': 99,
'forum_posts_overall': 2, 'forum_posts_last_week': 0, 'date_last_active': 2}
}
mocked_api.return_value.courses.return_value.intervention.return_value.get.return_value = \
Expand All @@ -194,4 +194,4 @@ def test_export(self, mocked_api, mocked_course_grade_factory):
mocked_course_grade_factory.return_value = course_grade_mock
processor = api.InterventionCSVProcessor(course_id=self.course_id)
rows = list(processor.get_iterator())
assert len(rows) == 4
assert len(rows) == 2

0 comments on commit dadd546

Please sign in to comment.