Simple website for doing multi-round ranked choice voting
Switch branches/tags
Nothing to show
Clone or download
Latest commit f387cbd Nov 21, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
db It works! Nov 16, 2018
src Support HEAD / Nov 16, 2018
templates Less fancy redirect Nov 21, 2018
.gitignore It works! Nov 16, 2018
Cargo.toml License Nov 16, 2018
LICENSE-APACHE License Nov 16, 2018
LICENSE-MIT License Nov 16, 2018 Add README Nov 16, 2018
Rocket.toml Less logging Nov 16, 2018
schema.sql It works! Nov 16, 2018

This crate uses ranked choice voting to allow users to vote on the next Rust live-coding stream. It is not specific to this particular voting topic beyond some labels here and there though.

The basic idea is that users rank the candidates (stream ideas) according to which they would rather watch, and an election is run before each stream to determine the topic of the stream. Since ranked choice voting lets users specify multiple preferences, this process can then be repeated for the next stream, where it will go to each user's second preferred candidate, etc.

This implementation is not written to be secure or efficient. Quite to the contrary. Users identify with a self-chosen username, and all that is required to change their ballot in the future (e.g., to add votes for new stream ideas) is that same username. This means that any user can change any other user's ballot simply by giving their username. So don't use this for anything serious.

To deploy, run:

$ sqlite3 db/db.sqlite < schema.sql
$ cargo run --release

The web interface will now be available on port 8000.

To add new candidates for voting, use sqlite3 db/db.sqlite and issue insert statements of the following form:

INSERT INTO items (title, body) VALUES ("My Great Idea", "Here's why it's great");

To mark a candidate as no longer available (e.g., because a stream has already been produced for it), just mark it as done with:

UPDATE items SET done = true WHERE id = ?;

Where ? is the ID of the candidate, which you can find with

SELECT id, title FROM items WHERE done = false;