Skip to content
Snippets Groups Projects
Commit 0de41f31 authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

[statistics] added statistics about user profiles on the platform for the superusers

parent 04c2d6ee
No related branches found
No related tags found
1 merge request!224Security accounts
Pipeline #
......@@ -91,6 +91,21 @@
<p class="help">Items available and managed by administrators</p>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<h3>Users Profiles</h3>
<ul class="list-group">
<li class="list-group-item">Total Users <span class="badge">{{ totals.users }}</span></li>
<li class="list-group-item">New Users Unvalidated <span class="badge">{{ totals.newusers }}</span></li>
<li class="list-group-item">New Users Waiting Validation <span class="badge">{{ totals.waitingvalidationusers}}</span></li>
<li class="list-group-item">Accepted Users <span class="badge">{{ totals.acceptedusers }}</span></li>
<li class="list-group-item">Year Revalidation Users <span class="badge">{{ totals.yearrevalidationusers }}</span></li>
<li class="list-group-item">Rejected Users <span class="badge">{{ totals.rejectedusers }}</span></li>
<li class="list-group-item">Blocked Users <span class="badge">{{ totals.blockedusers }}</span></li>
</ul>
<p class="help">Users on the platform</p>
</div>
</div>
<!-- tabs -->
......
......@@ -56,6 +56,7 @@ def calculate_totals():
from ..plotters.models import Plotter
from ..plotters.models import PlotterParameter
from ..search.models import Search
from ..accounts.models import Profile
# for calculating the total cpu time, we use the HourlyStatistics and
# accumulate over the whole history
......@@ -78,6 +79,13 @@ def calculate_totals():
output_size = details['data_written_size']
output_time = details['data_written_time']
new_users = User.objects.filter(profile__status = Profile.NEWUSER)
waiting_validation_users = User.objects.filter(profile__status = Profile.WAITINGVALIDATION)
accepted_users = User.objects.filter(profile__status = Profile.ACCEPTED)
rejected_users = User.objects.filter(profile__status = Profile.REJECTED)
yearrevalidation_users = User.objects.filter(profile__status = Profile.YEARREVALIDATION)
blocked_users = User.objects.filter(profile__status = Profile.BLOCKED)
return dict(
counter=counter,
......@@ -89,6 +97,12 @@ def calculate_totals():
output_bw_mb_s = int((output_size/float(2**20))/output_time) if output_size else 0,
users=User.objects.count(),
newusers=new_users.count(),
waitingvalidationusers=waiting_validation_users.count(),
acceptedusers=accepted_users.count(),
rejectedusers=rejected_users.count(),
yearrevalidationusers=yearrevalidation_users.count(),
blockedusers=blocked_users.count(),
databases=Database.objects.count(),
environments=Environment.objects.count(),
queues=Queue.objects.count(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment