diff --git a/exec/load/consensus_vote.js b/exec/load/consensus_vote.js index 0b226e14e2cc8a2a2b2078d700fc77fbd26fcfc3..41c225efa65a08f23e55d9393ede993248d6dacd 100644 --- a/exec/load/consensus_vote.js +++ b/exec/load/consensus_vote.js @@ -72,6 +72,19 @@ function ConcensusObject(host, port, scope) newissue.answers=this.answers; this.db.write(this.scope, 'issues.'+this.index, newissue, LOCK_WRITE); } + issue.havevoted=function() + { + var i,j; + + for(i in this.answers) { + for(j in this.answers[i].votes) { + if(this.answers[i].votes[k]==user.alias) + return true; + } + } + } + return false; + } } this.get_all_issues=function() @@ -141,19 +154,11 @@ function ConcensusObject(host, port, scope) this.get_pending_issues=function() { var all=this.get_open_issues(); - var i,j,k; - var matched; + var i; var ret=[]; for(i in all) { - matched=0; - for(j in all[i].answers) { - for(k in all[i].answers[j].votes) { - if(all[i].answers[j].votes[k]==user.alias) - matched++; - } - } - if(!matched) + if(!all[i].havevoted()) ret.push(all[i]); } return ret;