From 794da3c258d24a9c6e89386776e96d586f71ce96 Mon Sep 17 00:00:00 2001 From: atesker Date: Mon, 26 Aug 2019 10:57:32 -0400 Subject: [PATCH] filter on masters track only and correct column names update ut cr updates changelog --- CHANGELOG.rst | 8 ++++++-- bulk_grades/__init__.py | 2 +- bulk_grades/api.py | 12 +++++++----- bulk_grades/views.py | 1 - tests/test_api.py | 12 ++++++------ 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bfa0748..161ad0d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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. @@ -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 @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/bulk_grades/__init__.py b/bulk_grades/__init__.py index 72c0080..e69cfbb 100644 --- a/bulk_grades/__init__.py +++ b/bulk_grades/__init__.py @@ -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 diff --git a/bulk_grades/api.py b/bulk_grades/api.py index 6de075e..3662589 100644 --- a/bulk_grades/api.py +++ b/bulk_grades/api.py @@ -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. @@ -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 @@ -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() @@ -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), diff --git a/bulk_grades/views.py b/bulk_grades/views.py index cbc38bc..6387060 100644 --- a/bulk_grades/views.py +++ b/bulk_grades/views.py @@ -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'), diff --git a/tests/test_api.py b/tests/test_api.py index d126faa..b50721f 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -177,15 +177,15 @@ def test_export(self, mocked_api, mocked_course_grade_factory): 'audit@example.com': {'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}, 'masters@example.com': {'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 = \ @@ -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