From 5378b46b7165bd313c9169743c2e896bf5618da6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petteri=20R=C3=A4ty?= <petsku@petteriraty.eu>
Date: Sat, 23 Oct 2010 16:06:49 +0300
Subject: [PATCH] Log when cast votes fail to verify and store

Loosing peoples votes silently is a really bad practise. At least we log
such incidents now to the celery log.
---
 helios/tasks.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/helios/tasks.py b/helios/tasks.py
index 81772fe..c0f189a 100644
--- a/helios/tasks.py
+++ b/helios/tasks.py
@@ -15,7 +15,7 @@ import copy
 
 
 @task()
-def cast_vote_verify_and_store(cast_vote_id, status_update_message=None):
+def cast_vote_verify_and_store(cast_vote_id, status_update_message=None, **kwargs):
     cast_vote = CastVote.objects.get(id = cast_vote_id)
     result = cast_vote.verify_and_store()
 
@@ -32,8 +32,8 @@ def cast_vote_verify_and_store(cast_vote_id, status_update_message=None):
 
             user.update_status(status_update_message)
     else:
-        # FIXME: do something about a bad vote
-        pass
+        logger = cast_vote_verify_and_store.get_logger(**kwargs)
+        logger.error("Failed to verify and store %d" % cast_vote_id)
     
 @task()
 def voters_email(election_id, subject_template, body_template, extra_vars={}):
-- 
GitLab