in pysteve/lib/backends/es.py [0:0]
def vote(self,electionID, issueID, uid, vote, vhash = None):
"Casts a vote on an issue"
eid = hashlib.sha224(electionID + ":" + issueID + ":" + uid).hexdigest()
now = time.time()
if vhash:
eid = vhash
self.DB.ES.index(index=self.index, doc_type="votes", id=eid, body =
{
'issue': issueID,
'election': electionID,
'key': uid,
'data': {
'timestamp': now,
'vote': vote
}
}
);
# Backlog of changesets
self.DB.ES.index(index=self.index, doc_type="vote_history", body =
{
'issue': issueID,
'election': electionID,
'key': uid,
'data': {
'timestamp': now,
'vote': vote
}
}
);