From 8dacca38fef9d68b3499e3cbd32dee53abccfcb6 Mon Sep 17 00:00:00 2001
From: Inso <insomniak.fr@gmail.com>
Date: Sat, 22 Aug 2015 22:42:43 +0200
Subject: [PATCH] Fix negative validations in wot_tab #194

---
 src/cutecoin/core/graph.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/cutecoin/core/graph.py b/src/cutecoin/core/graph.py
index 1b5e876d..a192d6d0 100644
--- a/src/cutecoin/core/graph.py
+++ b/src/cutecoin/core/graph.py
@@ -188,7 +188,9 @@ class Graph(object):
                 current_validations = 0
             max_validation = self.community.network.fork_window(self.community.members_pubkeys()) + 1
 
-            if current_validations < max_validation:
+            # Current validation can be negative if self.community.network.latest_block_number
+            # is not refreshed yet
+            if max_validation > current_validations > 0:
                 if self.app.preferences['expert_mode']:
                     arc['validation_text'] = "{0}/{1}".format(current_validations,
                                                               max_validation)
@@ -254,7 +256,7 @@ class Graph(object):
                 current_validations = 0
             max_validations = self.community.network.fork_window(self.community.members_pubkeys()) + 1
 
-            if current_validations < max_validations:
+            if max_validations > current_validations > 0:
                 if self.app.preferences['expert_mode']:
                     arc['validation_text'] = "{0}/{1}".format(current_validations,
                                                               max_validations)
-- 
GitLab