diff --git a/rdmo/core/management/commands/find_spam_users.py b/rdmo/core/management/commands/find_spam_users.py index 0ff7e6b21..a29800fa1 100644 --- a/rdmo/core/management/commands/find_spam_users.py +++ b/rdmo/core/management/commands/find_spam_users.py @@ -132,19 +132,16 @@ def find_potential_spam_users(self, timespan, occurrence): def handle(self, *args, **options): no_total_users = User.objects.all().count() - print('Total no of users: %d' % (no_total_users)) + print(f'Total no of users: {no_total_users}') potential_spam_users, no_users_having_projects =\ self.find_potential_spam_users( options['timespan'], options['occurrence'] ) print( - 'Potential spam users: %d %.2f%% / of which have at least one project %d' - % ( - len(potential_spam_users), - (100/no_total_users)*len(potential_spam_users), - no_users_having_projects - ) + f'Potential spam users: {len(potential_spam_users)} ' + f'{(100 / no_total_users) * len(potential_spam_users):.2f}% ' + f'/ of which have at least one project {no_users_having_projects}' ) self.save_csv(potential_spam_users, options['output_file']) diff --git a/rdmo/core/management/commands/find_users.py b/rdmo/core/management/commands/find_users.py index c67903624..13a03e335 100644 --- a/rdmo/core/management/commands/find_users.py +++ b/rdmo/core/management/commands/find_users.py @@ -99,15 +99,12 @@ def find_users(self, options): def handle(self, *args, **options): no_total_users = User.objects.all().count() - print('Total no of users: %d' % (no_total_users)) + print(f'Total no of users: {no_total_users}') found_users = self.find_users(options) print( - 'Matching the filter: %d %.2f%%' - % ( - len(found_users), - (100/no_total_users)*len(found_users) - ) + f'Matching the filter: {len(found_users)} ' + f'{(100 / no_total_users) * len(found_users):.2f}% ' ) self.save_csv(found_users, options['output_file'])