def setup_responses(self):
        DeliveryNode.objects.all().delete()
        MultipleChoiceQuestion.objects.all().delete()
        MultipleChoiceAnswer.objects.all().delete()
        from eums.fixtures.ip_questions import seed_ip_questions
        questions, options, _ = seed_ip_questions()

        self.programme = ProgrammeFactory(name='my-program')
        self.ip = ConsigneeFactory()

        self.today = FakeDate.today()
        po_item = PurchaseOrderItemFactory(quantity=100, value=1000)
        ip_delivery_one = DeliveryFactory(location='some location',
                                          track=True,
                                          programme=self.programme,
                                          consignee=self.ip,
                                          ip=self.ip,
                                          delivery_date=self.today +
                                          datetime.timedelta(days=3))

        DeliveryNodeFactory(tree_position=DeliveryNode.IMPLEMENTING_PARTNER,
                            quantity=10,
                            item=po_item,
                            distribution_plan=ip_delivery_one,
                            consignee=self.ip)

        other_delivery = DeliveryFactory(location='Other location',
                                         delivery_date=self.today,
                                         track=True)
        DeliveryNodeFactory(tree_position=DeliveryNode.IMPLEMENTING_PARTNER,
                            quantity=20,
                            item=po_item,
                            distribution_plan=other_delivery)

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=ip_delivery_one,
                           status=Run.STATUS.scheduled),
            question=questions['WAS_DELIVERY_RECEIVED'],
            value=options['DELIVERY_WAS_RECEIVED'])

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=ip_delivery_one,
                           status=Run.STATUS.scheduled),
            question=questions['IS_DELIVERY_IN_GOOD_ORDER'],
            value=options['IN_GOOD_CONDITION'])

        non_response_delivery_one = DeliveryFactory(delivery_date=self.today +
                                                    datetime.timedelta(days=4),
                                                    location='some location',
                                                    track=True)

        DeliveryNodeFactory(tree_position=DeliveryNode.IMPLEMENTING_PARTNER,
                            quantity=30,
                            item=po_item,
                            distribution_plan=non_response_delivery_one)

        RunFactory(runnable=non_response_delivery_one,
                   status=Run.STATUS.scheduled)
    def setup_responses(self):
        DeliveryNode.objects.all().delete()
        MultipleChoiceQuestion.objects.all().delete()
        MultipleChoiceAnswer.objects.all().delete()
        from eums.fixtures.ip_questions import seed_ip_questions

        questions, options, _ = seed_ip_questions()

        self.programme = ProgrammeFactory(name='my-program')
        self.ip = ConsigneeFactory(name='Some Na')

        self.today = FakeDate.today()
        po_item = PurchaseOrderItemFactory(quantity=100, value=1000)
        ip_delivery_one = DeliveryFactory(
            location='someLocation',
            track=True,
            programme=self.programme,
            consignee=self.ip,
            ip=self.ip,
            delivery_date=self.today + datetime.timedelta(days=3))

        DeliveryNodeFactory(tree_position=DeliveryNode.IMPLEMENTING_PARTNER, quantity=10,
                            item=po_item, distribution_plan=ip_delivery_one, consignee=self.ip)

        other_delivery = DeliveryFactory(location='someLocation', delivery_date=self.today, track=True)
        DeliveryNodeFactory(tree_position=DeliveryNode.IMPLEMENTING_PARTNER, quantity=20,
                            item=po_item, distribution_plan=other_delivery, consignee=self.ip)

        MultipleChoiceAnswerFactory(run=RunFactory(runnable=ip_delivery_one, status=Run.STATUS.scheduled),
                                    question=questions['WAS_DELIVERY_RECEIVED'], value=options['DELIVERY_WAS_RECEIVED'])

        MultipleChoiceAnswerFactory(run=RunFactory(runnable=ip_delivery_one, status=Run.STATUS.scheduled),
                                    question=questions['IS_DELIVERY_IN_GOOD_ORDER'], value=options['IN_GOOD_CONDITION'])

        MultipleChoiceAnswerFactory(run=RunFactory(runnable=ip_delivery_one, status=Run.STATUS.scheduled),
                                    question=questions['SATISFIED_WITH_DELIVERY'], value=options['SATISFIED'])

        non_response_delivery_one = DeliveryFactory(delivery_date=self.today + datetime.timedelta(days=4), location='someLocation',
                                                    track=True)

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=other_delivery, status=Run.STATUS.scheduled),
            question=questions['WAS_DELIVERY_RECEIVED'], value=options['DELIVERY_WAS_NOT_RECEIVED'])

        DeliveryNodeFactory(tree_position=DeliveryNode.IMPLEMENTING_PARTNER, quantity=30,
                            item=po_item, distribution_plan=non_response_delivery_one)

        RunFactory(runnable=non_response_delivery_one, status=Run.STATUS.scheduled)
