Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Sep 9, 2024
1 parent 34cbc9a commit 30619c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 2 additions & 4 deletions osf/management/commands/monthly_reporters_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ def add_arguments(self, parser):
)

def handle(self, *args, **options):
errors = monthly_reporters_go(
monthly_reporters_go(
report_year=getattr(options.get('yearmonth'), 'year', None),
report_month=getattr(options.get('yearmonth'), 'month', None),
)
for error_key, error_val in errors.items():
self.stdout.write(self.style.ERROR(f'error running {error_key}: ') + error_val)
self.stdout.write(self.style.SUCCESS('done.'))
self.stdout.write(self.style.SUCCESS('reporter tasks scheduled.'))
2 changes: 1 addition & 1 deletion osf/metrics/reporters/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def report(
def run_and_record_for_month(self, report_yearmonth: YearMonth) -> None:
reports = self.report(report_yearmonth)
for report in reports:
assert report.report_yearmonth == str(report_yearmonth)
assert str(report.report_yearmonth) == str(report_yearmonth)
report.save()


Expand Down
6 changes: 5 additions & 1 deletion osf/metrics/reporters/institutional_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def __post_init__(self):
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),
month_last_login=(
YearMonth.from_date(self.user.date_last_login)
if self.user.date_last_login is not None
else None
),
account_creation_date=YearMonth.from_date(self.user.created),
orcid_id=self.user.get_verified_external_id('ORCID', verified_only=True),
public_project_count=self._public_project_queryset().count(),
Expand Down

0 comments on commit 30619c5

Please sign in to comment.