From 685a9512dcc5adcee9049cfe81c4568d199e09e3 Mon Sep 17 00:00:00 2001 From: Mariusz <mtrela@syncad.com> Date: Mon, 7 Sep 2020 13:32:05 +0200 Subject: [PATCH] A conversion a long integer into a string - fixed --- hive/server/database_api/methods.py | 6 +++--- hive/utils/normalize.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hive/server/database_api/methods.py b/hive/server/database_api/methods.py index 28f521881..9b117f0ce 100644 --- a/hive/server/database_api/methods.py +++ b/hive/server/database_api/methods.py @@ -172,13 +172,13 @@ def result_presentation(rows, votes_presentation): for row in rows: if votes_presentation == VotesPresentation.DatabaseApi: ret.append(dict(voter=row.voter, author=row.author, permlink=row.permlink, - weight=row.weight, rshares=row.rshares, vote_percent=row.percent, + weight=number_to_json_value(row.weight), rshares=number_to_json_value(row.rshares), vote_percent=row.percent, last_update=str(row.time), num_changes=row.num_changes)) elif votes_presentation == VotesPresentation.CondenserApi: ret.append(dict(percent=str(row.percent), reputation=rep_to_raw(row.reputation), - rshares=str(row.rshares), voter=row.voter)) + rshares=number_to_json_value(row.rshares), voter=row.voter)) elif votes_presentation == VotesPresentation.BridgeApi: - ret.append(dict(rshares=str(row.rshares), voter=row.voter)) + ret.append(dict(rshares=number_to_json_value(row.rshares), voter=row.voter)) else: ret.append(dict(percent=row.percent, reputation=rep_to_raw(row.reputation), rshares=number_to_json_value(row.rshares), time=time_string_with_t(row.time), diff --git a/hive/utils/normalize.py b/hive/utils/normalize.py index 0fe4f5d13..b36af67b7 100644 --- a/hive/utils/normalize.py +++ b/hive/utils/normalize.py @@ -285,7 +285,7 @@ def number_to_json_value(number): """ if number > 0xFFFFFFFF: return str(number) - return number + return int(number) def time_string_with_t(time_iso8601): """ Ensures that time in format ISO8601 use 'T' as a data time separator -- GitLab