Beispiel #3
0
    def setup_responses(self):
        DeliveryNode.objects.all().delete()
        MultipleChoiceQuestion.objects.all().delete()
        MultipleChoiceAnswer.objects.all().delete()
        from eums.fixtures.ip_questions import seed_ip_questions
        questions, options, _ = seed_ip_questions()

        self.programme = ProgrammeFactory(name='my-program')
        self.ip = ConsigneeFactory()

        self.today = FakeDate.today()
        ip_delivery_one = DeliveryFactory(location='some location',
                                          track=True,
                                          programme=self.programme,
                                          consignee=self.ip,
                                          ip=self.ip,
                                          delivery_date=self.today +
                                          datetime.timedelta(days=3))

        DeliveryFactory(location='Other location',
                        delivery_date=self.today,
                        track=True)

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=ip_delivery_one,
                           status=Run.STATUS.scheduled),
            question=questions['WAS_DELIVERY_RECEIVED'],
            value=options['DELIVERY_WAS_RECEIVED'])

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=ip_delivery_one,
                           status=Run.STATUS.scheduled),
            question=questions['IS_DELIVERY_IN_GOOD_ORDER'],
            value=options['IN_GOOD_CONDITION'])

        non_response_delivery_one = DeliveryFactory(delivery_date=self.today +
                                                    datetime.timedelta(days=4),
                                                    location='some location',
                                                    track=True)

        RunFactory(runnable=non_response_delivery_one,
                   status=Run.STATUS.scheduled)
    def setup_responses(self):
        DeliveryNode.objects.all().delete()
        MultipleChoiceQuestion.objects.all().delete()
        MultipleChoiceAnswer.objects.all().delete()
        from eums.fixtures.ip_questions import seed_ip_questions
        questions, options, _ = seed_ip_questions()

        self.programme = ProgrammeFactory(name='my-program')
        self.ip = ConsigneeFactory()

        self.today = FakeDate.today()
        ip_delivery_one = DeliveryFactory(
            location='some location',
            track=True,
            programme=self.programme,
            consignee=self.ip,
            ip=self.ip,
            delivery_date=self.today + datetime.timedelta(days=3))

        DeliveryFactory(
            location='Other location',
            delivery_date=self.today,
            track=True)

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=ip_delivery_one, status=Run.STATUS.scheduled),
            question=questions['WAS_DELIVERY_RECEIVED'], value=options['DELIVERY_WAS_RECEIVED'])

        MultipleChoiceAnswerFactory(
            run=RunFactory(runnable=ip_delivery_one, status=Run.STATUS.scheduled),
            question=questions['IS_DELIVERY_IN_GOOD_ORDER'], value=options['IN_GOOD_CONDITION'])

        non_response_delivery_one = DeliveryFactory(
            delivery_date=self.today + datetime.timedelta(days=4),
            location='some location',
            track=True)

        RunFactory(runnable=non_response_delivery_one, status=Run.STATUS.scheduled)
