From b3ea54400148ba8183895cc0f89d14d9e20245e6 Mon Sep 17 00:00:00 2001
From: Marcin Ickiewicz <mickiewicz@syncad.com>
Date: Thu, 13 Aug 2020 14:09:44 +0200
Subject: [PATCH] issue#37: correct pending payouts values in condenser api
 methods

---
 hive/server/condenser_api/methods.py | 1 +
 hive/server/condenser_api/objects.py | 3 ++-
 tests/tests_api                      | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hive/server/condenser_api/methods.py b/hive/server/condenser_api/methods.py
index 151cf7576..aa2ddddc0 100644
--- a/hive/server/condenser_api/methods.py
+++ b/hive/server/condenser_api/methods.py
@@ -34,6 +34,7 @@ SQL_TEMPLATE = """
         hp.promoted,
         hp.payout,
         hp.payout_at,
+        hp.pending_payout,
         hp.is_paidout,
         hp.children,
         hp.votes,
diff --git a/hive/server/condenser_api/objects.py b/hive/server/condenser_api/objects.py
index 2e7f6b108..aa463c3a5 100644
--- a/hive/server/condenser_api/objects.py
+++ b/hive/server/condenser_api/objects.py
@@ -181,6 +181,7 @@ def _condenser_post_object(row, truncate_body=0):
     if not row['category']:
         row['category'] = 'undefined'
 
+    full_payout = row['pending_payout'] + row['payout'];
     post = {}
     post['post_id'] = row['id']
     post['author'] = row['author']
@@ -201,7 +202,7 @@ def _condenser_post_object(row, truncate_body=0):
     post['cashout_time'] = json_date(None if paid else row['payout_at'])
     post['total_payout_value'] = _amount(row['payout'] if paid else 0)
     post['curator_payout_value'] = _amount(0)
-    post['pending_payout_value'] = _amount(row['pending_payout'])
+    post['pending_payout_value'] = _amount(0 if paid else full_payout)
     post['promoted'] = _amount(row['promoted'])
 
     post['replies'] = []
diff --git a/tests/tests_api b/tests/tests_api
index a88d42a79..ee20b992b 160000
--- a/tests/tests_api
+++ b/tests/tests_api
@@ -1 +1 @@
-Subproject commit a88d42a79b9f006466d7a15650ccdc68f56004ea
+Subproject commit ee20b992bb7dae36ea964bde1e3b7f58b103dae6
-- 
GitLab