[Fedora Elections] #21: Anonymize datasets
by fedora-badges
#21: Anonymize datasets
-------------------------+--------------------------------------------------
Reporter: nigelj | Owner: nigelj
Type: enhancement | Status: new
Priority: major | Milestone: Release 0.2.0
Component: General | Version: 0.1.5
Keywords: |
-------------------------+--------------------------------------------------
Apologies if this is how the system currently works.
I'm posting this on behalf of the Fedora Board. We would like for our
election voting tool to work like this:
FAS2 user goes to vote, they authenticate. The voting system assigns the
user a unique ID number. The user then votes, and confirms their vote. The
"ballot" is stored but is tied only to this unique ID number (not to the
FAS2 user/account). The FAS2 system records that the FAS2 user has voted,
but does not store a correlation between the FAS2 account and the unique
ID number attached to the ballot.
Thus, we have a dataset showing the results, but it is anonymized
automatically, and we still know who has (and has not) voted, just not who
(or what) they voted for.
Thanks in advance.
---
2008-07-29 19:26:00 changed by mmcgrath
Just so we're clear. The idea is to ensure that the results of a ballot
cannot in any way be tied to a user. We would also not want this data in
logs on the elections app servers correct?
This might make fraud more likely but then I'm not entirely sure how its
any better or worse from that perspective with what we have now.
G, can you think of any technical hurdles in implementing this?
Spot/Board: Do you want us to anonymize the data that's already in the
database?
2008-07-29 19:35:42 changed by spot
Yes, that is the idea. We would not want a correlation between a ballot
and a user anywhere, not even logs. If we're careful with ensuring that
once a ballot is submitted, the FAS2 user is marked as having voted in an
election, I don't think we open the door to any additional fraud
possibilities.
As to anonymizing the existing data, I'm not sure it is worth the effort.
2008-07-29 21:39:01 changed by jspaleta
If we are going to be making changes to address the voting system... are
we gonna make any effort to contact someone doing active research into
electronic voting methods to get an idea as to existing workable
implementation concepts that accomplish the desired anonymizing of the
voting but also protect against fraud?
-jef
--
Ticket URL: <https://fedorahosted.org/elections/ticket/21>
Fedora Elections <https://fedorahosted.org/elections/>
Fedora Elections
9 years, 5 months
[Fedora Elections] #25: Allow other voting methods
by fedora-badges
#25: Allow other voting methods
---------------------+------------------------------------------------------
Reporter: nigelj | Owner: nigelj
Type: defect | Status: new
Priority: major | Milestone: Release 0.3.0
Component: General | Version: trunk
Keywords: |
---------------------+------------------------------------------------------
In addition to #24, it'd be nice to allow a simpler voting method,
something like:
for - abstain - against
For would be +1, abstain 0, against -1
This makes it nice and easy to count etc.
Is this something like you want as well Kevin?
--
Ticket URL: <https://fedorahosted.org/elections/ticket/25>
Fedora Elections <https://fedorahosted.org/elections/>
Fedora Elections
9 years, 7 months
[Fedora Elections] #39: [RFE] Show real name in admin interface or implement election preview
by fedora-badges
#39: [RFE] Show real name in admin interface or implement election preview
----------------------------+-----------------------------
Reporter: jreznik | Owner: nigelj
Type: defect | Status: new
Priority: major | Milestone: Future Release
Component: Administration | Version: 0.2.1
Keywords: | Blocked By:
Blocking: |
----------------------------+-----------------------------
Currently, in admin interface, only FAS account name is shown and it could
lead to mistakes (aka bad fas -> nickname mapping for July 2014 FESCo
election). There's no way how to check it before elections starts and it
happens automatically in the night...
Two options how to fix it - show real name when FAS is added or implement
elections preview. Implementation of both would be even better :).
--
Ticket URL: <https://fedorahosted.org/elections/ticket/39>
Fedora Elections <https://fedorahosted.org/elections/>
Fedora Elections
9 years, 8 months
Branch 'text_results' - 2 commits - fedora_elections/models.py fedora_elections/templates
by Pierre-YvesChibon
fedora_elections/models.py | 7 +++++++
fedora_elections/templates/results.html | 2 +-
fedora_elections/templates/results_text.html | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 88b340563c8ee5bf5bbbfc6a397dccc2f07d5bf1
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Jul 26 12:43:31 2014 +0200
Adjust calculating the maximum number of votes to use `max_vote`
diff --git a/fedora_elections/templates/results.html b/fedora_elections/templates/results.html
index c4581b1..9183faf 100644
--- a/fedora_elections/templates/results.html
+++ b/fedora_elections/templates/results.html
@@ -68,7 +68,7 @@
</tr>
<tr>
<th title="Maximum number of votes possible">Maximum of votes</th>
- <td>{{ stats['n_voters'] * stats['n_candidates'] }}</td>
+ <td>{{ stats['n_voters'] * stats['max_vote'] }}</td>
</tr>
{% if stats['candidate_voters'] %}
<tr>
diff --git a/fedora_elections/templates/results_text.html b/fedora_elections/templates/results_text.html
index 59fbba0..f3947ec 100644
--- a/fedora_elections/templates/results_text.html
+++ b/fedora_elections/templates/results_text.html
@@ -16,7 +16,7 @@ are shown below.
XXX is electing {{ election.seats_elected }} seats this time.
A total of {{stats['n_voters'] }} ballots were cast, meaning a candidate
-could accumulate up to {{ stats['n_voters'] * stats['n_candidates'] }} votes ({{stats['n_voters'] }} * {{ stats['n_candidates'] }}).
+could accumulate up to {{ stats['n_voters'] * stats['max_vote'] }} votes ({{stats['n_voters'] }} * {{ stats['max_vote'] }}).
The results for the elections are as follows:
commit 9e82fe2336d0f4790f30b06a65968a688516f232
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Jul 26 12:43:02 2014 +0200
Add a `max_vote` entry in the stats table used for the result page
diff --git a/fedora_elections/models.py b/fedora_elections/models.py
index d35096f..1cc51f4 100644
--- a/fedora_elections/models.py
+++ b/fedora_elections/models.py
@@ -414,6 +414,13 @@ class Vote(BASE):
stats['candidate_voters'] = candidate_voters
stats['n_candidates'] = cnt
+ if election.voting_type in ['range', 'select']:
+ stats['max_vote'] = cnt
+ if election.max_votes:
+ stats['max_vote'] = election.max_votes
+ elif election.voting_type == 'simple':
+ stats['max_vote'] = 1
+
return stats
9 years, 9 months
Branch 'text_results' - tests/test_flask_elections.py
by Pierre-YvesChibon
tests/test_flask_elections.py | 82 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
New commits:
commit 4359ef64463bbf915f48404e3912f9a958aaf46b
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:52:51 2014 +0200
Add unit-tests for the text output of the results
diff --git a/tests/test_flask_elections.py b/tests/test_flask_elections.py
index 397db4a..65268c9 100644
--- a/tests/test_flask_elections.py
+++ b/tests/test_flask_elections.py
@@ -238,6 +238,88 @@ class FlaskElectionstests(ModelFlasktests):
' and you may not see its results yet.</li>' in output.data)
self.assertTrue('<h3>Current elections</h3>' in output.data)
+ def test_election_results_text(self):
+ """ Test the election_results_text function - the preview part. """
+ output = self.app.get(
+ '/results/test_election/text', follow_redirects=True)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue(
+ 'class="message">The election, test_election, does not exist.</'
+ in output.data)
+
+ self.setup_db()
+
+ output = self.app.get(
+ '/results/test_election/text', follow_redirects=True)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue(
+ 'class="error">The text results are only available to the '
+ 'admins</li>' in output.data)
+ self.assertTrue('<h2>Elections</h2>' in output.data)
+
+ user = FakeUser(['packager'], username='toshio')
+ with user_set(fedora_elections.APP, user):
+ output = self.app.get(
+ '/results/test_election2/text', follow_redirects=True)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue(
+ 'class="error">The text results are only available to the '
+ 'admins</li>' in output.data)
+ self.assertTrue('<h2>Elections</h2>' in output.data)
+
+ user = FakeUser(
+ fedora_elections.APP.config['FEDORA_ELECTIONS_ADMIN_GROUP'],
+ username='toshio')
+ with user_set(fedora_elections.APP, user):
+ output = self.app.get(
+ '/results/test_election2/text', follow_redirects=True)
+ self.assertEqual(output.status_code, 200)
+ exp = """<!DOCTYPE html>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>Fedora elections</title>
+ <link rel="shortcut icon" type="image/vnd.microsoft.icon"
+ href="//fedoraproject.org/static/images/favicon.ico"/>
+ </head>
+ <body>
+<pre>
+Greetings, all!
+
+The elections for test election 2 shortdesc have concluded, and the results
+are shown below.
+
+XXX is electing 1 seats this time.
+A total of 0 ballots were cast, meaning a candidate
+could accumulate up to 0 votes (0 * 0).
+
+The results for the elections are as follows:
+
+ # votes | name
+- --------+----------------------
+
+
+Congratulations to the winning candidates, and thank you all
+candidates for running this elections!
+</pre>
+
+</body>
+</html>"""
+
+ self.assertEqual(output.data, exp)
+
+ user = FakeUser(['gitr2spec'], username='kevin')
+ with user_set(fedora_elections.APP, user):
+ output = self.app.get(
+ '/results/test_election3/text', follow_redirects=True)
+ self.assertEqual(output.status_code, 200)
+ self.assertTrue(
+ '<li class="message">Sorry but this election is in progress,'
+ ' and you may not see its results yet.</li>' in output.data)
+ self.assertTrue('<h3>Current elections</h3>' in output.data)
+
+
if __name__ == '__main__':
SUITE = unittest.TestLoader().loadTestsFromTestCase(FlaskElectionstests)
9 years, 9 months
Branch 'text_results' - 3 commits - fedora_elections/elections.py
by Pierre-YvesChibon
fedora_elections/elections.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 86578361f7e9dbb40fabbe4f08bfdc78d13202ea
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:45:04 2014 +0200
Rely on the is_authenticated() where it makes sense
diff --git a/fedora_elections/elections.py b/fedora_elections/elections.py
index 5227ddb..355eabb 100644
--- a/fedora_elections/elections.py
+++ b/fedora_elections/elections.py
@@ -309,7 +309,7 @@ def election_results(election_alias):
return election
elif election.embargoed:
- if not hasattr(flask.g, 'fas_user') or not flask.g.fas_user:
+ if not is_authenticated():
flask.flash("We are sorry. The results for this election "
"cannot be viewed because they are currently "
"embargoed pending formal announcement.")
commit 950db261e90a6244f667dcc6b5bc00836b3f8354
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:44:14 2014 +0200
Optimization: by using `and` instead of `or` will stop the condition at the first False
diff --git a/fedora_elections/elections.py b/fedora_elections/elections.py
index e7b9893..5227ddb 100644
--- a/fedora_elections/elections.py
+++ b/fedora_elections/elections.py
@@ -364,8 +364,8 @@ def election_results_text(election_alias):
if not isinstance(election, models.Election): # pragma: no cover
return election
- if not is_authenticated() or not is_admin(flask.g.fas_user) \
- or not is_election_admin(flask.g.fas_user, election.id):
+ if not (is_authenticated() and is_admin(flask.g.fas_user)
+ and is_election_admin(flask.g.fas_user, election.id)):
flask.flash(
"The text results are only available to the admins", "error")
return safe_redirect_back()
commit 0d63467564d94d5497ac2da10002ba3d1438bc6d
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:43:43 2014 +0200
Check is the user is authenticated before checking if he/she is an admin
diff --git a/fedora_elections/elections.py b/fedora_elections/elections.py
index a4ca812..e7b9893 100644
--- a/fedora_elections/elections.py
+++ b/fedora_elections/elections.py
@@ -330,8 +330,8 @@ def election_results(election_alias):
"embargoed pending formal announcement.")
return safe_redirect_back()
- if is_admin(flask.g.fas_user) \
- or is_election_admin(flask.g.fas_user, election.id):
+ if is_authenticated() and (is_admin(flask.g.fas_user) \
+ or is_election_admin(flask.g.fas_user, election.id)):
flask.flash(
"Check out the <a href='%s'>Text version</a> "
"to send the annoucement" % flask.url_for(
9 years, 9 months
Branch 'text_results' - fedora_elections/elections.py
by Pierre-YvesChibon
fedora_elections/elections.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
New commits:
commit cbad3d6573394df0b9c85e619956e6ab464db6b7
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:36:36 2014 +0200
Let's make it simple: only admins can see the text version of the results page
diff --git a/fedora_elections/elections.py b/fedora_elections/elections.py
index 30a7c8f..a4ca812 100644
--- a/fedora_elections/elections.py
+++ b/fedora_elections/elections.py
@@ -364,12 +364,10 @@ def election_results_text(election_alias):
if not isinstance(election, models.Election): # pragma: no cover
return election
- elif election.embargoed and (
- not is_admin(flask.g.fas_user)
- or not is_election_admin(flask.g.fas_user, election.id)):
+ if not is_authenticated() or not is_admin(flask.g.fas_user) \
+ or not is_election_admin(flask.g.fas_user, election.id):
flask.flash(
- "The text results are only available to admins when the election"
- " is under embargo")
+ "The text results are only available to the admins", "error")
return safe_redirect_back()
usernamemap = {}
9 years, 9 months
Changes to 'text_results'
by Pierre-YvesChibon
New branch 'text_results' available with the following commits:
commit 0f507e6a1f3b392f4b9a457093c299b5e7adbf66
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:30:58 2014 +0200
Add a flash message for the election admins pointing them to the text version of the results
commit 0265cac5246d6729e3518448c7e2d84f7c4ef785
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:30:25 2014 +0200
Create a new endpoint providing the election results in text
This endpoint can be used as a basis to make the announcement
commit fd85d73c6d8f9bb31d4e711e0b7f433ce2038a74
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:29:28 2014 +0200
Add a new template presenting the results in the format of the announcements
commit 9aa5c7d0c5c3833a2ae6216381ab3ea2c7db0f8b
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 25 15:28:19 2014 +0200
Create a new jinja filter that rjust() some provided text
9 years, 9 months
Branch 'develop' - fedora_elections/templates
by Pierre-YvesChibon
fedora_elections/templates/about.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 7954b66939dd757bb3f493411cdc289f60cfd395
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 23 17:54:38 2014 +0200
Fix link to the results page from the about page
diff --git a/fedora_elections/templates/about.html b/fedora_elections/templates/about.html
index 7a604bb..e2008ff 100644
--- a/fedora_elections/templates/about.html
+++ b/fedora_elections/templates/about.html
@@ -7,7 +7,8 @@
<p><a href="{{ election.url }}">[More Information]</a></p>
{% endif %}
{% if election.status == 'Ended' %}
- <a href="/results/{{ election.alias }}">Show Results!</a>
+ <a href="{{ url_for('election_results',
+ election_alias=election.alias) }}">Show Results!</a>
{% endif %}
<table border="1" cellpadding="1">
{% for candidate in election.candidates %}
9 years, 9 months
Branch 'develop' - 2 commits - fedora_elections/templates
by Pierre-YvesChibon
fedora_elections/templates/admin/all_elections.html | 4 ++--
fedora_elections/templates/admin/election_form.html | 4 ++--
fedora_elections/templates/admin/view_election.html | 4 ++--
fedora_elections/templates/archive.html | 4 ++--
fedora_elections/templates/index.html | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 38dbc1107e3c6a4a16225dbf2021b970a0bbb7e2
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 23 14:28:29 2014 +0200
Fix the display for the start_date and end_date to always have them specify it opens at 00:00 and closes at 23:59:59
diff --git a/fedora_elections/templates/admin/all_elections.html b/fedora_elections/templates/admin/all_elections.html
index c19c831..952245b 100644
--- a/fedora_elections/templates/admin/all_elections.html
+++ b/fedora_elections/templates/admin/all_elections.html
@@ -30,8 +30,8 @@
{{ election.shortdesc }}
</a>
</td>
- <td>{{ election.start_date }}</td>
- <td>{{ election.end_date }}</td>
+ <td>{{ election.start_date.strftime('%Y-%m-%d') }} 00:00 </td>
+ <td>{{ election.end_date.strftime('%Y-%m-%d') }} 23:59 </td>
<td>{{ election.status }}</td>
</tr>
{% endfor %}
diff --git a/fedora_elections/templates/admin/view_election.html b/fedora_elections/templates/admin/view_election.html
index 2247754..c283de7 100644
--- a/fedora_elections/templates/admin/view_election.html
+++ b/fedora_elections/templates/admin/view_election.html
@@ -11,8 +11,8 @@
</a>
</p>
<ul>
- <li>Start date: {{ election.start_date }}</li>
- <li>End date: {{ election.end_date }}</li>
+ <li>Start date: {{ election.start_date.strftime('%Y-%m-%d') }} 00:00 </li>
+ <li>End date: {{ election.end_date.strftime('%Y-%m-%d') }} 23:59 </li>
<li>Number elected: {{ election.seats_elected }}</li>
<li>Election type: {{ election.voting_type }}</li>
<li>Maximum number of votes: {{ election.max_votes }}</li>
diff --git a/fedora_elections/templates/archive.html b/fedora_elections/templates/archive.html
index ea5d6db..61699de 100644
--- a/fedora_elections/templates/archive.html
+++ b/fedora_elections/templates/archive.html
@@ -15,8 +15,8 @@
{% for election in elections %}
<tr>
<td>{{election.shortdesc}}</td>
- <td>{{election.start_date}}</td>
- <td>{{election.end_date}}</td>
+ <td>{{ election.start_date.strftime('%Y-%m-%d') }} 00:00 </td>
+ <td>{{ election.end_date.strftime('%Y-%m-%d') }} 23:59 </td>
<td>
<a href="{{ url_for('about_election', election_alias=election.alias) }}">
More information
diff --git a/fedora_elections/templates/index.html b/fedora_elections/templates/index.html
index 1381b41..64b526b 100644
--- a/fedora_elections/templates/index.html
+++ b/fedora_elections/templates/index.html
@@ -18,8 +18,8 @@
{% for election in election_list %}
<tr>
<td>{{ election.shortdesc }}</td>
- <td>{{ election.start_date }}</td>
- <td>{{ election.end_date }}</td>
+ <td>{{ election.start_date.strftime('%Y-%m-%d') }} 00:00 </td>
+ <td>{{ election.end_date.strftime('%Y-%m-%d') }} 23:59 </td>
<td>{{ election.status }}</td>
<td>
<a href="{{ url_for('about_election', election_alias=election.alias) }}">
commit c7ecd6e25352ef4c5f6f2b5395d102cffda2b8c6
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 23 14:27:28 2014 +0200
Fix displaying the information after the field when adding/editing an election
diff --git a/fedora_elections/templates/admin/election_form.html b/fedora_elections/templates/admin/election_form.html
index fceb75a..a3dcde8 100644
--- a/fedora_elections/templates/admin/election_form.html
+++ b/fedora_elections/templates/admin/election_form.html
@@ -17,8 +17,8 @@
{{ render_field_in_row(form.voting_type) }}
{{ render_field_in_row(form.max_votes) }}
{{ render_field_in_row(form.url) }}
- {{ render_field_in_row(form.start_date, " at 00:00:00 UTC") }}
- {{ render_field_in_row(form.end_date, " at 23:59:59 UTC") }}
+ {{ render_field_in_row(form.start_date, after=" at 00:00:00 UTC") }}
+ {{ render_field_in_row(form.end_date, after=" at 23:59:59 UTC") }}
{{ render_field_in_row(form.seats_elected) }}
{{ render_field_in_row(form.candidates_are_fasusers) }}
{{ render_field_in_row(form.embargoed) }}
9 years, 9 months