Code Monkey home page Code Monkey logo

rcv's Introduction

RCV - Ranked Choice Voting

This Ranked Choice Voting app is free to use, free to improve, and free to share with the general public!

Here are a few advantages to RCV:

  • Better representation
  • No “Settling”
  • No wasted votes
  • Vote by preference
  • Great for multi-seat elections
  • Easy to use

For a short, 1-minute explanation of RCV; check out this video: https://youtu.be/oHRPMJmzBBw

RCV video

Ranked Choice voting is about representing the people in the best way possible. The key is allowing the voter to choose more than just their favorite candidate. The problem with only voting for one choice, is that if that choice does not come in first or second, it could be considered a “wasted vote.” Therefore, people are more likely to vote for their second or third choice on the idea that it has a higher chance of winning and it’s better than their last choice.

With Ranked Choice Voting, there is no issue with voting for your first choice first, second choice second, and third choice third. Because if your first choice doesn’t win, then your vote automatically gets transferred to your second choice! And that is the beauty of the system.

Another thing it works really well for voting for more than one position. Everyone’s vote is still counted as one vote, but if their first choice is elected, then a portion of their vote goes to second place. To better illustrate this point, there is a video that describes the use of ranked choice voting in the Animal Kingdom:

Click here to watch https://youtu.be/l8XOZJkozfI

STV animal video

Consuming

This project is designed to create the files necessary to run the site from a PHP server with MySQL database (e.g. LAMP). The database can be externally located without any issue. Make sure you specify the location of the database in the src/api/config.php file.

The project uses Nodejs and Grunt to build a dist/ folder whose contents will be copied into the root http folder of the server. If you don't have PHP or MySQL installed, please review https://github.com/DavidMoritz/rcv/blob/master/UBUNTU.md.

