Commit df05866f7508460830be85f9d8da062e18a08e56

Authored by ivanka12
Committed by GitHub
2 parents e7ed94a8 8c314072

Merge pull request #80 from openprocurement/master

change generation of items.classification
@@ -26,6 +26,7 @@ class OP_Provider(BaseProvider): @@ -26,6 +26,7 @@ class OP_Provider(BaseProvider):
26 addresses = _fake_data.addresses 26 addresses = _fake_data.addresses
27 classifications = _fake_data.classifications 27 classifications = _fake_data.classifications
28 cpvs = _fake_data.cpvs 28 cpvs = _fake_data.cpvs
  29 + moz_cpvs = _fake_data.moz_cpvs
29 items_base_data = _fake_data.items_base_data 30 items_base_data = _fake_data.items_base_data
30 rationale_types = _fake_data.rationale_types 31 rationale_types = _fake_data.rationale_types
31 32
@@ -121,8 +122,11 @@ class OP_Provider(BaseProvider): @@ -121,8 +122,11 @@ class OP_Provider(BaseProvider):
121 in the beginning of each cpv id. 122 in the beginning of each cpv id.
122 """ 123 """
123 item_base_data = None 124 item_base_data = None
  125 + cpv = None
124 if cpv_group is None: 126 if cpv_group is None:
125 - item_base_data = self.random_element(self.items_base_data) 127 + cpv = self.random_element(self.cpvs)
  128 + elif cpv_group == 336:
  129 + cpv = self.random_element(self.moz_cpvs)
126 else: 130 else:
127 cpv_group = str(cpv_group) 131 cpv_group = str(cpv_group)
128 similar_cpvs = [] 132 similar_cpvs = []
@@ -130,12 +134,12 @@ class OP_Provider(BaseProvider): @@ -130,12 +134,12 @@ class OP_Provider(BaseProvider):
130 if cpv_element.startswith(cpv_group): 134 if cpv_element.startswith(cpv_group):
131 similar_cpvs.append(cpv_element) 135 similar_cpvs.append(cpv_element)
132 cpv = self.random_element(similar_cpvs) 136 cpv = self.random_element(similar_cpvs)
133 - for entity in self.items_base_data:  
134 - if entity["cpv_id"] == cpv:  
135 - item_base_data = entity  
136 - break  
137 - if not item_base_data:  
138 - raise ValueError('unable to find an item with CPV ' + cpv) 137 + for entity in self.items_base_data:
  138 + if entity["cpv_id"] == cpv:
  139 + item_base_data = entity
  140 + break
  141 + if not item_base_data:
  142 + raise ValueError('unable to find an item with CPV ' + cpv)
139 143
140 # choose appropriate additional classification for item_base_data's cpv 144 # choose appropriate additional classification for item_base_data's cpv
141 additional_class = [] 145 additional_class = []
@@ -7875,14 +7875,16 @@ @@ -7875,14 +7875,16 @@
7875 "30192130-1", 7875 "30192130-1",
7876 "30197600-2", 7876 "30197600-2",
7877 "30199000-0", 7877 "30199000-0",
  7878 + "99999999-9"
  7879 + ],
  7880 + "moz_cpvs": [
7878 "33615100-5", 7881 "33615100-5",
7879 "33622200-8", 7882 "33622200-8",
7880 "33632100-0", 7883 "33632100-0",
7881 "33612000-3", 7884 "33612000-3",
7882 "33692500-2", 7885 "33692500-2",
7883 "33692100-8", 7886 "33692100-8",
7884 - "33600000-6",  
7885 - "99999999-9" 7887 + "33600000-6"
7886 ], 7888 ],
7887 "items_base_data": [ 7889 "items_base_data": [
7888 { 7890 {
Please register or login to post a comment