Skip to content

Commit

Permalink
add user_name field
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Sep 6, 2024
1 parent ca3ab51 commit e7dd750
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions osf/metrics/reporters/institutional_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __post_init__(self):
report_yearmonth=self.yearmonth,
institution_id=self.institution._id,
user_id=self.user._id,
user_name=self.user.fullname,
department_name=(_affiliation.sso_department or None),
month_last_login=YearMonth.from_date(self.user.date_last_login),
account_creation_date=YearMonth.from_date(self.user.created),
Expand Down
3 changes: 2 additions & 1 deletion osf/metrics/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ class InstitutionalUserReport(MonthlyReport):
institution_id = metrics.Keyword()
# user info:
user_id = metrics.Keyword()
department_name = metrics.Keyword()
user_name = metrics.Text()
department_name = metrics.Text()
month_last_login = YearmonthField()
account_creation_date = YearmonthField()
orcid_id = metrics.Keyword()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _assert_report_matches_setup(self, report: InstitutionalUserReport, setup: _
self.assertEqual(report.institution_id, setup.institution._id)
# user info:
self.assertEqual(report.user_id, setup.user._id)
self.assertEqual(report.user_name, setup.user.fullname)
self.assertEqual(report.department_name, setup.department_name)
self.assertEqual(report.month_last_login, YearMonth.from_date(setup.user.date_last_login))
self.assertEqual(report.account_creation_date, YearMonth.from_date(setup.user.created))
Expand Down

0 comments on commit e7dd750

Please sign in to comment.