This commit is contained in:
Kseninia Mikhaylova 2024-07-26 09:31:48 +03:00
parent b7b88e900f
commit 193a878112
1 changed files with 4 additions and 5 deletions

View File

@ -101,13 +101,12 @@ const changeParametres = () => {
if (full_sections == 0) { if (full_sections == 0) {
length = total_length_mm - fence_length - fence_length length = total_length_mm - fence_length - fence_length
} }
}
let total_length_calc = (full_sections * length) + (full_sections * fence_length) + fence_length let total_length_calc = (full_sections * length) + (full_sections * fence_length) + fence_length
if ((total_length_mm - total_length_calc) > 0 && (total_length_mm - total_length_calc) < fence_length) { if (Math.round(total_length_mm - total_length_calc) > 0 && Math.round(total_length_mm - total_length_calc) <= fence_length) {
full_sections -= 1 full_sections -= 1
} }
} if (Math.round(total_length_mm - total_length_calc) > 0) {
let total_length_calc = (full_sections * length) + (full_sections * fence_length) + fence_length
if (total_length_calc < total_length_mm) {
form_state.extra_section = total_length_mm - total_length_calc - fence_length form_state.extra_section = total_length_mm - total_length_calc - fence_length
} else { } else {
form_state.extra_section = 0 form_state.extra_section = 0