[webpack.ue.view] fixed update

This commit is contained in:
xdrm-brackets 2018-03-12 11:01:23 +01:00
parent fa9964cd78
commit fc26d4a7ef
1 changed files with 17 additions and 10 deletions

View File

@ -403,7 +403,7 @@ gstore.add('ie_handler', function(ue_i){
( vco != ue.volumeCours ) && ( rq.volumeCours = parseInt(vco) );
( vtd != ue.volumeTD ) && ( rq.volumeTD = parseInt(vtd) );
( vtp != ue.volumeTP ) && ( rq.volumeTP = parseInt(vtp) );
( form != ue.defaultFormation ) && ( rq.defaultFormation = parseInt(form) );
( form != ue.idForm ) && ( rq.defaultFormation = parseInt(form) );
(new Promise( (resolve, reject) => {
@ -423,6 +423,7 @@ gstore.add('ie_handler', function(ue_i){
api.call(`PUT ue/${ue.code}`, rq, function(rs){
/* (5.8.1.1) Abort on error */
console.log(rq, rs.error != 0, rs.updated != true);
if( rs.error != 0 || rs.updated != true )
return reject(rs.error);
@ -438,7 +439,7 @@ gstore.add('ie_handler', function(ue_i){
/* (5.9.1) update VueJS element */
gstore.get.ues[ue_i].label = label;
gstore.get.ues[ue_i].code = code;
// gstore.get.ues[ue_i].code = code;
gstore.get.ues[ue_i].idForm = parseInt(form);
gstore.get.ues[ue_i].volumeCours = parseInt(vco);
gstore.get.ues[ue_i].volumeTD = parseInt(vtd);
@ -448,9 +449,15 @@ gstore.add('ie_handler', function(ue_i){
var fi = gstore.get.formations.map( (data, i) => { return ( data.idForm && data.idForm == form ) ? i : ''; }).join('');
/* (5.9.3) Exit if not found */
if( isNaN(fi) ) return gstore.add('edit_i', -1);
if( isNaN(fi) )
return gstore.add('edit_i', -1);
/* (5.9.4) If found -> set formation label */
/* (5.9.4) If not found -> set default text */
if( !gstore.get.formations.hasOwnProperty(fi) )
gstore.get.ues[ue_i].labelForm = '';
/* (5.9.5) If found -> set formation label */
else
gstore.get.ues[ue_i].labelForm = gstore.get.formations[fi].labelForm;
/* (5.9.5) Remove edit mode */