Commit 3bf5a86b61841efc00f425c7d435a5ac34989533
Committed by
OrysiaDrabych
1 parent
28b9a3cd
Add rationale types to op_faker
Showing
2 changed files
with
24 additions
and
1 deletions
| @@ -24,6 +24,7 @@ class OP_Provider(BaseProvider): | @@ -24,6 +24,7 @@ class OP_Provider(BaseProvider): | ||
| 24 | classifications = __fake_data.classifications | 24 | classifications = __fake_data.classifications |
| 25 | cpvs = __fake_data.cpvs | 25 | cpvs = __fake_data.cpvs |
| 26 | items_base_data = __fake_data.items_base_data | 26 | items_base_data = __fake_data.items_base_data |
| 27 | + rationale_types = __fake_data.rationale_types | ||
| 27 | 28 | ||
| 28 | @classmethod | 29 | @classmethod |
| 29 | def randomize_nb_elements(self, number=10, le=60, ge=140): | 30 | def randomize_nb_elements(self, number=10, le=60, ge=140): |
| @@ -149,4 +150,16 @@ class OP_Provider(BaseProvider): | @@ -149,4 +150,16 @@ class OP_Provider(BaseProvider): | ||
| 149 | "description_ru": item_base_data["description_ru"], | 150 | "description_ru": item_base_data["description_ru"], |
| 150 | "description_en": item_base_data["description_en"] | 151 | "description_en": item_base_data["description_en"] |
| 151 | }) | 152 | }) |
| 152 | - return deepcopy(item) | ||
| 153 | + return deepcopy(item) | ||
| 154 | + | ||
| 155 | + @classmethod | ||
| 156 | + def rationaleTypes(self, amount=3): | ||
| 157 | + if amount >= len(self.rationale_types): | ||
| 158 | + return self.rationale_types | ||
| 159 | + result = [] | ||
| 160 | + for _ in range(amount): | ||
| 161 | + element = self.random_element(self.rationale_types) | ||
| 162 | + while element in result: | ||
| 163 | + element = self.random_element(self.rationale_types) | ||
| 164 | + result.append(element) | ||
| 165 | + return result |
| @@ -8033,5 +8033,15 @@ | @@ -8033,5 +8033,15 @@ | ||
| 8033 | "name": "набір" | 8033 | "name": "набір" |
| 8034 | } | 8034 | } |
| 8035 | } | 8035 | } |
| 8036 | + ], | ||
| 8037 | + "rationale_types": [ | ||
| 8038 | + "volumeCuts", | ||
| 8039 | + "itemPriceVariation", | ||
| 8040 | + "qualityImprovement", | ||
| 8041 | + "durationExtension", | ||
| 8042 | + "priceReduction", | ||
| 8043 | + "taxRate", | ||
| 8044 | + "thirdParty", | ||
| 8045 | + "fiscalYearExtension" | ||
| 8036 | ] | 8046 | ] |
| 8037 | } | 8047 | } |
Please
register
or
login
to post a comment