diff --git a/consultation_analyser/consultations/dummy_data.py b/consultation_analyser/consultations/dummy_data.py index 404c6264..0abb3362 100644 --- a/consultation_analyser/consultations/dummy_data.py +++ b/consultation_analyser/consultations/dummy_data.py @@ -1,3 +1,5 @@ +import random + from consultation_analyser.hosting_environment import HostingEnvironment from tests.factories import ( FakeConsultationData, @@ -6,6 +8,7 @@ SectionFactory, AnswerFactory, ConsultationResponseFactory, + ThemeFactory, ) @@ -19,17 +22,12 @@ def __init__(self, responses=10, **options): questions = [QuestionFactory(question=q, section=section) for q in FakeConsultationData().all_questions()] for r in range(responses): response = ConsultationResponseFactory(consultation=consultation) + _answers = [AnswerFactory(question=q, consultation_response=response) for q in questions] - _answers = [AnswerFactory(question=q, consultation_response=response, theme=None) for q in questions] - - # TODO - change back or create an option - - # _answers = [AnswerFactory(question=q, consultation_response=response) for q in questions] - - # # Set themes per question, multiple answers with the same theme - # for q in questions: - # themes = [ThemeFactory() for _ in range(2, 6)] - # for a in _answers: - # random_theme = random.choice(themes) - # a.theme = random_theme - # a.save() + # Set themes per question, multiple answers with the same theme + for q in questions: + themes = [ThemeFactory() for _ in range(2, 6)] + for a in _answers: + random_theme = random.choice(themes) + a.theme = random_theme + a.save()