def setup_responses(self): DeliveryNode.objects.all().delete() MultipleChoiceQuestion.objects.all().delete() from eums.fixtures.end_user_questions import seed_questions questions, options = seed_questions() po_item = PurchaseOrderItemFactory(quantity=100, value=1000) end_user_node_one = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=10, item=po_item) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_RECEIVED']) self.programme = ProgrammeFactory(name='my-program') self.ip = ConsigneeFactory() distribution_plan = DeliveryFactory(programme=self.programme, track=True) self.today = FakeDate.today() self.end_user_node_two = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=20, item=po_item, distribution_plan=distribution_plan) MultipleChoiceAnswerFactory(run=RunFactory( runnable=self.end_user_node_two, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_RECEIVED']) end_user_node_three = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=30, item=po_item, distribution_plan=distribution_plan, ip=self.ip, consignee=self.ip, delivery_date=self.today + datetime.timedelta(days=3)) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_three, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) end_user_node_four = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=40, item=po_item) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_four, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) end_user_node_five = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=50, item=po_item) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_five, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) non_response_node = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, track=True, quantity=60, item=po_item) RunFactory(runnable=non_response_node, status=Run.STATUS.scheduled)
def test_should_assemble_csv_data_for_distribution_alert(self): with patch('eums.models.alert.Alert.date_received', new_callable=PropertyMock) as mock_date_received: mock_date_received.return_value = FakeDate.today() with patch('eums.models.alert.Alert.contact', new_callable=PropertyMock) as mock_contact: mock_contact.return_value = {'contact_name': 'Lebron James', 'contact_phone': '+256776666666'} exporter = AlertCSVExporter('host_name', 'distribution') alert_by_distribution_csv = exporter.assemble_csv_data([self.distribution_alert]) expected_csv = [ ['DISTRIBUTION DEADLINE', 'PO/WAYBILL', 'DATE SHIPPED', 'DATE RECEIVED', 'VALUE', 'REPORTED BY', 'IMPLEMENTING PARTNER', 'DISTRICT', 'UNICEF REMARKS', 'RESOLVED'], [datetime.date.today(), 81034568, datetime.date.today(), FakeDate(2014, 9, 25), 0, 'Lebron James\n+256776666666', 'NAPAK DHO', 'Kampala', 'Medicine', False]] self.assertEqual(alert_by_distribution_csv, expected_csv)
def test_should_schedule_flow_to_start_after_buffer_when_calculated_send_time_is_in_past(self): some_date = FakeDate.today() - datetime.timedelta(days=10) node = NodeFactory(delivery_date=some_date) node.build_contact = MagicMock(return_value=self.contact) schedule_run_for(node) self.assertEqual(mock_celery.invoked_after, 10.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() 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() from eums.fixtures.end_user_questions import seed_questions questions, options = seed_questions() po_item = PurchaseOrderItemFactory(quantity=100, value=1000) end_user_node_one = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=10, item=po_item, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_RECEIVED'] ) self.programme = ProgrammeFactory(name='my-program') self.ip = ConsigneeFactory() distribution_plan = DeliveryFactory(programme=self.programme, track=True) self.today = FakeDate.today() self.end_user_node_two = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=20, item=po_item, distribution_plan=distribution_plan, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=self.end_user_node_two, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_RECEIVED'] ) end_user_node_three = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=30, item=po_item, distribution_plan=distribution_plan, ip=self.ip, consignee=self.ip, delivery_date=self.today + datetime.timedelta(days=3), track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_three, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) end_user_node_four = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=40, item=po_item, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_four, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) end_user_node_five = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=50, item=po_item, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_five, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) non_response_node = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, track=True, quantity=60, item=po_item) RunFactory(runnable=non_response_node, status=Run.STATUS.scheduled)
def test_should_schedule_flow_to_start_after_buffer_when_calculated_send_time_is_in_past( self): some_date = FakeDate.today() - datetime.timedelta(days=10) node = NodeFactory(delivery_date=some_date) node.build_contact = MagicMock(return_value=self.contact) self.flow_scheduler.schedule_run_for(node) self.assertEqual(self.mock_celery.invoked_after, 10.0)
class RunQueueFactory(factory.DjangoModelFactory): class Meta: model = RunQueue runnable = factory.SubFactory(DeliveryNodeFactory) contact_person_id = 'b8f951a0-4d5a-11e4-9af8-0002a5d5c51b' run_delay = 0.0 status = RunQueue.STATUS.not_started start_time = FakeDate.today()
class RunnableFactory(factory.DjangoModelFactory): class Meta: model = Runnable consignee = factory.SubFactory(ConsigneeFactory) location = "Kampala" contact_person_id = factory.Sequence(lambda n: "{0}".format(n)) track = False delivery_date = FakeDate.today() remark = "In good condition"
def test_should_assemble_csv_data_for_item_alert(self): with patch('eums.models.alert.Alert.contact', new_callable=PropertyMock) as mock_contact: mock_contact.return_value = {'contact_name': 'James Harden', 'contact_phone': '+256771234567'} exporter = AlertCSVExporter('host_name', 'item') alert_by_item_csv = exporter.assemble_csv_data([self.item_alert]) expected_csv = [ ['STATUS', 'ALERT DATE', 'PO/WAYBILL', 'DATE SHIPPED', 'QTY', 'VALUE', 'ITEM', 'REPORTED BY', 'IMPLEMENTING PARTNER', 'DISTRICT', 'UNICEF REMARKS', 'RESOLVED'], ['Not Received', datetime.date.today(), 81020737, FakeDate(2014, 9, 25), 10, Decimal('100'), 'Microsoft windows 7 Proefessional OLP NL F', 'James Harden\n+256771234567', 'WAKISO DHO', 'Kampala', 'Operating system', False]] self.assertEqual(alert_by_item_csv, expected_csv)
def test_should_assemble_csv_data_for_delivery_alert(self): with patch('eums.models.alert.Alert.date_received', new_callable=PropertyMock) as mock_date_received: mock_date_received.return_value = FakeDate.today() with patch('eums.models.alert.Alert.contact', new_callable=PropertyMock) as mock_contact: mock_contact.return_value = {'contact_name': 'Stephen Curry', 'contact_phone': '+256777654321'} exporter = AlertCSVExporter('host_name', 'delivery') alert_by_delivery_csv = exporter.assemble_csv_data([self.delivery_alert]) expected_csv = [ ['STATUS', 'ALERT DATE', 'PO/WAYBILL', 'DATE SHIPPED', 'VALUE', 'REPORTED BY', 'IMPLEMENTING PARTNER', 'DISTRICT', 'UNICEF REMARKS', 'RESOLVED', 'RETRIGGERED'], ['Damaged', datetime.date.today(), 81025778, datetime.date.today(), 0, 'Stephen Curry\n+256777654321', 'MUBENDE DHO', 'Kampala', 'Goods', False, False]] self.assertEqual(alert_by_delivery_csv, expected_csv)
class DeliveryNodeFactory(factory.DjangoModelFactory): class Meta: model = DistributionPlanNode distribution_plan = factory.SubFactory(DeliveryFactory) programme = factory.SubFactory(ProgrammeFactory) consignee = factory.SubFactory(ConsigneeFactory) tree_position = DistributionPlanNode.END_USER location = "Kampala" contact_person_id = factory.Sequence(lambda n: "{0}".format(n)) item = factory.SubFactory(PurchaseOrderItemFactory) track = False delivery_date = FakeDate.today() remark = "In good condition" quantity = 10
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)
def test_for_direct_delivery_filtered_by_date(self): fake_today = FakeDate.today() fake_last_week = fake_today - datetime.timedelta(days=7) po_one = PurchaseOrderFactory(order_number=12345, last_shipment_date=fake_today) po_two = PurchaseOrderFactory(order_number=9876, last_shipment_date=fake_last_week) fake_two_days_ago = fake_today - datetime.timedelta(days=2) PurchaseOrderItemFactory(purchase_order=po_one, quantity=1000) PurchaseOrderItemFactory(purchase_order=po_two, quantity=100) from_two_days_ago = PurchaseOrder.objects.for_direct_delivery(from_date=fake_two_days_ago) self.assertEquals(len(from_two_days_ago), 1) self.assertEquals(from_two_days_ago.first().id, po_one.id) to_two_days_ago = PurchaseOrder.objects.for_direct_delivery(to_date=fake_two_days_ago) self.assertEquals(len(to_two_days_ago), 1) self.assertEquals(to_two_days_ago.first().id, po_two.id)
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)
node_22 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=2, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-06-10", remark="hfhf") node_23 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=0, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-06-10", remark="hdh") node_24 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=2, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-06-10", remark="hfhf") node_25 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Kalungu",consignee=consignee_35, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date="2014-10-07", remark="gktt") node_26 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_37, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_27 = DistributionPlanNode.objects.create(distribution_plan=delivery_37, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_38, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_28 = DistributionPlanNode.objects.create(distribution_plan=delivery_37, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_38, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_29 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_37, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_30 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_37, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_31 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_35, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_32 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_35, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_33 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_35, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_34 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_35, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_35 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Kalungu",consignee=consignee_35, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_36 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=5, tree_position="END_USER", item=po_item_1, location="Oyam",consignee=consignee_35, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") node_37 = DistributionPlanNode.objects.create(distribution_plan=delivery_43, quantity=5000, tree_position="END_USER", item=po_item_1, location="PADER",consignee=wakiso, contact_person_id="5420508290cc38715b1af928", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="SAFE Programme") node_38 = DistributionPlanNode.objects.create(distribution_plan=delivery_43, quantity=5, tree_position="END_USER", item=po_item_2, location="bundibugyo", consignee=wakiso, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="Mother and Child") node_39 = DistributionPlanNode.objects.create(distribution_plan=delivery_43, quantity=51, tree_position="END_USER", item=po_item_3, location="Amuru", consignee=wakiso, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_40 = DistributionPlanNode.objects.create(distribution_plan=delivery_44, quantity=80, tree_position="IMPLEMENTING_PARTNER", item=po_item_4, location="bundibugyo", consignee=consignee_6, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="Mother and Child") node_41 = DistributionPlanNode.objects.create(distribution_plan=delivery_44, quantity=500, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_6, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_42 = DistributionPlanNode.objects.create(distribution_plan=delivery_45, quantity=700, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_33, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_43 = DistributionPlanNode.objects.create(distribution_plan=delivery_45, quantity=3000, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_33, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_44 = DistributionPlanNode.objects.create(distribution_plan=delivery_44, quantity=60, tree_position="IMPLEMENTING_PARTNER", item=po_item_4, location="bundibugyo", consignee=consignee_6, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="Mother and Child") node_45 = DistributionPlanNode.objects.create(distribution_plan=delivery_44, quantity=80, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_6, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_46 = DistributionPlanNode.objects.create(distribution_plan=delivery_45, quantity=90, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_33, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_47 = DistributionPlanNode.objects.create(distribution_plan=delivery_45, quantity=100, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_33, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_48 = DistributionPlanNode.objects.create(distribution_plan=delivery_44, quantity=200, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_6, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_49 = DistributionPlanNode.objects.create(distribution_plan=delivery_45, quantity=210, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_33, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_50 = DistributionPlanNode.objects.create(distribution_plan=delivery_45, quantity=220, tree_position="IMPLEMENTING_PARTNER", item=po_item_6, location="Amuru", consignee=consignee_33, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="hh") node_51 = DistributionPlanNode.objects.create(distribution_plan=delivery_46, quantity=30, tree_position="IMPLEMENTING_PARTNER", item=po_item_4, location="Wakiso", consignee=consignee_1, contact_person_id="54213ccc797221e84ac993fe", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="Mother and Child") node_52 = DistributionPlanNode.objects.create(distribution_plan=delivery_47, quantity=30, tree_position="IMPLEMENTING_PARTNER", item=ro_item_436, location="Wakiso", consignee=consignee_4, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2015, 07, 11), remark="Mother and Child")
from eums.client.test.functional.fixtures.mapdata_purchase_order import * from eums.client.test.functional.fixtures.mapdata_consignees import * from eums.client.test.functional.fixtures.mapdata_sales_order import * from eums.models import ReleaseOrder from eums.test.helpers.fake_datetime import FakeDate ro_1 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72082647, consignee=consignee_1, purchase_order=po_106, order_number=54102852, delivery_date=FakeDate.build(2014, 8, 19)) ro_2 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72089797, consignee=consignee_44, purchase_order=po_106, order_number=54109789, delivery_date=FakeDate.build(2014, 11, 6)) ro_3 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72088441, consignee=consignee_38, purchase_order=po_106, order_number=54110379, delivery_date=FakeDate.build(2014, 10, 23)) ro_4 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72090975, consignee=consignee_44, purchase_order=po_106, order_number=54112876, delivery_date=FakeDate.build(2014, 11, 18)) ro_5 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72102556, consignee=consignee_44, purchase_order=po_106, order_number=54127722, delivery_date=FakeDate.build(2015, 3, 25)) ro_6 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72077697, consignee=consignee_45, purchase_order=po_106, order_number=57006881, delivery_date=FakeDate.build(2014, 6, 25)) ro_7 = ReleaseOrder.objects.create(sales_order=sales_order_106, waybill=72077574, consignee=consignee_27, purchase_order=po_106, order_number=57006875, delivery_date=FakeDate.build(2014, 6, 25))
def setup_responses(self): DeliveryNode.objects.all().delete() MultipleChoiceQuestion.objects.all().delete() from eums.fixtures.end_user_questions import seed_questions questions, options = seed_questions() self.programme = ProgrammeFactory(name='my-program') distribution_plan = DeliveryFactory(programme=self.programme, track=True, location='someLocation') item_one = ItemFactory(description='desc_one', material_code='code_one') item_two = ItemFactory(description='desc_two', material_code='code_two') item_three = ItemFactory(description='desc_three', material_code='code_three') po_item_one = PurchaseOrderItemFactory(quantity=100, value=1000, item=item_one) po_item_two = PurchaseOrderItemFactory(quantity=100, value=1000, item=item_two) po_item_three = PurchaseOrderItemFactory(quantity=100, value=1000, item=item_three) end_user_node_one = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=6, location='someLocation', distribution_plan=distribution_plan, item=po_item_one, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_RECEIVED'] ) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['QUALITY_OF_PRODUCT'], value=options['DAMAGED'] ) NumericAnswerFactory( run=RunFactory(runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['AMOUNT_RECEIVED'], value=4 ) self.ip = ConsigneeFactory() self.today = FakeDate.today() self.end_user_node_two = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=9, location='someLocation', track=True, item=po_item_two, distribution_plan=distribution_plan) MultipleChoiceAnswerFactory( run=RunFactory(runnable=self.end_user_node_two, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) end_user_node_three = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=10, item=po_item_three, location='someLocation', distribution_plan=distribution_plan, ip=self.ip, track=True, consignee=self.ip, delivery_date=self.today + datetime.timedelta(days=3)) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_three, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) end_user_node_four = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=40, item=po_item_one, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_four, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) end_user_node_five = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, quantity=50, item=po_item_one, track=True) MultipleChoiceAnswerFactory( run=RunFactory(runnable=end_user_node_five, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED'] ) non_response_node = DeliveryNodeFactory(tree_position=DeliveryNode.END_USER, track=True, quantity=60, item=po_item_one) RunFactory(runnable=non_response_node, status=Run.STATUS.scheduled)
delivery_42 = DistributionPlan.objects.create( programme=programme_1, location="Oyam", consignee=consignee_38, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh", ) delivery_43 = DistributionPlan.objects.create( programme=programme_3, location="Bukomansimbi", consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah", ) delivery_44 = DistributionPlan.objects.create( programme=programme_1, location="Bukomansimbi", consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah", ) delivery_45 = DistributionPlan.objects.create( programme=programme_3, location="Kaabong", consignee=consignee_6,
from eums.models import DistributionPlan from eums.client.test.functional.fixtures.mapdata_consignees import * from eums.client.test.functional.fixtures.mapdata_programmes import * from eums.test.helpers.fake_datetime import FakeDate delivery_37 = DistributionPlan.objects.create(programme=programme_3, location="Amur", consignee=consignee_1, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date="2014-10-14", remark="hh") delivery_38 = DistributionPlan.objects.create(programme=programme_1, location="PADER", consignee=consignee_10, contact_person_id="5420508290cc38715b1af928", track=False, delivery_date="2014-10-06", remark="SAFE Programme") delivery_39 = DistributionPlan.objects.create(programme=programme_1, location="bundibugyo", consignee=consignee_21, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date="2014-10-01", remark="Mother and Child") delivery_40 = DistributionPlan.objects.create(programme=programme_4, location="Bukomansimbi", consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date="2014-10-14", remark="hh") delivery_41 = DistributionPlan.objects.create(programme=programme_3, location="Bukomansimbi", consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date="2014-06-10", remark="blah blah") delivery_42 = DistributionPlan.objects.create(programme=programme_1, location="Oyam", consignee=consignee_38, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date="2014-10-14", remark="hh") delivery_43 = DistributionPlan.objects.create(programme=programme_3, location="Bukomansimbi", consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_44 = DistributionPlan.objects.create(programme=programme_1, location="Bukomansimbi", consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_45 = DistributionPlan.objects.create(programme=programme_3, location="Kaabong", consignee=consignee_6, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_46 = DistributionPlan.objects.create(programme=programme_1, location="Kaabong", consignee=consignee_1, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_47 = DistributionPlan.objects.create(programme=programme_1, location="Kaabong", consignee=consignee_1, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah")
from eums.client.test.functional.fixtures.mapdata_release_order_items import ro_item_436 from eums.models import DistributionPlanNode, DeliveryNodeLoss from eums.test.helpers.fake_datetime import FakeDate wakiso = Consignee.objects.get(name='WAKISO DHO') node_2 = DistributionPlanNode.objects.create( distribution_plan=delivery_41, quantity=5000, tree_position="END_USER", item=po_item_1, location="PADER", consignee=consignee_10, contact_person_id="5420508290cc38715b1af928", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="SAFE Programme") node_3 = DistributionPlanNode.objects.create( distribution_plan=delivery_42, quantity=5, tree_position="END_USER", item=po_item_1, location="bundibugyo", consignee=consignee_21, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 1), remark="Mother and Child") node_4 = DistributionPlanNode.objects.create( distribution_plan=delivery_42, parents=[(node_3, 5)],
from eums.client.test.functional.fixtures.mapdata_purchase_order import * from eums.client.test.functional.fixtures.mapdata_consignees import * from eums.client.test.functional.fixtures.mapdata_sales_order import * from eums.models import ReleaseOrder from eums.test.helpers.fake_datetime import FakeDate ro_1 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72082647, consignee=consignee_1, purchase_order=po_106, order_number=54102852, delivery_date=FakeDate.build(2014, 8, 19)) ro_2 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72089797, consignee=consignee_44, purchase_order=po_106, order_number=54109789, delivery_date=FakeDate.build(2014, 11, 6)) ro_3 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72088441, consignee=consignee_38, purchase_order=po_106, order_number=54110379, delivery_date=FakeDate.build(2014, 10, 23)) ro_4 = ReleaseOrder.objects.create(sales_order=sales_order_105, waybill=72090975, consignee=consignee_44, purchase_order=po_106, order_number=54112876, delivery_date=FakeDate.build(2014, 11, 18)) ro_5 = ReleaseOrder.objects.create(sales_order=sales_order_105,
from eums.client.test.functional.fixtures.mapdata_deliveries import * from eums.client.test.functional.fixtures.mapdata_purchase_order_items import * from eums.client.test.functional.fixtures.mapdata_release_order_items import ro_item_436 from eums.models import DistributionPlanNode, DeliveryNodeLoss from eums.test.helpers.fake_datetime import FakeDate wakiso = Consignee.objects.get(name='WAKISO DHO') node_2 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, quantity=5000, tree_position="END_USER", item=po_item_1, location="PADER",consignee=consignee_10, contact_person_id="5420508290cc38715b1af928", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="SAFE Programme") node_3 = DistributionPlanNode.objects.create(distribution_plan=delivery_42, quantity=5, tree_position="END_USER", item=po_item_1, location="bundibugyo", consignee=consignee_21, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 1), remark="Mother and Child") node_4 = DistributionPlanNode.objects.create(distribution_plan=delivery_42, parents=[(node_3, 5)], tree_position="END_USER", item=po_item_1, location="Amuru", consignee=consignee_3, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") node_5 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 100)], tree_position="END_USER", item=po_item_3, location="Bukomansimbi", consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") node_6 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 30)], tree_position="END_USER", item=po_item_3, location="Bukomansimbi", consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="blah blah") node_7 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 30)], tree_position="END_USER", item=po_item_3, location="Oyam", consignee=consignee_38, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") node_8 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 10)], tree_position="END_USER", item=po_item_3, location="WAKISO", consignee=consignee_1, contact_person_id="542126831a8a4f1e4337edb2", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="Safe Programme") node_9 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 10)], tree_position="END_USER", item=po_item_3, location="Ntungamo", consignee=consignee_7, contact_person_id="542126831a8a4f1e4337edb2", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="Safe Programme") node_10 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 30)], tree_position="END_USER", item=po_item_3, location="Agago", consignee=consignee_8, contact_person_id="542126831a8a4f1e4337edb2", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="Safe Programme") node_11 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 20)], tree_position="END_USER", item=po_item_3, location="AMURU", consignee=consignee_9, contact_person_id="54212a70797221e84ac993fc", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="Safe Programme") node_12 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 150)], tree_position="END_USER", item=po_item_3, location="kitgum", consignee=consignee_11, contact_person_id="54212a70797221e84ac993fc", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="Safe ") node_13 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 1)], tree_position="END_USER", item=po_item_13, location="bundibugyo", consignee=consignee_21, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 1), remark="Mother and Child") node_14 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 5)], tree_position="END_USER", item=po_item_1, location="buikwe", consignee=consignee_15, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") node_15 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 5)], tree_position="END_USER", item=po_item_1, location="kalungu", consignee=consignee_17, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") node_16 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 1)], tree_position="END_USER", item=po_item_14, location="Wakiso", consignee=consignee_1, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 9, 22), remark="Mother and child") node_17 = DistributionPlanNode.objects.create(distribution_plan=delivery_41, parents=[(node_2, 1)], tree_position="END_USER", item=po_item_13, location="mubende", consignee=consignee_19, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 9, 22), remark="Mother and child") node_18 = DistributionPlanNode.objects.create(distribution_plan=delivery_39, quantity=5, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") node_19 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=3, tree_position="END_USER", item=po_item_2, location="Bukomansimbi",consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="blah blah") node_20 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=3, tree_position="END_USER", item=po_item_2, location="Bukomansimbi",consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="blah blah") node_21 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=4, tree_position="END_USER", item=po_item_2, location="Kalungu",consignee=consignee_36, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date=FakeDate.build(2014, 9, 22), remark="heoo") node_22 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=2, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="hfhf") node_23 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=0, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="hdh") node_24 = DistributionPlanNode.objects.create(distribution_plan=delivery_38, quantity=2, tree_position="END_USER", item=po_item_1, location="Bukomansimbi",consignee=consignee_33, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="hfhf")
def setup_responses(self): DeliveryNode.objects.all().delete() MultipleChoiceQuestion.objects.all().delete() from eums.fixtures.end_user_questions import seed_questions questions, options = seed_questions() self.programme = ProgrammeFactory(name='my-program') distribution_plan = DeliveryFactory(programme=self.programme, track=True, location='someLocation') item_one = ItemFactory(description='desc_one', material_code='code_one') item_two = ItemFactory(description='desc_two', material_code='code_two') item_three = ItemFactory(description='desc_three', material_code='code_three') po_item_one = PurchaseOrderItemFactory(quantity=100, value=1000, item=item_one) po_item_two = PurchaseOrderItemFactory(quantity=100, value=1000, item=item_two) po_item_three = PurchaseOrderItemFactory(quantity=100, value=1000, item=item_three) end_user_node_one = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=6, location='someLocation', distribution_plan=distribution_plan, item=po_item_one) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_RECEIVED']) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['QUALITY_OF_PRODUCT'], value=options['DAMAGED']) NumericAnswerFactory(run=RunFactory(runnable=end_user_node_one, status=Run.STATUS.scheduled), question=questions['AMOUNT_RECEIVED'], value=4) self.ip = ConsigneeFactory() self.today = FakeDate.today() self.end_user_node_two = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=9, location='someLocation', item=po_item_two, distribution_plan=distribution_plan) MultipleChoiceAnswerFactory(run=RunFactory( runnable=self.end_user_node_two, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) end_user_node_three = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=10, item=po_item_three, location='someLocation', distribution_plan=distribution_plan, ip=self.ip, consignee=self.ip, delivery_date=self.today + datetime.timedelta(days=3)) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_three, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) end_user_node_four = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=40, item=po_item_one) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_four, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) end_user_node_five = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, quantity=50, item=po_item_one) MultipleChoiceAnswerFactory(run=RunFactory( runnable=end_user_node_five, status=Run.STATUS.scheduled), question=questions['WAS_PRODUCT_RECEIVED'], value=options['PRODUCT_WAS_NOT_RECEIVED']) non_response_node = DeliveryNodeFactory( tree_position=DeliveryNode.END_USER, track=True, quantity=60, item=po_item_one) RunFactory(runnable=non_response_node, status=Run.STATUS.scheduled)
import datetime from eums.models import DistributionPlan from eums.client.test.functional.fixtures.mapdata_consignees import * from eums.client.test.functional.fixtures.mapdata_programmes import * from eums.test.helpers.fake_datetime import FakeDate delivery_37 = DistributionPlan.objects.create(programme=programme_3, location="Amur", consignee=consignee_1, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") delivery_38 = DistributionPlan.objects.create(programme=programme_1, location="PADER", consignee=consignee_10, contact_person_id="5420508290cc38715b1af928", track=False, delivery_date=FakeDate.build(2014, 10, 6), remark="SAFE Programme") delivery_39 = DistributionPlan.objects.create(programme=programme_1, location="bundibugyo", consignee=consignee_21, contact_person_id="54213ccc797221e84ac993fe", track=False, delivery_date=FakeDate.build(2014, 10, 1), remark="Mother and Child") delivery_40 = DistributionPlan.objects.create(programme=programme_4, location="Bukomansimbi", consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") delivery_41 = DistributionPlan.objects.create(programme=programme_3, location="Bukomansimbi", consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2014, 6, 10), remark="blah blah") delivery_42 = DistributionPlan.objects.create(programme=programme_1, location="Oyam", consignee=consignee_38, contact_person_id="5422bf5999f3eb0000a46ae6", track=False, delivery_date=FakeDate.build(2014, 10, 14), remark="hh") delivery_43 = DistributionPlan.objects.create(programme=programme_3, location="Bukomansimbi", consignee=consignee_32, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_44 = DistributionPlan.objects.create(programme=programme_1, location="Bukomansimbi", consignee=consignee_33, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_45 = DistributionPlan.objects.create(programme=programme_3, location="Kaabong", consignee=consignee_6, contact_person_id="542bfa5108453c32ffd4cade", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_46 = DistributionPlan.objects.create(programme=programme_1, location="Kaabong", consignee=consignee_1, contact_person_id="559281d40c42914aad3d6006", track=True, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah") delivery_47 = DistributionPlan.objects.create(programme=programme_1, location="Kaabong", consignee=consignee_1, contact_person_id="542bfa5108453c32ffd4cade", track=False, delivery_date=FakeDate.build(2015, 07, 11), remark="blah blah")