Commit 4d58a5c2e0cc284fe70cdbe35b1497c48610aa04

Authored by Playtenders
2 parents f488d1eb 562acc22

Merge branch 'v3-dev' of https://git.4k.com.ua/root/playtender-robot_tests into v3-dev

Showing 1 changed file with 21 additions and 10 deletions
... ... @@ -198,9 +198,9 @@ def generate_dictionary_from_field_path_and_value(path, value):
198 198 return data
199 199
200 200
201   -#Percentage conversion
  201 +# Percentage conversion
202 202 def multiply_hundred(number):
203   - return number*100
  203 + return number * 100
204 204
205 205
206 206 # prepares data for filling form in easiest way
... ... @@ -211,30 +211,42 @@ def prepare_tender_data(data):
211 211
212 212 # moves features to its related items
213 213 if 'features' in data:
214   - for i, feature in enumerate(data['features']):
215   - if feature['featureOf'] == 'lot':
  214 + i = 0
  215 + l = len(data['features'])
  216 + while i < l:
  217 + if data['features'][i]['featureOf'] == 'lot':
216 218 for lot in data['lots']:
217   - if lot['id'] == feature['relatedItem']:
  219 + if lot['id'] == data['features'][i]['relatedItem']:
218 220 if 'features' not in lot:
219 221 lot['features'] = []
220 222 lot['features'].append(data['features'].pop(i))
221   - if feature['featureOf'] == 'item':
  223 + l = l - 1
  224 + i = i - 1
  225 + if data['features'][i]['featureOf'] == 'item':
222 226 for item in data['items']:
223   - if item['id'] == feature['relatedItem']:
  227 + if item['id'] == data['features'][i]['relatedItem']:
224 228 if 'features' not in item:
225 229 item['features'] = []
226 230 item['features'].append(data['features'].pop(i))
  231 + l = l - 1
  232 + i = i - 1
  233 + i = i + 1
227 234
228 235 if len(data['features']) == 0:
229 236 del data['features']
230 237
231 238 # moves items to its related lots
232   - for i, item in enumerate(data['items']):
  239 + i = 0
  240 + l = len(data['items'])
  241 + while i < l:
233 242 for lot in data['lots']:
234   - if lot['id'] == item['relatedLot']:
  243 + if lot['id'] == data['items'][i]['relatedLot']:
235 244 if 'items' not in lot:
236 245 lot['items'] = []
237 246 lot['items'].append(data['items'].pop(i))
  247 + l = l - 1
  248 + i = i - 1
  249 + i = i + 1
238 250
239 251 del data['items']
240 252
... ... @@ -254,4 +266,3 @@ def prepare_tender_data(data):
254 266 del data['milestones']
255 267
256 268 return data
257   -
... ...
Please register or login to post a comment