Maemo.org team/Generating election results
(How to generate election results after an election, step by step.) |
(sort of obsolete) |
||
(4 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
+ | '''OBSOLETE''' see http://wiki.maemo.org/Maemo.org_team/Creating_an_election | ||
- | Instructions for generating election results once an election is completed. | + | Instructions for generating election results once an election is completed. In this example, the election ID is 8. |
# Go to http://maemo.org/vote/ | # Go to http://maemo.org/vote/ | ||
# Click on election link - get to http://maemo.org/vote/results.php?election_id=8 | # Click on election link - get to http://maemo.org/vote/results.php?election_id=8 | ||
- | # Click on | + | # Click on [http://maemo.org/vote/votes.php?election_id=8 "List of all votes"] |
- | # Click on | + | # Click on [http://maemo.org/vote/blt.php?election_id=8 "Download the ballots"] |
# Browser proposes open or save - save the file (election.blt) | # Browser proposes open or save - save the file (election.blt) | ||
- | # Launch OpenSTV | + | # Launch [http://www.openstv.org/ OpenSTV] (version 1.5 is latest as of writing) |
# File->New election | # File->New election | ||
- | # Load election.blt file - Method: Fractional transfer STV | + | # Load election.blt file - Method: Fractional transfer STV (for the character survey, I chose the Borda method, because fractional transfer didn't make any sense) |
# Election options: Seat number = number of desired elected candidates (1 for referendum, 5 for council, etc); Threshold = Droop, Static, Whole; Delay surplus transfer = Off; Batch elimination = Zero; click OK | # Election options: Seat number = number of desired elected candidates (1 for referendum, 5 for council, etc); Threshold = Droop, Static, Whole; Delay surplus transfer = Off; Batch elimination = Zero; click OK | ||
# Election results generated - you can see the winners & count details. To generate HTML version: Results->Save results as HTML - save file election_results.html | # Election results generated - you can see the winners & count details. To generate HTML version: Results->Save results as HTML - save file election_results.html | ||
# Edit HTML file to take care of MySQL formating (escape quotes, backslashes, etc) and remove HTML headers - manual process | # Edit HTML file to take care of MySQL formating (escape quotes, backslashes, etc) and remove HTML headers - manual process | ||
#* remove <html> and <head>, | #* remove <html> and <head>, | ||
- | #* change <body> into <div> | + | #* change <body> into <nowiki><div></nowiki> |
#* sed/\'center\'/\"center\"/g | #* sed/\'center\'/\"center\"/g | ||
#* Ensure HTML attributes are quoted (colspan, rowspan, border, cellspacing) | #* Ensure HTML attributes are quoted (colspan, rowspan, border, cellspacing) | ||
#* Massage output as necessary (removing "symbols are elected" for characters survey, replacing characters with HTML entities, etc) | #* Massage output as necessary (removing "symbols are elected" for characters survey, replacing characters with HTML entities, etc) | ||
- | # Insert results in non-production database to test: | + | # Insert results in non-production database to test (ensure that the file is world readable & the directory hierarchy is world executable, and that the DB user has the FILE privilege): |
#: mysql -uelection -p election | #: mysql -uelection -p election | ||
- | #: $ insert into election_results values (8 <the election_id on the results URL above>, ' | + | #: $ insert into election_results values (8 <the election_id on the results URL above>, LOAD_FILE('/path/to/html/file'); |
# Check that results display correctly, and massage results field if needed. | # Check that results display correctly, and massage results field if needed. | ||
# Dump insert from non-prod DB to send for insertion in prod DB (as an SQL statement, to make it as easy as possible - ensures quoting & character escaping is done correctly): | # Dump insert from non-prod DB to send for insertion in prod DB (as an SQL statement, to make it as easy as possible - ensures quoting & character escaping is done correctly): |
Latest revision as of 23:52, 6 September 2015
OBSOLETE see http://wiki.maemo.org/Maemo.org_team/Creating_an_election
Instructions for generating election results once an election is completed. In this example, the election ID is 8.
- Go to http://maemo.org/vote/
- Click on election link - get to http://maemo.org/vote/results.php?election_id=8
- Click on "List of all votes"
- Click on "Download the ballots"
- Browser proposes open or save - save the file (election.blt)
- Launch OpenSTV (version 1.5 is latest as of writing)
- File->New election
- Load election.blt file - Method: Fractional transfer STV (for the character survey, I chose the Borda method, because fractional transfer didn't make any sense)
- Election options: Seat number = number of desired elected candidates (1 for referendum, 5 for council, etc); Threshold = Droop, Static, Whole; Delay surplus transfer = Off; Batch elimination = Zero; click OK
- Election results generated - you can see the winners & count details. To generate HTML version: Results->Save results as HTML - save file election_results.html
- Edit HTML file to take care of MySQL formating (escape quotes, backslashes, etc) and remove HTML headers - manual process
- remove <html> and <head>,
- change <body> into <div>
- sed/\'center\'/\"center\"/g
- Ensure HTML attributes are quoted (colspan, rowspan, border, cellspacing)
- Massage output as necessary (removing "symbols are elected" for characters survey, replacing characters with HTML entities, etc)
- Insert results in non-production database to test (ensure that the file is world readable & the directory hierarchy is world executable, and that the DB user has the FILE privilege):
- mysql -uelection -p election
- $ insert into election_results values (8 <the election_id on the results URL above>, LOAD_FILE('/path/to/html/file');
- Check that results display correctly, and massage results field if needed.
- Dump insert from non-prod DB to send for insertion in prod DB (as an SQL statement, to make it as easy as possible - ensures quoting & character escaping is done correctly):
- mysqldump -uelection -p -t -w 'election_results.election_id=8' election election_results > results.sql
- On production database, mysql -u<db user> -p < results.sql
- This page was last modified on 6 September 2015, at 23:52.
- This page has been accessed 9,347 times.