simplify query

This commit is contained in:
ryan 2016-07-18 15:07:10 +02:00
parent 553148c5e4
commit 429d299b23

View File

@ -577,9 +577,8 @@ class Bigchain(object):
# get the latest value for the vote timestamp (over all votes)
max_timestamp = r.table('votes') \
.filter(r.row['node_pubkey'] == self.me) \
.concat_map(lambda x: [x['vote']['timestamp']]) \
.max() \
.run(self.conn)
.max(lambda x: x['vote']['timestamp']) \
.run(self.conn)['vote']['timestamp']
last_voted = list(r.table('votes') \
.filter(r.row['node_pubkey'] == self.me) \