diff --git a/poll/poll.py b/poll/poll.py index 9cd46b2..0b8c66b 100644 --- a/poll/poll.py +++ b/poll/poll.py @@ -823,7 +823,8 @@ def generate_report_data(self, user_state_iterator, limit_responses=None): continue report = { self.ugettext('Question'): self.question, - self.ugettext('Answer'): answers_dict[choice]['label'], + self.ugettext('Answer'): answers_dict.get(choice, {}).get('label', + "[Removed Poll Option {}]".format(choice)), self.ugettext('Submissions count'): user_state.state['submissions_count'] } count += 1 @@ -1329,8 +1330,9 @@ def generate_report_data(self, user_state_iterator, limit_responses=None): # End the iterator here return - question = questions_dict[question_id]['label'] - answer = answers_dict[answer_id] + question = questions_dict.get(question_id, {}).get('label', + "[Removed Survey Question {}]".format(question_id)) + answer = answers_dict.get(answer_id) or "[Removed Survey Option {}]".format(answer_id) report = { self.ugettext('Question'): question, self.ugettext('Answer'): answer, diff --git a/setup.py b/setup.py index 2d9091d..0f498bf 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def package_data(pkg, roots): setup( name='xblock-poll', - version='1.9.0', + version='1.9.2', description='An XBlock for polling users.', packages=[ 'poll',