Skip to content
Snippets Groups Projects
Commit 906701c2 authored by Ben Adida's avatar Ben Adida
Browse files

added new statistics and stripping of CSV values in import, plus appropriate test

parent a6d50005
Branches
Tags
No related merge requests found
......@@ -612,15 +612,15 @@ class VoterFile(models.Model):
continue
num_voters += 1
voter_id = voter[0]
voter_id = voter[0].strip()
name = voter_id
email = voter_id
if len(voter) > 1:
email = voter[1]
email = voter[1].strip()
if len(voter) > 2:
name = voter[2]
name = voter[2].strip()
# create the user -- NO MORE
# user = User.update_or_create(user_type='password', user_id=email, info = {'name': name})
......
{% extends TEMPLATE_BASE %}
{% block title %}Statistics{% endblock %}
{% block content %}
<h1>Problematic Elections</h1>
Unfrozen for more than a day.
{% for election in elections %}
<p>
<b><a href="{% url helios.views.one_election_view election.uuid %}">{{election.name}}</a></b> -- {{election.num_voters}} voters
</p>
{% endfor %}
{% endblock %}
......@@ -78,6 +78,11 @@ class ElectionModelTests(TestCase):
vf = models.VoterFile.objects.create(election = election, voter_file = File(open(FILE), "voter_file.css"))
vf.process()
# make sure that we stripped things correctly
voter = election.voter_set.get(voter_login_id = 'benadida5')
self.assertEquals(voter.voter_email, 'ben5@adida.net')
self.assertEquals(voter.voter_name, 'Ben5 Adida')
def test_check_issues_before_freeze(self):
# should be three issues: no trustees, and no questions, and no voters
issues = self.election.issues_before_freeze
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment