@molochko-dev/data 1.4.98 → 1.4.100

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.
@@ -39,6 +39,7 @@ class AnimalEventFilter {
39
39
  fatnessFilter(animals) {
40
40
  return animals;
41
41
  }
42
+ // TODO удалить
42
43
  osemenenieFilter(animals) {
43
44
  const result = animals.filter((animal) => {
44
45
  const genderOk = this.genderFilter(animal, enums_1.ANIMAL_GENDER_ENUM.cow);
@@ -55,6 +56,22 @@ class AnimalEventFilter {
55
56
  });
56
57
  return result;
57
58
  }
59
+ breedingFilter(animals) {
60
+ const result = animals.filter((animal) => {
61
+ const genderOk = this.genderFilter(animal, enums_1.ANIMAL_GENDER_ENUM.cow);
62
+ const statusOk = this.statusFilter(animal, [
63
+ this.status.HEIFER,
64
+ this.status.BRED,
65
+ this.status.OPEN,
66
+ this.status.FRESH,
67
+ ]);
68
+ const ageOk = this.ageFilter(animal, this.defaultCowAge);
69
+ if (genderOk && statusOk && ageOk) {
70
+ return animal;
71
+ }
72
+ });
73
+ return result;
74
+ }
58
75
  otelFilter(animals) {
59
76
  const result = animals.filter((animal) => {
60
77
  const genderOk = this.genderFilter(animal, enums_1.ANIMAL_GENDER_ENUM.cow);
@@ -116,7 +133,7 @@ class AnimalEventFilter {
116
133
  case enums_1.EVENT_TYPES_ENUM.neosem:
117
134
  return this.neosemFilter(animals);
118
135
  case enums_1.EVENT_TYPES_ENUM.osemenenie:
119
- return this.osemenenieFilter(animals);
136
+ return this.breedingFilter(animals);
120
137
  case enums_1.EVENT_TYPES_ENUM.otel:
121
138
  return this.otelFilter(animals);
122
139
  case enums_1.EVENT_TYPES_ENUM.recheck:
@@ -80,7 +80,8 @@ export declare enum EVENT_TYPES_ENUM {
80
80
  otel = "otel",
81
81
  recheck = "recheck",
82
82
  ohota = "ohota",
83
- osemenenie = "osemenenie",
83
+ osemenenie = "breeding",
84
+ breeding = "breeding",
84
85
  stelnaya = "stelnaya",
85
86
  yalovaya = "yalovaya",
86
87
  stelneotpos = "stelneotpos",
@@ -90,7 +90,9 @@ var EVENT_TYPES_ENUM;
90
90
  EVENT_TYPES_ENUM["otel"] = "otel";
91
91
  EVENT_TYPES_ENUM["recheck"] = "recheck";
92
92
  EVENT_TYPES_ENUM["ohota"] = "ohota";
93
- EVENT_TYPES_ENUM["osemenenie"] = "osemenenie";
93
+ // TODO osemenenie - удалить
94
+ EVENT_TYPES_ENUM["osemenenie"] = "breeding";
95
+ EVENT_TYPES_ENUM["breeding"] = "breeding";
94
96
  EVENT_TYPES_ENUM["stelnaya"] = "stelnaya";
95
97
  EVENT_TYPES_ENUM["yalovaya"] = "yalovaya";
96
98
  EVENT_TYPES_ENUM["stelneotpos"] = "stelneotpos";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molochko-dev/data",
3
- "version": "1.4.98",
3
+ "version": "1.4.100",
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