Giter Site home page Giter Site logo

vote.rs's Introduction

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;

vote.rs's People

Contributors

jonhoo avatar kyrias avatar prismaphonic avatar

Watchers

Dominic Prass avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.