From eadb1a89c9cb856c249ace53447f5de6ee788578 Mon Sep 17 00:00:00 2001
From: mtrela <mtrela@syncad.com>
Date: Tue, 4 Aug 2020 16:37:07 +0200
Subject: [PATCH] Payments are set to default values when `is_paidout==true`

---
 hive/indexer/posts.py | 18 ++++++++++++++----
 tests/tests_api       |  2 +-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/hive/indexer/posts.py b/hive/indexer/posts.py
index 549492200..10b1da8dd 100644
--- a/hive/indexer/posts.py
+++ b/hive/indexer/posts.py
@@ -234,11 +234,11 @@ class Posts:
             author_rewards_vests      = None
 
             # total payout for comment
-            comment_author_reward     = None
+            #comment_author_reward     = None
             curators_vesting_payout   = None
             total_payout_value        = None;
             curator_payout_value      = None;
-            beneficiary_payout_value  = None;
+            #beneficiary_payout_value  = None;
 
             payout                    = None
             pending_payout            = None
@@ -263,11 +263,11 @@ class Posts:
 
             if v[ 'comment_reward_operation' ] is not None:
               value = v[ 'comment_reward_operation' ]
-              comment_author_reward     = value['payout']
+              #comment_author_reward     = value['payout']
               author_rewards            = value['author_rewards']
               total_payout_value        = value['total_payout_value']
               curator_payout_value      = value['curator_payout_value']
-              beneficiary_payout_value  = value['beneficiary_payout_value']
+              #beneficiary_payout_value  = value['beneficiary_payout_value']
 
               payout = sum([ sbd_amount(total_payout_value), sbd_amount(curator_payout_value) ])
               pending_payout = 0
@@ -286,6 +286,16 @@ class Posts:
             if v[ 'comment_payout_update_operation' ] is not None:
               value = v[ 'comment_payout_update_operation' ]
               is_paidout                = True
+
+              #Payout didn't generate any payments
+              if v[ 'comment_reward_operation' ] is None:
+                author_rewards            = 0
+                total_payout_value        = "0.000 HBD"
+                curator_payout_value      = "0.000 HBD"
+
+                payout = 0
+                pending_payout = 0
+
               if author is None:
                 author                    = value['author']
                 permlink                  = value['permlink']
diff --git a/tests/tests_api b/tests/tests_api
index 3cf1e0cdf..ac5cf0258 160000
--- a/tests/tests_api
+++ b/tests/tests_api
@@ -1 +1 @@
-Subproject commit 3cf1e0cdfc34430c2a6919ae0539f2fcd7a0f50f
+Subproject commit ac5cf02580aa7500f9b192cf1b7cb498245c3080
-- 
GitLab