Skip to content

irenenovo/D-Hondt-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D-Hondt-Calculator

JavaScript library that allows using the D'Hondt method.

Installation

bower install D-Hondt-Calculator

Data structure

For example:

var voting = {
	whiteVotes: 200,
	seats: 5,
	strip: 5,
	votes: [{name: "PP", votes: 300} {name: "PSOE", votes: 300} ]
}

Usage

Create/Get the voting:

dhondt.voting(whiteVotes, seats, strip, votes);
var voting = dhondt.getVoting();

Check if is the number of votes is valid

var isValid = dhondt.checkVotes(votes);

Get/Delete votes

var vote = dhondt.getVote(index);
dhondt.deleteVote(index);

Returns a JSON with the results of the strips per political party

var results = dhondt.getSeatVotes();

Returns an HTML with the results of the strips per political party

var htmlResult = dhondt.getSeatVotesHTML(results);

![alt tag] (https://travis-ci.org/irenenovo/D-Hondt-Calculator.svg)

About

Calculadora de D'Hondt en JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published