Added mor info to pools usage summary

This commit is contained in:
Adolfo Gómez García 2020-05-30 20:55:21 +02:00
parent d0e7dde571
commit 779dfe1fc4
2 changed files with 13 additions and 7 deletions

View File

@ -103,13 +103,16 @@ class PoolsUsageSummary(UsageByPool):
'name': p['name'],
'time': str(datetime.timedelta(seconds=p['time'])),
'count': p['count'],
'users': p['users']
'users': p['users'],
'mean': str(datetime.timedelta(seconds=p['time'] // int(p['count']))),
}
for p in pools
),
'time': str(datetime.timedelta(seconds=totalTime)),
'count': totalCount,
'users': uniqueUsers,
'mean': str(datetime.timedelta(seconds=totalTime // totalCount)),
'start': start,
'end': end,
},
@ -134,11 +137,11 @@ class PoolsUsageSummaryCSV(PoolsUsageSummary):
reportData, totalTime, totalCount, totalUsers = self.getData()
writer.writerow([ugettext('Pool'), ugettext('Total Time (seconds)'), ugettext('Total Accesses')])
writer.writerow([ugettext('Pool'), ugettext('Total Time (seconds)'), ugettext('Total Accesses'), ugettext('Unique users'), ugettext('Mean time (seconds)')])
for v in reportData:
writer.writerow([v['name'], v['time'], v['count'], v['users']])
writer.writerow([v['name'], v['time'], v['count'], v['users'], v['time'] // v['count']])
writer.writerow([ugettext('Total'), totalTime, totalCount, totalUsers])
writer.writerow([ugettext('Total'), totalTime, totalCount, totalUsers, totalTime // totalCount])
return output.getvalue()

View File

@ -12,9 +12,10 @@
<thead>
<tr>
<th style="width: 40%">{% trans 'Pool' %}</th>
<th style="width: 20%">{% trans 'Total time' %}</th>
<th style="width: 20%">{% trans 'Total accesses' %}</th>
<th style="width: 20%">{% trans 'Unique users' %}</th>
<th style="width: 15%">{% trans 'Total time' %}</th>
<th style="width: 15%">{% trans 'Total accesses' %}</th>
<th style="width: 15%">{% trans 'Unique users' %}</th>
<th style="width: 15%">{% trans 'Mean time' %}</th>
</tr>
</thead>
<tbody>
@ -24,6 +25,7 @@
<td>{{ pool.time }}</td>
<td>{{ pool.count }}</td>
<td>{{ pool.users }}</td>
<td>{{ pool.mean }}</td>
</tr>
{% endfor %}
<tr>
@ -31,6 +33,7 @@
<td>{{ time }}</td>
<td>{{ count }}</td>
<td>{{ users }}</td>
<td>{{ mean }}</td>
</tr>
</tbody>
</table>