Skip to content

Commit

Permalink
Adding metric total of sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Millan committed Nov 15, 2019
1 parent aedf203 commit dc15e66
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions openedx_proversity_reports/reports/learning_tracker_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def generate_report(self):
'cumulative_grade': self._get_cumulative_grade(user),
'has_verified_certificate': self._has_verified_certificate(user),
'time_between_sessions': self._get_time_bewteen_sessions(user),
'total_sessions': self._get_total_sessions(user),
'weekly_clicks': self._get_weekly_clicks(user),
'number_of_graded_assessment': self._get_number_of_graded_assessment(user),
'timeliness_of_submissions': self._get_timeliness_of_submissions(user),
Expand Down Expand Up @@ -154,6 +155,22 @@ def _get_time_bewteen_sessions(self, user):
except ValueError:
return 0

def _get_total_sessions(self, user):
"""
Get learner metrics for "Total of sessions".
Args:
user: User Model.
Returns:
int (Total of sessions).
"""
user_profile = get_user_profile().objects.get(user_id=user.id)

try:
meta = json.loads(user_profile.meta)
return int(meta.get('session_number', 0))
except ValueError:
return 0

def _get_timeliness_of_submissions(self, user):
"""
The number of days that user submits assignments before the posted due date.
Expand Down

0 comments on commit dc15e66

Please sign in to comment.