Skip to content

Commit

Permalink
Move lib to vocho-lib, show disqualified candidates in ranked pairs, …
Browse files Browse the repository at this point in the history
…bump version
  • Loading branch information
miestasmia committed Jun 6, 2019
1 parent 0718e56 commit 4b4a59f
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 745 deletions.
27 changes: 0 additions & 27 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ if [ ! -d "node/node-v$VERSION-linux-x64" ]; then
wget -qO- "https://nodejs.org/dist/v$VERSION/node-v$VERSION-linux-x64.tar.xz" | tar -xJf - -C node
fi

# Darwin x64
if [ ! -d "node/node-v$VERSION-darwin-x64" ]; then
echo Downloading node darwin-x64 ...
wget -qO- "https://nodejs.org/dist/v$VERSION/node-v$VERSION-darwin-x64.tar.gz" | tar -xzf - -C node
fi



# Build zip files
Expand All @@ -40,24 +34,3 @@ echo Tarballing linux-x64 ...
tar -cJf ../linux-x64.tar.xz *
echo Cleaning up from linux-x64
cd .. && rm -rf linux-x64

# Darwin x64
echo Creating darwin-x64 files ...
mkdir -p darwin-x64 && cd $_
cp -r "../node/node-v$VERSION-darwin-x64" node
rsync -a ../../ vocho --exclude dist --exclude .git --exclude node_modules
cat >run.sh <<EOL
#!/usr/bin/env bash
cd \`dirname \$0\`
cd vocho
if [ ! -d node_modules ]; then
../node/bin/node ../node/bin/npm i
fi
../node/bin/node src/index.js
EOL
chmod +x run.sh

echo Tarballing darwin-x64 ...
tar -cJf ../darwin-x64.tar.xz *
echo Cleaning up from darwin-x64
cd .. && rm -rf darwin-x64
8 changes: 6 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vocho",
"version": "1.1.1",
"name": "vocho-term",
"version": "1.2.0",
"description": "",
"main": "src/index.js",
"scripts": {
Expand All @@ -9,7 +9,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/tejoesperanto/vocho.git"
"url": "git+https://github.com/tejoesperanto/vocho-term.git"
},
"author": "Mia Nordentoft",
"license": "MIT",
Expand All @@ -18,6 +18,7 @@
},
"dependencies": {
"blessed": "git+https://github.com/CreativeCactus/blessed.git",
"editor-widget": "^1.1.1"
"editor-widget": "^1.1.1",
"vocho-lib": "git+https://github.com/tejoesperanto/vocho-lib.git"
}
}
11 changes: 7 additions & 4 deletions src/calc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const lib = require('./lib');
const lib = require('vocho-lib');

const commaSeparatedRegex = /[^\s,]/g;

Expand Down Expand Up @@ -27,10 +27,13 @@ module.exports = function performElection (electionType, candidatesStr, ballotsS
if (electionType === 'RP') {
const results = lib.RankedPairs([...candidates], ballots, ignoredCandidates, tieBreaker);

const resultsStr =
`${results.ballots} balotiloj (${results.blankBallots} blanka(j))
Venkinto: ${results.winner}`;
let resultsStr = `${results.ballots} balotiloj (${results.blankBallots} blanka(j))\n`;
if (results.disqualifiedCandidates.length) {
resultsStr += `Neelektitaj laŭ §2.6: ${results.disqualifiedCandidates.join(', ')}\n`;
}
resultsStr += `Venkinto: ${results.winner}`;
return resultsStr;

} else if (electionType === 'STV') {
const results = lib.STV(places, [...candidates], ballots, ignoredCandidates, tieBreaker);

Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const titleBox = blessed.box({
left: 2,
height: 11,
content: banner + '\n\n' +
' '.repeat(5) + 'Versio ' + require('../package.json').version + '\n' +
' '.repeat(5) + 'Versio T-' + require('../package.json').version + '\n' +
' '.repeat(5) + '© Mia Nordentoft 2019, MIT-permesilo'
});

Expand Down Expand Up @@ -113,6 +113,7 @@ screen.key('escape', () => {
});
screen.key('C-x', () => process.exit(0));
screen.key('f12', () => {
screen.program.hideCursor();
helpScreen.toggle();
screen.render();
});
Expand Down
4 changes: 0 additions & 4 deletions src/lib/index.js

This file was deleted.

Loading

0 comments on commit 4b4a59f

Please sign in to comment.