show last payout in stats table

master
lza_menace 4 years ago
parent 265441113e
commit 55da2573a4

@ -36,6 +36,12 @@ class Operation(db.Model):
b = cache.get_balances(self.account_idx, atomic=atomic) b = cache.get_balances(self.account_idx, atomic=atomic)
return b return b
def get_last_payout(self):
last_payout = Payout.query.filter(
Payout.operation_id == self.id
).order_by(Payout.create_date.desc()).first()
return last_payout
def get_pricing(self, live=False): def get_pricing(self, live=False):
if live: if live:
droplet_size = cache.show_droplet(self.droplet_id)['size_slug'] droplet_size = cache.show_droplet(self.droplet_id)['size_slug']

@ -21,6 +21,7 @@
<th>XMR Account</th> <th>XMR Account</th>
<th>Droplet ID</th> <th>Droplet ID</th>
<th>Volume ID</th> <th>Volume ID</th>
<th>Last Payout</th>
<th>Balances</th> <th>Balances</th>
</tr> </tr>
{% for op in all_ops['active'] | sort(attribute='create_date', reverse=True) %} {% for op in all_ops['active'] | sort(attribute='create_date', reverse=True) %}
@ -32,8 +33,9 @@
<td><a href="{{ url_for('operation.view_operation', id=op.id) }}" target="_blank">{{ op.codename }}</a></td> <td><a href="{{ url_for('operation.view_operation', id=op.id) }}" target="_blank">{{ op.codename }}</a></td>
<td>{{ op.account_idx }}</td> <td>{{ op.account_idx }}</td>
<td>{{ op.droplet_id }}</td> <td>{{ op.droplet_id }}</td>
<td>{{ op.volume_id }}</td> <td>{{ op.volume_id }}</td>
<td>{{ unlocked }} XMR ({{ locked }} locked)</td> <td>{{ op.get_last_payout().create_date | humanize }}</td>
<td>{{ unlocked }} XMR ({{ locked }} locked)</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

Loading…
Cancel
Save