Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop -> master #412

Merged
merged 101 commits into from
Feb 9, 2021
Merged
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
1a38123
Add initial implementation for the STV algorithm
SmithPeder Nov 25, 2020
0843db0
Use Object.create() to avoid mutations
SmithPeder Dec 10, 2020
0b198ea
Object.create() was stupid, use Stringify->Parse
SmithPeder Dec 11, 2020
f149112
Clean input and out better
SmithPeder Dec 11, 2020
949f6d0
Implement backward checking for eliminations ties
SmithPeder Dec 11, 2020
a2fdb97
Eliminate a random candidate if they have 0 or 1 in score
SmithPeder Dec 12, 2020
6f47eb7
minScore of 1 was not the best idea, as backtracking might break the tie
SmithPeder Dec 12, 2020
af7a6fe
Remove minScore logic, and always eliminate ties
SmithPeder Dec 12, 2020
cdcbbf3
Don't decrement iterations before current is checked
SmithPeder Dec 12, 2020
fd5d3fd
Add sests and voteCount to output. Use iterationMin in log
SmithPeder Dec 14, 2020
5660ed3
Use inputVote length when returning result
SmithPeder Dec 14, 2020
0b7df38
Implement useStrict for STV elections, forces 67%
SmithPeder Dec 15, 2020
de67f45
Apply suggestions from code review
SmithPeder Dec 17, 2020
a372697
Add original .ts file for stv
SmithPeder Jan 12, 2021
8491ff8
Update model schemas, and move addVote method to election
SmithPeder Nov 28, 2020
3c2785f
Rename sumVotes to elect for election api
SmithPeder Nov 28, 2020
f375460
Rewrite create and retrive methods for votes
SmithPeder Nov 28, 2020
ec536d0
New error types
SmithPeder Nov 28, 2020
d8cb492
Emit websocket on election deactivation
SmithPeder Nov 28, 2020
b973f45
Add and rewrite election and vote tests
SmithPeder Nov 28, 2020
f2f0355
Move lock to API call to fix race condition
SmithPeder Dec 10, 2020
de19319
Remove chai subset from sum test
SmithPeder Dec 10, 2020
50d5f8f
Allow timeout to be 5 sec for CLI tests
SmithPeder Dec 10, 2020
8a7af15
Remove extra hasVoted schema, and use User directly
SmithPeder Dec 12, 2020
0fed94d
Implement useStrict in Election models/controller, and add tests
SmithPeder Dec 15, 2020
3ac3e78
Small test improvements
SmithPeder Dec 15, 2020
0737133
Admin UI for setting amount of seats
LudvigHz Nov 17, 2020
d599f02
Add checkbox to enable `election.useStrict` for create view
LudvigHz Jan 12, 2021
ce166e0
Add the chai-subset to resolve deep trees
SmithPeder Nov 28, 2020
7aa132f
Add dataset converter, datasets and tests for the STV algorithm
SmithPeder Nov 28, 2020
0d22362
Write assertions for dataset 5 and 6
SmithPeder Dec 11, 2020
6459546
Change dataset 6 tests to reflect backward tracking in the STV algorithm
SmithPeder Dec 11, 2020
fa8e298
Eliminate G and H at random order
SmithPeder Dec 12, 2020
d394192
Double eliminations on tie
SmithPeder Dec 12, 2020
4ab44f6
Use MULTI_TIE_ELIMINATIONS
SmithPeder Dec 12, 2020
c34d41c
Fix tests
SmithPeder Dec 14, 2020
c101cb5
Add OpaVote testcase and dataset
SmithPeder Dec 14, 2020
ae2e303
Implement STV tests with useStrict
SmithPeder Dec 15, 2020
46c3845
OpaVote needs 30000ms to run on CI
SmithPeder Dec 15, 2020
9dd16ba
Split STV tests intp multiple files to make editors less laggy
SmithPeder Dec 15, 2020
ad9d5bd
Inital implementation of priority selection
LudvigHz Dec 12, 2020
962f45b
Add styling and iron out the UX for user voting
LudvigHz Dec 13, 2020
ee7d352
Add blank alternative, some styling and confirm page
LudvigHz Dec 14, 2020
748e3d7
Remove border to match buttons & small style tweaks
LudvigHz Dec 15, 2020
4844789
Replace p em with single i tag & update function docstrings
LudvigHz Dec 17, 2020
2c6daa3
Add OpaVote testcase and dataset
SmithPeder Dec 14, 2020
7c82930
OpaVote needs 30000ms to run on CI
SmithPeder Dec 15, 2020
0f68004
Redo retriveVotePage to show priorities
SmithPeder Dec 14, 2020
e63611a
New view and logic for administration of election
SmithPeder Dec 14, 2020
c619505
Eslint allow spread {...}
SmithPeder Dec 14, 2020
fcfaaac
Initial implementation of user gen using mail
SmithPeder Jan 15, 2021
341f9d1
Add accessCode for election.
SmithPeder Jan 16, 2021
a42b924
Return the res objects to avoid double ERR_HTTP_HEADERS_SENT
SmithPeder Jan 16, 2021
3987b5e
Add tests for accessCode
SmithPeder Jan 16, 2021
e800c5b
Switch from username to email for user gen
SmithPeder Jan 16, 2021
5c751f0
Clean template in order to avoid spam-filter
SmithPeder Jan 16, 2021
dd2a74b
Fix styling for entering code
SmithPeder Jan 16, 2021
ed06695
Don't change docker-compose in this branch
SmithPeder Jan 16, 2021
eb86fb4
Use random username and create new field for unActivatedEmail that we
SmithPeder Jan 17, 2021
7ce6d69
Rewrite and clean-up bad code from comments
SmithPeder Jan 17, 2021
f6de604
Don't return the user on generate, defeats the purpose of "secret"
SmithPeder Jan 18, 2021
89fedbf
Implement email index as a schema. Set user as null when auth
SmithPeder Jan 18, 2021
53b04b6
Add unique: true
SmithPeder Jan 19, 2021
748225d
Only send mail in prod (by default)
SmithPeder Jan 19, 2021
635ea5a
Bumb node, mongo, redis and fix env for auth in prod
SmithPeder Jan 20, 2021
8baa648
Use LEGOUser to avoid duplicates, resend mail on duplicate
SmithPeder Jan 23, 2021
4cc1afb
Update README
SmithPeder Jan 23, 2021
23cdf79
Generated users default to active:false
SmithPeder Jan 23, 2021
0e99a93
Send DuplicateLegoUserError on reject
SmithPeder Jan 23, 2021
a61750c
Apply suggestions from code review
SmithPeder Jan 24, 2021
9110d1d
Load "from mail" from env and not json
SmithPeder Jan 24, 2021
016bc3b
Update deployment docs
LudvigHz Jan 31, 2021
b3eea0c
Update example docker-compose file
LudvigHz Jan 31, 2021
bb77d67
Clear selected priorities on vote and fetchElection
LudvigHz Jan 31, 2021
b5d7622
Initialize counts obj in STV with all alternatives
LudvigHz Jan 31, 2021
54e6441
Add blank votes to election summary
LudvigHz Jan 31, 2021
e1dc206
Add datasets and tests with blank votes
LudvigHz Feb 2, 2021
23913fb
AccessCode was random for the schema, not the objects
SmithPeder Feb 1, 2021
35ef0dc
Fix edit election page to match new alternatives styles
LudvigHz Feb 3, 2021
b27b626
Reuse ballot confirmatin on receipt page
LudvigHz Feb 3, 2021
3ad2d32
Only allow one active election
SmithPeder Jan 31, 2021
71aaf73
Improve the mail template with more env usage
SmithPeder Jan 31, 2021
815e11f
Auto-fill username and password from token
SmithPeder Jan 31, 2021
61cce08
Improve mail-handler and write tests user-gen
SmithPeder Jan 31, 2021
2fc1e1d
Enable normal STMP mail aswell
SmithPeder Jan 31, 2021
17732b0
Update client/controllers/generateUserCtrl.js
SmithPeder Jan 31, 2021
ce0e157
Spelling
SmithPeder Feb 3, 2021
f6cf525
Remove LOGO and don't print in tests
SmithPeder Feb 5, 2021
c20f10d
LINT
SmithPeder Feb 5, 2021
151656b
Add moderator feature to manage register
SmithPeder Feb 6, 2021
4ae3e9f
Add tests, fix permissions, better errors
SmithPeder Feb 6, 2021
254502c
Move view, add search
SmithPeder Feb 6, 2021
f3ed248
Update test/api/register.test.js
SmithPeder Feb 7, 2021
af62f91
Add test for no associated user
SmithPeder Feb 7, 2021
31c1a5c
Fix and add E2E tests for new STV voting
LudvigHz Feb 5, 2021
0892406
Fix E2E tests for admin view with STV
LudvigHz Feb 7, 2021
f1a7094
Merge pull request #411 from webkom/e2e-stv-admin
SmithPeder Feb 7, 2021
34e741c
Rename legoUser to identifier so it's not linked to LEGO
SmithPeder Feb 7, 2021
2c4ebd4
Merge pull request #410 from webkom/renameLegoUser
LudvigHz Feb 7, 2021
8b62a00
Add some more admin tests
LudvigHz Feb 9, 2021
2570b15
Merge pull request #413 from webkom/e2e-stv-admin
SmithPeder Feb 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Emit websocket on election deactivation
SmithPeder committed Feb 7, 2021
commit d8cb492ea9d26d908d7695eb2eee24026652c03f
8 changes: 5 additions & 3 deletions app/controllers/election.js
Original file line number Diff line number Diff line change
@@ -77,9 +77,11 @@ exports.activate = (req, res) =>
});

exports.deactivate = (req, res) =>
setElectionStatus(req, res, false).then((election) =>
res.status(200).json(election)
);
setElectionStatus(req, res, false).then((election) => {
const io = app.get('io');
io.emit('election');
res.status(200).json(election);
});

exports.elect = (req, res) =>
req.election.elect().then((result) => res.json(result));