def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses() sows_events_testing.create_types() self.ws3_cells = Location.objects.filter( sowAndPigletsCell__isnull=False) tour1 = Tour.objects.get_or_create_by_week_in_current_year(1) sow1 = sows_testing.create_sow_with_location( location=self.ws3_cells[0]) sow1.change_status_to('Супорос 35') sow2 = sows_testing.create_sow_with_location( location=self.ws3_cells[1]) sow2.change_status_to('Супорос 35') sow3 = sows_testing.create_sow_with_location( location=self.ws3_cells[2]) sow3.change_status_to('Супорос 35') sow4 = sows_testing.create_sow_with_location( location=self.ws3_cells[3]) sow4.change_status_to('Опоросилась') sow5 = sows_testing.create_sow_with_location( location=self.ws3_cells[4]) sow5.change_status_to('Кормилица') sow6 = sows_testing.create_sow_with_location( location=self.ws3_cells[50]) sow6.change_status_to('Кормилица') piglets1 = piglets_testing.create_new_group_with_metatour_by_one_tour( tour=tour1, location=self.ws3_cells[0], quantity=15, gilts_quantity=0, birthday=(datetime.today() - timedelta(days=1))) piglets2 = piglets_testing.create_new_group_with_metatour_by_one_tour( tour=tour1, location=self.ws3_cells[1], quantity=16, gilts_quantity=5, birthday=(datetime.today() - timedelta(days=5))) piglets3 = piglets_testing.create_new_group_with_metatour_by_one_tour( tour=tour1, location=self.ws3_cells[2], quantity=17, gilts_quantity=5, birthday=(datetime.today() - timedelta(days=8))) piglets4 = piglets_testing.create_new_group_with_metatour_by_one_tour( tour=tour1, location=self.ws3_cells[3], quantity=18, gilts_quantity=0, birthday=(datetime.today() - timedelta(days=20))) piglets5 = piglets_testing.create_new_group_with_metatour_by_one_tour( tour=tour1, location=self.ws3_cells[46], quantity=19, gilts_quantity=6, birthday=(datetime.today() - timedelta(days=30)))
def setUp(self): locaions_testing.create_workshops_sections_and_cells() sows_testings.create_statuses() sows_events_testings.create_types()
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses()
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_testing.create_boars() sows_events_testing.create_types() self.boar1 = Boar.objects.all().first()
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testings.create_statuses() sows_events_testings.create_types() piglets_testing.create_piglets_statuses() location_cell1 = Location.objects.filter( sowAndPigletsCell__section__number=1)[0] piglets1 = piglets_testing.create_from_sow_farrow_by_week( location=location_cell1, week=1) location_cell2 = Location.objects.filter( sowAndPigletsCell__section__number=1)[1] piglets2 = piglets_testing.create_from_sow_farrow_by_week( location=location_cell2, week=1) location_cell3 = Location.objects.filter( sowAndPigletsCell__section__number=1)[2] piglets3 = piglets_testing.create_from_sow_farrow_by_week( location=location_cell3, week=2) self.tour1 = Tour.objects.get_or_create_by_week_in_current_year( week_number=1) self.tour2 = Tour.objects.get_or_create_by_week_in_current_year( week_number=2) self.loc_ws4 = Location.objects.get(workshop__number=4) # piglets in ws piglets4 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour1, self.loc_ws4, 100) piglets5 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_ws4, 100) # piglets in pigletsCell in ws self.loc_cell_ws4_1 = Location.objects.filter( pigletsGroupCell__workshop__number=4)[0] piglets6 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_cell_ws4_1, 100) self.loc_cell_ws4_2 = Location.objects.filter( pigletsGroupCell__workshop__number=4)[1] piglets7 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_cell_ws4_2, 100) self.loc_cell_ws4_3 = Location.objects.filter( pigletsGroupCell__workshop__number=4)[2] piglets8 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_cell_ws4_3, 100) piglets8.deactivate() self.loc_cell_ws4_4 = Location.objects.filter( pigletsGroupCell__workshop__number=4)[3] piglets9 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_cell_ws4_4, 100) piglets9.deactivate() # piglets in section self.loc_section_ws4_1 = Location.objects.filter( section__workshop__number=4)[0] piglets10 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_section_ws4_1, 100) self.loc_ws5 = Location.objects.get(workshop__number=5) # piglets in ws piglets11 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour1, self.loc_ws5, 100) piglets12 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_ws5, 100) piglets13 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour1, self.loc_ws5, 100) piglets14 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_ws5, 50) self.loc_cell_ws5_1 = Location.objects.filter( pigletsGroupCell__workshop__number=5)[0] merged_piglets1 = PigletsMerger.objects.create_merger_return_group( parent_piglets=[piglets13, piglets14], new_location=self.loc_cell_ws5_1) piglets15 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour1, self.loc_ws5, 30) piglets16 = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour2, self.loc_ws5, 50) loc_cell_ws5_2 = Location.objects.filter( pigletsGroupCell__workshop__number=5)[1] merged_piglets2 = PigletsMerger.objects.create_merger_return_group( parent_piglets=[piglets15, piglets16], new_location=loc_cell_ws5_2)