|
|
|
@ -91,22 +91,16 @@ class WorkPackageField |
|
|
|
|
def update(value, save: true, expect_failure: false) |
|
|
|
|
# Retry to set attributes due to reloading the page after setting |
|
|
|
|
# an attribute, which may cause an input not to open properly. |
|
|
|
|
retries = 0 |
|
|
|
|
begin |
|
|
|
|
print_failure = ->() do |
|
|
|
|
$stderr.puts "Failed to set attribute #{property_name}: #{e.message}. Retrying" |
|
|
|
|
end |
|
|
|
|
Retriable.retriable(on_retry: print_failure) do |
|
|
|
|
activate_edition |
|
|
|
|
set_value value |
|
|
|
|
|
|
|
|
|
# select fields are saved on change |
|
|
|
|
save! if save && field_type != 'select' |
|
|
|
|
expect_state! open: expect_failure |
|
|
|
|
rescue => e |
|
|
|
|
if retries > 2 |
|
|
|
|
raise e |
|
|
|
|
end |
|
|
|
|
$stderr.puts "Failed to set attribute #{property_name}: #{e.message}. Retrying" |
|
|
|
|
retries += 1 |
|
|
|
|
sleep 1 |
|
|
|
|
retry |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|