Commit 5bdd4d36020161463f031e89337ab6b452b0915e
1 parent
89f7227b
Use `mult_and_round` instead of `Evaluate` in keywords
Showing
2 changed files
with
8 additions
and
3 deletions
... | ... | @@ -270,8 +270,8 @@ Resource resource.robot |
270 | 270 | |
271 | 271 | Можливість змінити на ${percent} відсотки бюджет ${lot_index} лоту |
272 | 272 | ${percent}= Convert To Number ${percent} |
273 | - ${value}= Evaluate round(${USERS.users['${tender_owner}'].tender_data.data.lots[${lot_index}].value.amount} * ${percent} / ${100}, 2) | |
274 | - ${step_value}= Evaluate round(${USERS.users['${tender_owner}'].tender_data.data.lots[${lot_index}].minimalStep.amount} * ${percent} / ${100}, 2) | |
273 | + ${value}= mult_and_round ${USERS.users['${tender_owner}'].tender_data.data.lots[${lot_index}].value.amount} ${percent} ${1/100} precision=2 | |
274 | + ${step_value}= mult_and_round ${USERS.users['${tender_owner}'].tender_data.data.lots[${lot_index}].minimalStep.amount} ${percent} ${1/100} precision=2 | |
275 | 275 | Можливість змінити поле value.amount ${lot_index} лоту на ${value} |
276 | 276 | Можливість змінити поле minimalStep.amount ${lot_index} лоту на ${step_value} |
277 | 277 | |
... | ... | @@ -822,7 +822,7 @@ Resource resource.robot |
822 | 822 | ${percent}= Convert To Number ${percent} |
823 | 823 | ${field}= Set variable if ${number_of_lots} == 0 value.amount lotValues[0].value.amount |
824 | 824 | ${value}= Run As ${username} Отримати інформацію із пропозиції ${TENDER['TENDER_UAID']} ${field} |
825 | - ${value}= Evaluate round(${value} * ${percent} / 100, 2) | |
825 | + ${value}= mult_and_round ${value} ${percent} ${1/100} precision=2 | |
826 | 826 | Run as ${username} Змінити цінову пропозицію ${TENDER['TENDER_UAID']} ${field} ${value} |
827 | 827 | |
828 | 828 | ... | ... |
1 | 1 | # -*- coding: utf-8 - |
2 | +import operator | |
2 | 3 | from .local_time import get_now, TZ |
3 | 4 | from copy import deepcopy |
4 | 5 | from datetime import timedelta |
... | ... | @@ -461,6 +462,10 @@ def generate_test_bid_data(tender_data): |
461 | 462 | return bid |
462 | 463 | |
463 | 464 | |
465 | +def mult_and_round(*args, **kwargs): | |
466 | + return round(reduce(operator.mul, args), kwargs.get('precision', 2)) | |
467 | + | |
468 | + | |
464 | 469 | # GUI Frontends common |
465 | 470 | def add_data_for_gui_frontends(tender_data): |
466 | 471 | now = get_now() | ... | ... |
Please
register
or
login
to post a comment