@molochko-dev/data 1.4.23 → 1.4.25

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.
@@ -117,7 +117,25 @@ class AnimalForEventFilter {
117
117
  return this.abortFilter();
118
118
  }
119
119
  pozSuhostoiFilter() {
120
- return this.abortFilter();
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;
121
139
  }
122
140
  filter() {
123
141
  switch (this.eventType) {
@@ -135,6 +153,8 @@ class AnimalForEventFilter {
135
153
  return this.suhostoiFilter();
136
154
  case enums_1.EVENT_TYPES_ENUM.pozSuhostoi:
137
155
  return this.pozSuhostoiFilter();
156
+ case enums_1.EVENT_TYPES_ENUM.perevod:
157
+ return this.animals;
138
158
  default:
139
159
  throw new Error(`AnimalForEventFilter.filter.${this.eventType} not implemented`);
140
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molochko-dev/data",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "typings/index.d.ts",
@@ -135,7 +135,26 @@ export class AnimalForEventFilter {
135
135
  }
136
136
 
137
137
  pozSuhostoiFilter () {
138
- return this.abortFilter()
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
139
158
  }
140
159
 
141
160
  filter () {
@@ -154,6 +173,8 @@ export class AnimalForEventFilter {
154
173
  return this.suhostoiFilter()
155
174
  case EVENT_TYPES_ENUM.pozSuhostoi:
156
175
  return this.pozSuhostoiFilter()
176
+ case EVENT_TYPES_ENUM.perevod:
177
+ return this.animals
157
178
  default:
158
179
  throw new Error(`AnimalForEventFilter.filter.${this.eventType} not implemented`)
159
180
  }