Commit d2073402 by Yvon Kerdoncuff

in js update members makeup method, fix a bug by not updating makeups_to_do…

in js update members makeup method, fix a bug by not updating makeups_to_do global js variable unless request is successful
parent 28df6b77
Pipeline #4095 canceled with stage
......@@ -298,18 +298,9 @@ function update_members_makeups(member_ids, action, description) {
data = [];
for (mid of member_ids) {
member_index = makeups_members.findIndex(m => m.id == mid);
/* Becareful : makeups_members will be modified while nobody knows wether ajax process will succeed or not !
TODO : make the changes only when it is sure that odoo records have been changed
*/
if (action === "increment") {
makeups_members[member_index].makeups_to_do += 1;
} else {
makeups_members[member_index].makeups_to_do -= 1;
}
data.push({
member_id: mid,
target_makeups_nb: makeups_members[member_index].makeups_to_do,
target_makeups_nb: makeups_members[member_index].makeups_to_do + (action === 'increment' ? 1 : -1),
member_shift_type: makeups_members[member_index].shift_type,
display_ftop_points: makeups_members[member_index].display_ftop_points,
display_std_points: makeups_members[member_index].display_std_points,
......@@ -328,13 +319,9 @@ function update_members_makeups(member_ids, action, description) {
selected_rows = [];
for (element of res['res']) {
member_index = makeups_members.findIndex(m => m.id == element['mid']);
if (makeups_members[member_index].shift_type === 'standard') {
makeups_members[member_index].makeups_to_do = action === 'increment' ? 1 : -1
makeups_members[member_index].display_std_points = element['standard_points']
}
//there is no point change when shift_type is not standard
//and I think operation on rattrapages should definitely be forbidden for ftop because it
//has no sense !!
}
display_makeups_members();
closeModal();
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment