Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding metric total of sessions #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Squirrel18 marked this conversation as resolved.
Show resolved Hide resolved
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