Beispiel #5
0
MultipleChoiceAnswer.objects.create(run=run_20, question=WAS_PRODUCT_RECEIVED, value=EU_OPT_NOT_SATISFIED)
MultipleChoiceAnswer.objects.create(run=run_20, question=EU_INFORMED_OF_DELAY, value=PRODUCT_WAS_RECEIVED)
MultipleChoiceAnswer.objects.create(run=run_21, question=WAS_PRODUCT_RECEIVED, value=PRODUCT_WAS_RECEIVED)
MultipleChoiceAnswer.objects.create(run=run_21, question=EU_QUALITY_OF_PRODUCT, value=EU_OPT_DAMAGED)
MultipleChoiceAnswer.objects.create(run=run_21, question=EU_SATISFACTION, value=EU_OPT_NOT_SATISFIED)
MultipleChoiceAnswer.objects.create(run=run_22, question=WAS_PRODUCT_RECEIVED, value=PRODUCT_WAS_RECEIVED)
MultipleChoiceAnswer.objects.create(run=run_22, question=EU_QUALITY_OF_PRODUCT, value=EU_OPT_DAMAGED)
MultipleChoiceAnswer.objects.create(run=run_22, question=EU_SATISFACTION, value=EU_OPT_NOT_SATISFIED)
MultipleChoiceAnswer.objects.create(run=run_23, question=WAS_PRODUCT_RECEIVED, value=PRODUCT_WAS_RECEIVED)
MultipleChoiceAnswer.objects.create(run=run_23, question=EU_QUALITY_OF_PRODUCT, value=EU_OPT_DAMAGED)
MultipleChoiceAnswer.objects.create(run=run_23, question=EU_SATISFACTION, value=EU_OPT_NOT_SATISFIED)

DistributionReport.objects.create(total_distributed=80, total_not_received=67, consignee=consignee_32,
                                  total_received=100, programme=programme_3)

ip_questions, options, _ = seed_ip_questions()

# WEB RUNS
web_flow = Flow.objects.get(for_runnable_type='WEB')
was_item_received = MultipleChoiceQuestion.objects.get(flow=web_flow, label='itemReceived')
yes = Option.objects.get(question=was_item_received, text='Yes')

wakiso = Consignee.objects.get(name='WAKISO DHO')
plan = DeliveryFactory()
wakiso_node_1 = DeliveryNodeFactory(consignee=wakiso, item=po_item_1, quantity=100, distribution_plan=plan)
wakiso_node_2 = DeliveryNodeFactory(consignee=wakiso, item=po_item_2, quantity=60, distribution_plan=plan)
wakiso_node_3 = DeliveryNodeFactory(consignee=wakiso, item=po_item_3, quantity=300, distribution_plan=plan)

MultipleChoiceAnswerFactory(question=was_item_received, value=yes, run=RunFactory(runnable=wakiso_node_1))
MultipleChoiceAnswerFactory(question=was_item_received, value=yes, run=RunFactory(runnable=wakiso_node_2))
MultipleChoiceAnswerFactory(question=was_item_received, value=yes, run=RunFactory(runnable=wakiso_node_3))
Beispiel #6
0
from eums.fixtures import web_questions, ip_questions
from eums.fixtures.end_user_questions import *
from eums.fixtures.ip_questions import seed_ip_questions
from eums.fixtures.middle_man_questions import mm_question_1, mm_q1_option_1, mm_question_2, mm_question_3, mm_question_4, mm_question_5, mm_question_6
from eums.models import DistributionReport
from eums.models import MultipleChoiceAnswer
from eums.models import NumericAnswer
from eums.models import TextAnswer
from eums.test.factories.answer_factory import MultipleChoiceAnswerFactory, NumericAnswerFactory, TextAnswerFactory
from eums.test.factories.delivery_factory import DeliveryFactory
from eums.test.factories.delivery_node_factory import DeliveryNodeFactory
from eums.test.factories.item_factory import ItemFactory
from eums.test.factories.run_factory import RunFactory


implement_partner_questions, options, _ = seed_ip_questions()
end_user_questions, end_user_options = seed_questions()

NumericAnswer.objects.create(run=run_7, question=EU_AMOUNT_RECEIVED, value=50)
NumericAnswer.objects.create(run=run_8, question=EU_AMOUNT_RECEIVED, value=10)
NumericAnswer.objects.create(run=run_9, question=EU_AMOUNT_RECEIVED, value=30)
NumericAnswer.objects.create(run=run_10, question=EU_AMOUNT_RECEIVED, value=20)
# NumericAnswer.objects.create(run=run_11, question=EU_AMOUNT_RECEIVED, value=30)
NumericAnswer.objects.create(run=run_12, question=EU_AMOUNT_RECEIVED, value=10)
NumericAnswer.objects.create(run=run_12, question=EU_AMOUNT_RECEIVED, value=10)
NumericAnswer.objects.create(run=run_14, question=EU_AMOUNT_RECEIVED, value=20)
NumericAnswer.objects.create(run=run_16, question=EU_AMOUNT_RECEIVED, value=60)
NumericAnswer.objects.create(run=run_16, question=EU_AMOUNT_RECEIVED, value=20)
NumericAnswer.objects.create(run=run_17, question=EU_AMOUNT_RECEIVED, value=100)
NumericAnswer.objects.create(run=run_18, question=EU_AMOUNT_RECEIVED, value=1)
NumericAnswer.objects.create(run=run_20, question=EU_AMOUNT_RECEIVED, value=1)
Beispiel #7
0
 def setUpClass(cls):
     from eums.fixtures.flows import seed_flows
     from eums.fixtures.ip_questions import seed_ip_questions
     seed_flows()
     seed_ip_questions()
