updated usage by pool report

This commit is contained in:
Adolfo Gómez García 2020-04-22 11:45:06 +02:00
parent 2d3b3af978
commit 54bd713de6
2 changed files with 8 additions and 5 deletions

View File

@ -115,6 +115,7 @@ class UsageByPool(StatsReport):
total = i.stamp - stamp
data.append({
'name': i.fld4,
'origin': i.fld2.split(':')[0],
'date': datetime.datetime.fromtimestamp(stamp),
'time': total,
'pool': pool.uuid,
@ -156,9 +157,9 @@ class UsageByPoolCSV(UsageByPool):
reportData = self.getData()[0]
writer.writerow([ugettext('Date'), ugettext('User'), ugettext('Seconds')])
writer.writerow([ugettext('Date'), ugettext('User'), ugettext('Seconds'), ugettext('Pool'), ugettext('Duration')])
for v in reportData:
writer.writerow([v['date'], v['name'], v['time']])
writer.writerow([v['date'], v['name'], v['time'], v['pool_name'], v['origin']])
return output.getvalue()

View File

@ -12,9 +12,10 @@
<thead>
<tr>
<th style="width: 20%">{% trans 'Access date/time' %}</th>
<th style="width: 30%">{% trans 'User' %}</th>
<th style="width: 20%">{% trans 'Duration (seconds)' %}</th>
<th style="width: 30%">{% trans 'Pool' %}</th>
<th style="width: 20%">{% trans 'User' %}</th>
<th style="width: 15%">{% trans 'Seconds' %}</th>
<th style="width: 25%">{% trans 'Pool' %}</th>
<th style="width: 20%">{% trans 'Origin' %}</th>
</tr>
</thead>
<tbody>
@ -24,6 +25,7 @@
<td>{{ user.name }}</td>
<td>{{ user.time }}</td>
<td>{{ user.pool_name }}</td>
<td>{{ user.origin }}</td>
</tr>
{% endfor %}
</tbody>