The following steps assume that you have PHP, MySQL, Nodejs and Grunt-cli installed and cwd is the project root:

  1. run npm install
  2. create "src/api/config.php" from "src/api/config_sample.php"
  3. input your credentials to the MySQL database in "src/api/config.php"
  4. use "Schema.sql" to build the MySQL database
  5. run grunt (if you don't have MySQL installed, run grunt nomysql)
  6. run cd dist/
  7. run php -S localhost:1337
  8. go to "localhost:1337" in your browser

Let me know if you have any issues!

After years of editing the dist folder on the live site, this repo became very far removed from the end product. Look at the public_html folder to see what is currently in production. If someone would like to convert the current site back into source code, I would welcome a pull request.

Good luck!

Docker Compose Consumption

The provided docker file is meant for development / getting up and running quickly.

  1. create "src/api/config.php" from "src/api/config_sample.php" (make sure the MySQL location is "db" instead of "localhost") An example that should work with the default docker-compose file as written;
<?php
####	Rename this file to "config.php" after putting in your credentials	#####

define('SERVER', 'db:3306');
define('USERNAME', 'root');
define('PASSWORD', 'superSecretPassword');
define('DB', 'rcv_db');

####	CONNECT TO THE DATABASE		######
try {
	$dbh = new PDO('mysql:host=' . SERVER . ';dbname=' . DB, USERNAME, PASSWORD, array(PDO::ATTR_PERSISTENT => true));
} catch (PDOException $e) {
	die($e->getMessage());
}

?>
  1. Install docker and docker-compose; Follow these instructions per your OS
  2. If you have docker compose installed cd to the project root and run docker-compose up
  3. go to "localhost:1337" in your browser
  4. profit

Contributing

If you are interested in joining the cause and contributing, I am very appreciative! One area that I would like focused efforts on is the ability for someone to register and manage their different ballots. There was work toward this efforts, but not finished. Please contact me before putting in significant effort to avoid duplicate work. Thanks!

rcv's People

Contributors

davidmoritz avatar kirkhansen avatar moondit avatar payne avatar techcampteacher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcv's Issues

Installation / Usage

Sorry if this is a stupid question, but can you tell me how to use the RCV repository on an actual web server?

I am running apache2 with php7 (can install php5 if needed).

Typo in weighted tie-break method description

On https://rankedchoices.com/create there is the following radio button label:

Tie-Break Method:
( ) Random (official) (🔘) Weighted (factor-in subsequant choices)

That second label should read:

Weighted (factor in subsequent choices)

I went to submit a pull request but the code in the repo:

.form-group
label Tie-Break Method:
div
label.radio-inline(title="Randomly determine the order of candidates being eliminated")
input(type="radio" value="random" name="tie-break-method" ng-model="ballot.tieBreak")
| Random (official)
label.radio-inline(title="Observe the preference of secondary choices to determine")
input(type="radio" value="weighted" name="tie-break-method" ng-model="ballot.tieBreak")
| Weighted
label.radio-inline(title="All candidates in a tie are simultaneously eliminated")
input(type="radio" value="none" name="tie-break-method" ng-model="ballot.tieBreak")
| No Winner

doesn't contain this string, nor does it appear in the Git history, so I guess that the code running on https://rankedchoices.com/ has a diff to this repo.

Invalid tie-breaking methodology

The tie-breaking methodology is not a valid approach for single transferable vote, as it violates the principle that a later preference should not be able to disadvantage an earlier preference.

Non-random order?

First off, this site is AWESOME. I used another version that sucked and this is MUCH better.

It would be nice to make shuffling the order of the items a toggle. We have a separate list that includes a lot of details on each option and it's harder to cross-reference if they don't start off in the same order.

docker image "Create new ballot" problem

Following instructions for docker-compose, it built after changing "nodejs-npm to "npm" in Dockerfile-web-app. However, opening the "Create a new ballot" page results in a constant stream of messages on the console:

web-app_1 | [Mon Nov 1 16:38:00 2021] 172.20.0.1:39060 [200]: GET /api/get-key-ballot.php?key=w7nc1ty8xq
web-app_1 | [Mon Nov 1 16:38:00 2021] 172.20.0.1:39060 Closing
web-app_1 | [Mon Nov 1 16:38:00 2021] 172.20.0.1:39064 Accepted

these are repeated but the key keeps changing. You are unable to create a new shortcode on the new ballot page and if you try to enter a shortcode it says "xxx is already in use"

The problem may be due to unclear instructions for modifying config.php. I've tried several variations, but none of them work. It would be useful if the exact values for 'SERVER' and 'DB' were specified in the instructions or better still, provide a config.php that works under Docker.

Using Docker Desktop 4.1.1 on Windows 10 with the WSL 2 backend.

Time zone conversion

Symptom: (with Firefox 72.0.1 on Kubuntu 19.10)
Set voting cutoff time to 5 pm EST. Voting did close at 5 pm, but results weren't published. The author replied to the email support request that in his DB the closing time shows up as 11 pm. Perhaps there's an issue with UTC time offset? (lines 35 to 45 in main.js indicates that the program runs with the time zone fixed to CST/CDT)

Updating ballot choices is not reflected in UI

I'm creating a ballot with multiple entries (on https://rankedchoices.com/), and after editing the entries list, I cannot see the updated list of entries. I'm very excited about this tool and am hoping this is something easy to fix! This is important because I need to update the candidate list before the final election, and not seeing an up to date list makes this impossible.

How to replicate:

  1. Login
  2. Create a new ballot (I used default values except for three positions to be elected)
  3. Add five candidates.
  4. Click submit all entries.
  5. Click Profile in top nav bar.
  6. Click edit ballot link next to new ballot
  7. Click entries radio button
  8. See the five candidates that were previous edited
  9. Remove two candidates and replace them with two new, different ones
  10. Click submit all entries once more
  11. Click profile in top nav bar.
  12. Click edit ballot link next to the new ballot
  13. Click entries radio button

At this point, I see the original list of candidates, not the new list that I saved in step 10.

Please let me know if there is something else that I should be doing to see the updated list of entries in the entry list.

rankedchoices.com Down

Hey, rankedchoices.com seems to be having some DNS problems. As of 2019-11-15, the site seems to redirect to a site that is definitely not rankedchoices.com while briefly flashing an error saying that the domain may be for sale.

Specifically tagging @DavidMoritz

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.