def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_events_testing.create_types() piglets_testing.create_piglets_statuses() 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.tour3 = Tour.objects.get_or_create_by_week_in_current_year( week_number=3) self.tour4 = Tour.objects.get_or_create_by_week_in_current_year( week_number=4) self.loc_ws3 = Location.objects.get(workshop__number=3) self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3, section__number=1) self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3, section__number=2) self.loc_ws3_sec1_cell1 = Location.objects.get( sowAndPigletsCell__number=1, sowAndPigletsCell__section__number=1) self.loc_ws3_sec1_cell2 = Location.objects.get( sowAndPigletsCell__number=2, sowAndPigletsCell__section__number=1) self.loc_ws3_sec1_cell3 = Location.objects.get( sowAndPigletsCell__number=3, sowAndPigletsCell__section__number=1)
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses() sows_events_testings.create_types() self.user = staff_testing.create_employee() self.client.force_authenticate(user=self.user) 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_ws3 = Location.objects.get(workshop__number=3) self.loc_ws3_cells = Location.objects.filter( sowAndPigletsCell__isnull=False) self.ops_dict = gen_operations_dict() operations = dict() for op_key in self.ops_dict.keys(): operations[op_key] = False self.request_json = { 'operations': operations, 'filters': { 'start_date': None, 'end_date': None, 'farm_id': None }, 'target': None }
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testings.create_statuses() sows_events_testings.create_types() piglets_testing.create_piglets_statuses() start_date = date(2020, 1, 1) end_date = timezone.now().date() + timedelta(1) ReportDate.objects.create_bulk_if_none_from_range(start_date, end_date) 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_ws3 = Location.objects.get(workshop__number=3) self.loc_ws4 = Location.objects.get(workshop__number=4) self.loc_ws8 = Location.objects.get(workshop__number=8) self.ws3_locs = Location.objects.all().get_workshop_location_by_number( workshop_number=3) self.ws4_locs = Location.objects.all().get_workshop_location_by_number( workshop_number=4) self.loc_ws3_cells = Location.objects.filter( sowAndPigletsCell__isnull=False) self.loc_ws4_cells = Location.objects.filter( pigletsGroupCell__isnull=False)
def get(self, request, format=None): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses() staff_testing.create_svinbin_users() sows_testing.create_boars() sows_events_testing.create_types() return Response({'msg': 'success'})
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_events_testing.create_types() piglets_testing.create_piglets_statuses() 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)
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_testing.create_boars() sows_events_testing.create_types() piglets_testing.create_piglets_statuses() staff_testing.create_svinbin_users() self.user = staff_testing.create_employee() self.brig3 = User.objects.get(username='******') self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(1)
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_events_testing.create_types() piglets_testing.create_piglets_statuses() self.user = staff_testing.create_employee() self.client.force_authenticate(user=self.user) 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.tour3 = Tour.objects.get_or_create_by_week_in_current_year( week_number=3) self.loc_ws3 = Location.objects.get(workshop__number=3) self.piglets = piglets_testing.create_new_group_with_metatour_by_one_tour( self.tour1, self.loc_ws3, 101) location1 = Location.objects.filter( sowAndPigletsCell__number=1).first() sow1 = sows_testing.create_sow_with_semination_usound( location=location1, week=1) location2 = Location.objects.filter( sowAndPigletsCell__number=2).first() sow2 = sows_testing.create_sow_with_semination_usound( location=location2, week=1) location3 = Location.objects.filter( sowAndPigletsCell__number=3).first() sow3 = sows_testing.create_sow_with_semination_usound( location=location3, week=1) SowFarrow.objects.create_sow_farrow(sow=sow1, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow2, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow3, alive_quantity=10) location8 = Location.objects.filter( pigletsGroupCell__isnull=False).first() Piglets.objects.init_piglets_by_farrow_date('2020-01-01', location8, 20) location9 = Location.objects.filter(pigletsGroupCell__isnull=False)[1] Piglets.objects.init_piglets_by_farrow_date('2020-01-02', location9, 21) location10 = Location.objects.filter( pigletsGroupCell__section__number=2).first() Piglets.objects.init_piglets_by_farrow_date('2020-01-02', location10, 53)
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_testing.create_boars() sows_events_testing.create_types() staff_testing.create_svinbin_users() self.boar = Boar.objects.all().first() self.user = staff_testing.create_employee() # is_seminator = True self.brig1 = User.objects.get(username='******') self.brig2 = User.objects.get(username='******') self.brig3 = User.objects.get(username='******') self.brig4 = User.objects.get(username='******') self.brig5 = User.objects.get(username='******')
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses() sows_events_testings.create_types() self.user = staff_testing.create_employee() self.client.force_authenticate(user=self.user) 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.tour3 = Tour.objects.get_or_create_by_week_in_current_year( week_number=3)
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testings.create_statuses() sows_events_testings.create_types() piglets_testing.create_piglets_statuses() start_date = date(2020, 1, 1) end_date = timezone.now().date() + timedelta(1) ReportDate.objects.create_bulk_if_none_from_range(start_date, end_date) 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_ws1 = Location.objects.get(workshop__number=1) self.loc_ws3 = Location.objects.get(workshop__number=3)
def setUp(self): locations_testing.create_workshops_sections_and_cells() pigs_testings.create_statuses() sows_events_testing.create_types() piglets_testing.create_piglets_statuses() 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.tour3 = Tour.objects.get_or_create_by_week_in_current_year( week_number=3) self.loc_ws4 = Location.objects.get(workshop__number=4) self.loc_ws5_cells = Location.objects.filter( pigletsGroupCell__workshop__number=5) self.loc_ws3_cells = Location.objects.filter( sowAndPigletsCell__workshop__number=3)
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses() sows_events_testings.create_types() staff_testing.create_svinbin_users() 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.tour3 = Tour.objects.get_or_create_by_week_in_current_year(week_number=3) self.tour4 = Tour.objects.get_or_create_by_week_in_current_year(week_number=4) self.loc_ws1 = Location.objects.get(workshop__number=1) self.loc_ws2 = Location.objects.get(workshop__number=2) self.loc_ws3 = Location.objects.get(workshop__number=3) self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3, section__number=1) self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3, section__number=2) self.loc_ws4 = Location.objects.get(workshop__number=4) self.loc_ws4_cell1 = Location.objects.filter(pigletsGroupCell__isnull=False)[0] self.loc_ws4_cell2 = Location.objects.filter(pigletsGroupCell__isnull=False)[1] self.loc_ws8 = Location.objects.get(workshop__number=8) self.loc_ws5 = Location.objects.get(workshop__number=5) self.loc_ws6 = Location.objects.get(workshop__number=6) self.loc_ws7 = Location.objects.get(workshop__number=7) # self.user = staff_testing.create_employee() # self.client.force_authenticate(user=self.user) self.brig1 = staff_testing.create_employee(workshop=self.loc_ws1.workshop) self.brig2 = staff_testing.create_employee(workshop=self.loc_ws2.workshop) self.brig3 = staff_testing.create_employee(workshop=self.loc_ws3.workshop) self.brig4 = staff_testing.create_employee(workshop=self.loc_ws4.workshop) self.brig5 = staff_testing.create_employee(workshop=self.loc_ws5.workshop) self.brig6 = staff_testing.create_employee(workshop=self.loc_ws6.workshop) self.brig7 = staff_testing.create_employee(workshop=self.loc_ws7.workshop) self.brig8 = staff_testing.create_employee(workshop=self.loc_ws8.workshop) self.admin = User.objects.get(username='******')
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() piglets_testing.create_piglets_statuses() sows_events_testings.create_types() self.user = staff_testing.create_employee() self.client.force_authenticate(user=self.user) 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) self.loc_ws5_cells = Location.objects.filter( pigletsGroupCell__workshop__number=5) self.loc_ws3_cells = Location.objects.filter( sowAndPigletsCell__workshop__number=3)
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_events_testings.create_types() piglets_testing.create_piglets_statuses() staff_testing.create_svinbin_users() self.client = APIClient() self.user = staff_testing.create_employee() self.brig1 = User.objects.get(username='******') self.brig2 = User.objects.get(username='******') self.brig3 = User.objects.get(username='******') self.brig4 = User.objects.get(username='******') self.brig5 = User.objects.get(username='******') self.loc_ws1 = Location.objects.get(workshop__number=1) self.loc_ws2 = Location.objects.get(workshop__number=2) self.loc_ws3 = Location.objects.get(workshop__number=3) self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3, section__number=1) self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3, section__number=2)
def setUp(self): self.client = APIClient() locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_testing.create_boars() sows_events_testing.create_types() piglets_testing.create_piglets_statuses() staff_testing.create_svinbin_users() self.user = staff_testing.create_employee() self.boar = Boar.objects.all().first() 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.tour3 = Tour.objects.get_or_create_by_week_in_current_year(week_number=3) self.tour4 = Tour.objects.get_or_create_by_week_in_current_year(week_number=4) self.loc_ws1 = Location.objects.get(workshop__number=1) self.loc_ws2 = Location.objects.get(workshop__number=2) self.loc_ws3 = Location.objects.get(workshop__number=3) self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3, section__number=1) self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3, section__number=2) self.loc_ws4 = Location.objects.get(workshop__number=4) self.loc_ws4_cell1 = Location.objects.filter(pigletsGroupCell__isnull=False)[0] self.loc_ws4_cell2 = Location.objects.filter(pigletsGroupCell__isnull=False)[1] self.loc_ws8 = Location.objects.get(workshop__number=8) self.loc_ws5 = Location.objects.get(workshop__number=5) self.loc_ws6 = Location.objects.get(workshop__number=6) self.loc_ws7 = Location.objects.get(workshop__number=7) self.brig1 = User.objects.get(username='******') self.brig2 = User.objects.get(username='******') self.brig3 = User.objects.get(username='******') self.brig4 = User.objects.get(username='******') self.brig5 = User.objects.get(username='******')
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testings.create_statuses() sows_events_testings.create_types() piglets_testing.create_piglets_statuses() staff_testings.create_svinbin_users() start_date = date(2020, 1, 1) end_date = timezone.now().date() + timedelta(1) ReportDate.objects.create_bulk_if_none_from_range(start_date, end_date) 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_ws1 = Location.objects.get(workshop__number=1) self.loc_ws3 = Location.objects.get(workshop__number=3) self.loc_ws3_cells = Location.objects.filter( sowAndPigletsCell__isnull=False) self.ops_dict = gen_operations_dict() operations = dict() for op_key in self.ops_dict.keys(): operations[op_key] = False self.request_json = { 'operations': operations, 'filters': { 'start_date': None, 'end_date': None, 'farm_id': None }, 'target': None }
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_events_testings.create_types() piglets_testing.create_piglets_statuses() staff_testing.create_svinbin_users()
def setUp(self): locations_testing.create_workshops_sections_and_cells() sows_testing.create_statuses() sows_events_testing.create_types()
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) location1 = Location.objects.filter( sowAndPigletsCell__number=1).first() sow1 = sows_testing.create_sow_with_semination_usound( location=location1, week=1) location2 = Location.objects.filter( sowAndPigletsCell__number=2).first() sow2 = sows_testing.create_sow_with_semination_usound( location=location2, week=1) location3 = Location.objects.filter( sowAndPigletsCell__number=3).first() sow3 = sows_testing.create_sow_with_semination_usound( location=location3, week=2) location4 = Location.objects.filter( sowAndPigletsCell__number=4).first() sow4 = sows_testing.create_sow_with_semination_usound( location=location4, week=2) location5 = Location.objects.filter( sowAndPigletsCell__number=5).first() sow5 = sows_testing.create_sow_with_semination_usound( location=location5, week=3) location6 = Location.objects.filter( sowAndPigletsCell__number=6).first() sow6 = sows_testing.create_sow_with_semination_usound( location=location6, week=4) location7 = Location.objects.filter( sowAndPigletsCell__number=7).first() sow7 = sows_testing.create_sow_with_semination_usound( location=location7, week=5) SowFarrow.objects.create_sow_farrow(sow=sow1, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow2, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow3, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow4, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow5, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow6, alive_quantity=10) SowFarrow.objects.create_sow_farrow(sow=sow7, alive_quantity=10) piglets3_7 = location7.piglets.all().first() piglets3_7.deactivate() location8 = Location.objects.filter( pigletsGroupCell__isnull=False).first() Piglets.objects.init_piglets_by_farrow_date('2020-01-01', location8, 20) location9 = Location.objects.filter(pigletsGroupCell__isnull=False)[1] Piglets.objects.init_piglets_by_farrow_date('2020-01-02', location9, 21) location10 = Location.objects.filter( pigletsGroupCell__section__number=2).first() Piglets.objects.init_piglets_by_farrow_date('2020-01-02', location10, 53)
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): 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)