From 906a9fb90653ce3a6eadca97f740f28d2f805168 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Mon, 13 Sep 2021 09:43:21 -0700 Subject: [PATCH] fix some weird little bugs --- app/library/cache.py | 2 +- app/library/digitalocean.py | 4 ++++ app/models.py | 4 ++-- app/templates/stats.html | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/library/cache.py b/app/library/cache.py index 9279f9d..9a65383 100644 --- a/app/library/cache.py +++ b/app/library/cache.py @@ -41,7 +41,7 @@ class Cache(object): data = '' return data except: - return {'error': 'true'} + return '' def get_info(self, codename): key_name = f'node_{codename}_info' diff --git a/app/library/digitalocean.py b/app/library/digitalocean.py index 9e51744..3bc4653 100644 --- a/app/library/digitalocean.py +++ b/app/library/digitalocean.py @@ -89,6 +89,10 @@ class DigitalOcean(object): # Droplets def create_droplet(self, name, region, extra_vols=[]): + # First check that droplet name does not exist + de = self.check_droplet_exists(name) + if de[0]: + return self.show_droplet(de[1]) data = { 'name': name, 'region': region, diff --git a/app/models.py b/app/models.py index 24a4d12..3598198 100644 --- a/app/models.py +++ b/app/models.py @@ -31,7 +31,7 @@ class Operation(db.Model): def get_node_tor_url(self): u = cache.get_tor_url(self.codename) - return u.decode() + return u def get_node_url(self): return f'{self.codename}.node.{config.DO_DOMAIN}' @@ -94,4 +94,4 @@ class Payout(db.Model): hours_since_last = db.Column(db.Integer) def __repr__(self): - return self.id + return f'payout-{self.id}' diff --git a/app/templates/stats.html b/app/templates/stats.html index 4a3df7b..6854c5a 100644 --- a/app/templates/stats.html +++ b/app/templates/stats.html @@ -34,7 +34,11 @@ {{ op.account_idx }} {{ op.droplet_id }} {{ op.volume_id }} + {% if op.get_last_payout() %} {{ op.get_last_payout().create_date | humanize }} + {% else %} + None + {% endif %} {{ unlocked }} XMR ({{ locked }} locked) {% endfor %}