Laura10101 / contractor-tax-calculator

0 stars 2 forks source link

Move up/down buttons on config app is not working #227

Closed Laura10101 closed 10 months ago

Laura10101 commented 10 months ago

Pressing any move up/move down icon on the config app fails to update anything

Laura10101 commented 10 months ago

When moving a question up or down, the process involves swapping the ordinals of the question for which the button was clicked and the one above or below it. Ones the ordinals have been swapped, both questions are updated to save their new ordinals via the API. The latest data is then retrieved from the API and the display is refreshed. However, because the updates execute asynchronously, the refresh was being called (and completing) before the two updates had completed. As a result, the display was being refreshed before the data had been updated and so the display was not updating. This was resolved by using JQuery when() and then() to wait until both updates had completed before refreshing the display.