@molochko-dev/data 1.4.97 → 1.4.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molochko-dev/data",
3
- "version": "1.4.97",
3
+ "version": "1.4.99",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "typings/index.d.ts",
@@ -53,7 +53,7 @@ class AnimalEventFilter {
53
53
  fatnessFilter<T extends BaseAnimal>(animals: T[]): T[] {
54
54
  return animals;
55
55
  }
56
-
56
+ // TODO удалить
57
57
  osemenenieFilter<T extends BaseAnimal>(animals: T[]): T[] {
58
58
  const result = animals.filter((animal) => {
59
59
  const genderOk = this.genderFilter(animal, ANIMAL_GENDER_ENUM.cow);
@@ -72,6 +72,24 @@ class AnimalEventFilter {
72
72
  return result;
73
73
  }
74
74
 
75
+ breedingFilter<T extends BaseAnimal>(animals: T[]): T[] {
76
+ const result = animals.filter((animal) => {
77
+ const genderOk = this.genderFilter(animal, ANIMAL_GENDER_ENUM.cow);
78
+ const statusOk = this.statusFilter(animal, [
79
+ this.status.HEIFER,
80
+ this.status.BRED,
81
+ this.status.OPEN,
82
+ this.status.FRESH,
83
+ ]);
84
+ const ageOk = this.ageFilter(animal, this.defaultCowAge);
85
+ if (genderOk && statusOk && ageOk) {
86
+ return animal;
87
+ }
88
+ });
89
+
90
+ return result;
91
+ }
92
+
75
93
  otelFilter<T extends BaseAnimal>(animals: T[]): T[] {
76
94
  const result = animals.filter((animal) => {
77
95
  const genderOk = this.genderFilter(animal, ANIMAL_GENDER_ENUM.cow);
@@ -144,7 +162,7 @@ class AnimalEventFilter {
144
162
  case EVENT_TYPES_ENUM.neosem:
145
163
  return this.neosemFilter(animals);
146
164
  case EVENT_TYPES_ENUM.osemenenie:
147
- return this.osemenenieFilter(animals);
165
+ return this.breedingFilter(animals);
148
166
  case EVENT_TYPES_ENUM.otel:
149
167
  return this.otelFilter(animals);
150
168
  case EVENT_TYPES_ENUM.recheck:
@@ -89,7 +89,9 @@ export enum EVENT_TYPES_ENUM {
89
89
  otel = 'otel', // ОТЕЛ ----- addTocalendar
90
90
  recheck = 'recheck', // ПЕРЕПРОВЕРИТЬ * ----- addTocalendar
91
91
  ohota = 'ohota', // ОХОТА ----- addTocalendar
92
- osemenenie = 'osemenenie', // ОСЕМЕНЕНИЕ *
92
+ // TODO osemenenie - удалить
93
+ osemenenie = 'breeding', // ОСЕМЕНЕНИЕ *
94
+ breeding = 'breeding', // ОСЕМЕНЕНИЕ *
93
95
  stelnaya = 'stelnaya', // СТЕЛЬНАЯ
94
96
  yalovaya = 'yalovaya', // ЯЛОВАЯ (НЕ СТЕЛЬНАЯ) ----- addTocalendar
95
97
  stelneotpos = 'stelneotpos', // СТЕЛЬНАЯ НЕ ОТ ПОС ОСЕМЕНЕНИЯ ----- addTocalendar