Skip to content
Snippets Groups Projects
Commit bf9dc8f6 authored by Andrzej Lisak's avatar Andrzej Lisak
Browse files

[ABW]: used OrderedDict for votes to stabilize order

parent 76d51a4c
No related branches found
No related tags found
3 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!137find_votes and list_votes fixes
This commit is part of merge request !137. Comments created here will be created in the context of that merge request.
""" Votes indexing and processing """
import logging
import collections
from hive.db.db_state import DbState
from hive.db.adapter import Db
......@@ -10,7 +11,7 @@ log = logging.getLogger(__name__)
class Votes(DbAdapterHolder):
""" Class for managing posts votes """
_votes_data = {}
_votes_data = collections.OrderedDict()
inside_flush = False
......@@ -50,10 +51,10 @@ class Votes(DbAdapterHolder):
key = "{}/{}/{}".format(vop['voter'], vop['author'], vop['permlink'])
if key in cls._votes_data:
cls._votes_data[key]["weight"] = vop["weight"]
cls._votes_data[key]["rshares"] = vop["rshares"]
cls._votes_data[key]["is_effective"] = True
cls._votes_data[key]["block_num"] = vop['block_num']
cls._votes_data[key]["weight"] = vop["weight"]
cls._votes_data[key]["rshares"] = vop["rshares"]
cls._votes_data[key]["is_effective"] = True
cls._votes_data[key]["block_num"] = vop['block_num']
else:
cls._votes_data[key] = dict(voter=vop['voter'],
author=vop['author'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment