@molochko-dev/data 1.4.22 → 1.4.24

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.
@@ -13,5 +13,6 @@ export declare class AnimalForEventFilter {
13
13
  otelFilter(): IAnimal[];
14
14
  recheckFilter(): IAnimal[];
15
15
  suhostoiFilter(): IAnimal[];
16
+ pozSuhostoiFilter(): IAnimal[];
16
17
  filter(): IAnimal[];
17
18
  }
@@ -116,6 +116,27 @@ class AnimalForEventFilter {
116
116
  suhostoiFilter() {
117
117
  return this.abortFilter();
118
118
  }
119
+ pozSuhostoiFilter() {
120
+ const result = [];
121
+ this.animals.forEach(animal => {
122
+ let genderOk = false;
123
+ let statusOk = false;
124
+ let ageOk = false;
125
+ if (this.genderFilter(animal, enums_1.ANIMAL_GENDER_ENUM.cow)) {
126
+ genderOk = true;
127
+ }
128
+ if (this.statusFilter(animal, [status.dry])) {
129
+ statusOk = true;
130
+ }
131
+ if (this.ageFilter(animal, defaultCowAge)) {
132
+ ageOk = true;
133
+ }
134
+ if (genderOk && statusOk && ageOk) {
135
+ result.push(animal);
136
+ }
137
+ });
138
+ return result;
139
+ }
119
140
  filter() {
120
141
  switch (this.eventType) {
121
142
  case enums_1.EVENT_TYPES_ENUM.abort:
@@ -130,6 +151,8 @@ class AnimalForEventFilter {
130
151
  return this.recheckFilter();
131
152
  case enums_1.EVENT_TYPES_ENUM.suhostoi:
132
153
  return this.suhostoiFilter();
154
+ case enums_1.EVENT_TYPES_ENUM.pozSuhostoi:
155
+ return this.pozSuhostoiFilter();
133
156
  default:
134
157
  throw new Error(`AnimalForEventFilter.filter.${this.eventType} not implemented`);
135
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molochko-dev/data",
3
- "version": "1.4.22",
3
+ "version": "1.4.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "typings/index.d.ts",
@@ -134,6 +134,29 @@ export class AnimalForEventFilter {
134
134
  return this.abortFilter()
135
135
  }
136
136
 
137
+ pozSuhostoiFilter () {
138
+ const result: IAnimal[] = []
139
+ this.animals.forEach(animal => {
140
+ let genderOk = false
141
+ let statusOk = false
142
+ let ageOk = false
143
+
144
+ if (this.genderFilter(animal, ANIMAL_GENDER_ENUM.cow)) {
145
+ genderOk = true
146
+ }
147
+ if (this.statusFilter(animal, [status.dry])) {
148
+ statusOk = true
149
+ }
150
+ if (this.ageFilter(animal, defaultCowAge)) {
151
+ ageOk = true
152
+ }
153
+ if (genderOk && statusOk && ageOk) {
154
+ result.push(animal)
155
+ }
156
+ })
157
+ return result
158
+ }
159
+
137
160
  filter () {
138
161
  switch (this.eventType) {
139
162
  case EVENT_TYPES_ENUM.abort:
@@ -148,6 +171,8 @@ export class AnimalForEventFilter {
148
171
  return this.recheckFilter()
149
172
  case EVENT_TYPES_ENUM.suhostoi:
150
173
  return this.suhostoiFilter()
174
+ case EVENT_TYPES_ENUM.pozSuhostoi:
175
+ return this.pozSuhostoiFilter()
151
176
  default:
152
177
  throw new Error(`AnimalForEventFilter.filter.${this.eventType} not implemented`)
153
178
  }