Beispiel #8
0
                                    question=WAS_PRODUCT_RECEIVED,
                                    value=PRODUCT_WAS_RECEIVED)
MultipleChoiceAnswer.objects.create(run=run_23,
                                    question=EU_QUALITY_OF_PRODUCT,
                                    value=EU_OPT_DAMAGED)
MultipleChoiceAnswer.objects.create(run=run_23,
                                    question=EU_SATISFACTION,
                                    value=EU_OPT_NOT_SATISFIED)

DistributionReport.objects.create(total_distributed=80,
                                  total_not_received=67,
                                  consignee=consignee_32,
                                  total_received=100,
                                  programme=programme_3)

ip_questions, options, _ = seed_ip_questions()

# WEB RUNS
web_flow = Flow.objects.get(label='WEB')
was_item_received = MultipleChoiceQuestion.objects.get(flow=web_flow,
                                                       label='itemReceived')
yes = Option.objects.get(question=was_item_received, text='Yes')

wakiso = Consignee.objects.get(name='WAKISO DHO')
plan = DeliveryFactory()
wakiso_node_1 = DeliveryNodeFactory(consignee=wakiso,
                                    item=po_item_1,
                                    quantity=100,
                                    distribution_plan=plan)
wakiso_node_2 = DeliveryNodeFactory(consignee=wakiso,
                                    item=po_item_2,
Beispiel #9
0
from eums.elasticsearch.sync_info import SyncInfo
from eums.fixtures import web_questions, ip_questions
from eums.fixtures.end_user_questions import *
from eums.fixtures.ip_questions import seed_ip_questions
from eums.fixtures.middle_man_questions import mm_question_1, mm_q1_option_1, mm_question_2, mm_question_3, mm_question_4, mm_question_5, mm_question_6
from eums.models import DistributionReport
from eums.models import MultipleChoiceAnswer
from eums.models import NumericAnswer
from eums.models import TextAnswer
from eums.test.factories.answer_factory import MultipleChoiceAnswerFactory, NumericAnswerFactory, TextAnswerFactory
from eums.test.factories.delivery_factory import DeliveryFactory
from eums.test.factories.delivery_node_factory import DeliveryNodeFactory
from eums.test.factories.item_factory import ItemFactory
from eums.test.factories.run_factory import RunFactory

implement_partner_questions, options, _ = seed_ip_questions()
end_user_questions, end_user_options = seed_questions()

NumericAnswer.objects.create(run=run_7, question=EU_AMOUNT_RECEIVED, value=50)
NumericAnswer.objects.create(run=run_8, question=EU_AMOUNT_RECEIVED, value=10)
NumericAnswer.objects.create(run=run_9, question=EU_AMOUNT_RECEIVED, value=30)
NumericAnswer.objects.create(run=run_10, question=EU_AMOUNT_RECEIVED, value=20)
# NumericAnswer.objects.create(run=run_11, question=EU_AMOUNT_RECEIVED, value=30)
NumericAnswer.objects.create(run=run_12, question=EU_AMOUNT_RECEIVED, value=10)
NumericAnswer.objects.create(run=run_12, question=EU_AMOUNT_RECEIVED, value=10)
NumericAnswer.objects.create(run=run_14, question=EU_AMOUNT_RECEIVED, value=20)
NumericAnswer.objects.create(run=run_16, question=EU_AMOUNT_RECEIVED, value=60)
NumericAnswer.objects.create(run=run_16, question=EU_AMOUNT_RECEIVED, value=20)
NumericAnswer.objects.create(run=run_17,
                             question=EU_AMOUNT_RECEIVED,
                             value=100)