Commit cda1d55981829789c923ea896413829d8bf77638

Authored by Playtenders
2 parents 1351b542 3facf555

add feature and milestone for create tender

... ... @@ -55,9 +55,22 @@ Resource playtender_tende
55 55 [Arguments] ${user} ${tender_data}
56 56 [Documentation] Створити тендер з початковими даними tender_data. Повернути uaid створеного тендера.
57 57
  58 +<<<<<<< HEAD
58 59 open new tender form
59 60 fill tender form ${tender_data['data']}
60 61 submit form and check result ${tender_form_submit_btn_locator} ${tender_form_submit_success_msg} ${tender_created_checker_element_locator}
61 62 wait until page does not contain element with reloading ${tender_sync_element_locator}
62 63 ${tender_uaid} = get text ${tender_uaid_text_locator}
63 64 [Return] ${tender_uaid}
  65 +=======
  66 + ${tender_prepared_data} = prepare tender data ${tender_data['data']}
  67 + log ${tender_prepared_data}
  68 +
  69 + config acceleration for new tender form ${tender_prepared_data}
  70 + open new tender form
  71 + fill tender form ${tender_prepared_data}
  72 + submit form and check result ${plan_form_submit_btn_locator} ${plan_form_submit_success_msg} ${plan_created_checker_element_locator}
  73 + wait until page does not contain element with reloading ${plan_sync_element_locator}
  74 + ${plan_uaid} = get text ${plan_uaid_text_locator}
  75 + [Return] ${plan_uaid}
  76 +>>>>>>> 3facf555e072d9d85d4bc44ada0c5c5280ea5820
... ...
... ... @@ -96,6 +96,56 @@ def isodate_format(isodate, format):
96 96 iso_dt = parse_date(isodate)
97 97 return iso_dt.strftime(format)
98 98
  99 +<<<<<<< HEAD
99 100 #Percentage conversion
100 101 def multiply_hundred(number):
101 102 return number*100
  103 +=======
  104 +
  105 +# prepares data for filling form in easiest way
  106 +def prepare_tender_data(data):
  107 + # check if data is for multilot
  108 + if 'lots' not in data:
  109 + return data
  110 +
  111 + # moves features to its related items
  112 + if 'features' in data:
  113 + for i, feature in enumerate(data['features']):
  114 + if feature['featureOf'] == 'lot':
  115 + for lot in data['lots']:
  116 + if lot['id'] == feature['relatedItem']:
  117 + if 'features' not in lot:
  118 + lot['features'] = []
  119 + lot['features'].append(data['features'].pop(i))
  120 + if feature['featureOf'] == 'item':
  121 + for item in data['items']:
  122 + if item['id'] == feature['relatedItem']:
  123 + if 'features' not in item:
  124 + item['features'] = []
  125 + item['features'].append(data['features'].pop(i))
  126 +
  127 + if len(data['features']) == 0:
  128 + del data['features']
  129 +
  130 + # moves items to its related lots
  131 + for i, item in enumerate(data['items']):
  132 + for lot in data['lots']:
  133 + if lot['id'] == item['relatedLot']:
  134 + if 'items' not in lot:
  135 + lot['items'] = []
  136 + lot['items'].append(data['items'].pop(i))
  137 +
  138 + del data['items']
  139 +
  140 + # moves milestones to its related lots
  141 + for i, milestone in enumerate(data['milestones']):
  142 + for lot in data['lots']:
  143 + if lot['id'] == milestone['relatedLot']:
  144 + if 'milestones' not in lot:
  145 + lot['milestones'] = []
  146 + lot['milestones'].append(data['milestones'].pop(i))
  147 +
  148 + del data['milestones']
  149 +
  150 + return data
  151 +>>>>>>> 3facf555e072d9d85d4bc44ada0c5c5280ea5820
... ...
Please register or login to post a comment