> On Mar 22, 2015, at 9:45 PM, Alan D. Cabrera <l...@toolazydogs.com> wrote:
> 
> 
>> On Mar 22, 2015, at 2:48 PM, humbed...@apache.org wrote:
>> 
>> Author: humbedooh
>> Date: Sun Mar 22 21:48:53 2015
>> New Revision: 1668487
>> 
>> URL: http://svn.apache.org/r1668487
>> Log:
>> first stab at an STV calculator. This may be filled with errors, what do I 
>> know :)
>> 
>> Modified:
>>   steve/trunk/pysteve/www/cgi-bin/lib/election.py
>> 
>> Modified: steve/trunk/pysteve/www/cgi-bin/lib/election.py
>> URL: 
>> http://svn.apache.org/viewvc/steve/trunk/pysteve/www/cgi-bin/lib/election.py?rev=1668487&r1=1668486&r2=1668487&view=diff
>> ==============================================================================
>> --- steve/trunk/pysteve/www/cgi-bin/lib/election.py (original)
>> +++ steve/trunk/pysteve/www/cgi-bin/lib/election.py Sun Mar 22 21:48:53 2015
>> @@ -32,6 +32,16 @@ def getIssue(electionID, issueID):
>>        issuedata['APIURL'] = "https://%s/steve/voter/view/%s/%s"; % 
>> (config.get("general", "rooturl"), electionID, issueID)
>>        issuedata['prettyURL'] = "https://%s/steve/ballot?%s/%s"; % 
>> (config.get("general", "rooturl"), electionID, issueID)
>>    return issuedata
>> +
>> +def getVotes(electionID, issueID):
>> +    issuepath = os.path.join(homedir, "issues", electionID, issueID) + 
>> ".json.votes"
>> +    issuedata = {}
>> +    if os.path.isfile(issuepath):
>> +        with open(issuepath, "r") as f:
>> +            data = f.read()
>> +            f.close()
>> +            issuedata = json.loads(data)
>> +    return issuedata
>> 
>> def listIssues(election):
>>    issues = []
>> @@ -80,4 +90,110 @@ def deleteIssue(electionID, issueID):
>>            os.unlink(issuepath + ".votes")
>>        return True
>>    else:
>> -        raise Exception("No such election")
>> \ No newline at end of file
>> +        raise Exception("No such election")
>> +    
>> +    
>> +debug = []
>> +
>> +def getproportion(votes, winners, step, surplus):
>> +            
>> +    # If this isn't the initial 1st place tally, do the proportional math:
>> +    # surplus votes / votes with an Nth preference * number of votes in 
>> that preference for the candidate
>> +    if step > 0:
>> +        for c in prop:
>> +            prop[c] = surplus / tvotes * prop[c]
>> +        
>> +    debug.append("Proportional move: %s" % json.dumps(prop))
>> +    return prop
> 
> Why wouldn’t we log these messages?

Ping.


Regards,
Alan


Reply via email to