Exemplo n.º 1
0
 def setUp(self):
     locations_testing.create_workshops_sections_and_cells()
     sows_testing.create_statuses()
     piglets_testing.create_piglets_statuses()
     self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(1)
     self.ws3_cells = Location.objects.filter(
         sowAndPigletsCell__isnull=False)
Exemplo n.º 2
0
    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
        }
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        piglets_testing.create_piglets_statuses()

        self.loc_ws_5 = Location.objects.get(workshop__number=5)
        self.loc_ws_6 = Location.objects.get(workshop__number=6)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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'})
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        piglets_testing.create_piglets_statuses()

        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(
            week_number=1)
        self.loc_ws3 = Location.objects.get(workshop__number=3)
        self.loc_ws4 = Location.objects.get(workshop__number=4)
        self.loc_ws5_cells = Location.objects.filter(
            pigletsGroupCell__workshop__number=5)

        self.piglets = piglets_testing.create_new_group_with_metatour_by_one_tour(
            self.tour1, self.loc_ws3, 101)
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
    def setUp(self):
        self.client = APIClient()
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        sows_testing.create_boars()
        staff_testing.create_svinbin_users()
        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(week_number=1)

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws2 = Location.objects.get(workshop__number=2)

        self.brig1 = User.objects.get(username='******')
        self.brig2 = User.objects.get(username='******')
        self.brig3 = User.objects.get(username='******')
Exemplo n.º 12
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        # sows_testing.create_statuses()
        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)
Exemplo n.º 13
0
    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='******')
Exemplo n.º 14
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        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.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)
        self.piglets.gilts_quantity = 10
        self.piglets.save()

        self.piglets2 = piglets_testing.create_new_group_with_metatour_by_one_tour(
            self.tour2, self.loc_ws3, 232)
Exemplo n.º 15
0
    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)
Exemplo n.º 16
0
    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)
Exemplo n.º 17
0
    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)
Exemplo n.º 18
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        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_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_ws7 = Location.objects.get(workshop__number=7)
Exemplo n.º 19
0
    def setUp(self):
        self.client = APIClient()
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        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.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_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]
Exemplo n.º 20
0
    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='******')
Exemplo n.º 21
0
    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)
Exemplo n.º 22
0
    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)
Exemplo n.º 23
0
    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='******')
Exemplo n.º 24
0
    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
        }
Exemplo n.º 25
0
 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()
Exemplo n.º 26
0
 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()
Exemplo n.º 27
0
 def setUp(self):
     locations_testing.create_workshops_sections_and_cells()
     sows_testing.create_statuses()
     sows_events_testing.create_types()
Exemplo n.º 28
0
    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)))
Exemplo n.º 29
0
    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)
Exemplo n.º 30
0
 def setUp(self):
     self.client = APIClient()
     locations_testing.create_workshops_sections_and_cells()
     sows_testing.create_statuses()
     piglets_testing.create_piglets_statuses()