[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

@ -398,12 +398,12 @@ gstore.add('ie_handler', function(ue_i){
/* (5.7) Création de la requête */ /* (5.7) Création de la requête */
var rq = {}; var rq = {};
( label != ue.label ) && ( rq.label = label ); ( label != ue.label ) && ( rq.label = label );
// ( code != ue.code ) && ( rq.code = code ); // ( code != ue.code ) && ( rq.code = code );
( vco != ue.volumeCours ) && ( rq.volumeCours = parseInt(vco) ); ( vco != ue.volumeCours ) && ( rq.volumeCours = parseInt(vco) );
( vtd != ue.volumeTD ) && ( rq.volumeTD = parseInt(vtd) ); ( vtd != ue.volumeTD ) && ( rq.volumeTD = parseInt(vtd) );
( vtp != ue.volumeTP ) && ( rq.volumeTP = parseInt(vtp) ); ( 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) => { (new Promise( (resolve, reject) => {
@ -423,6 +423,7 @@ gstore.add('ie_handler', function(ue_i){
api.call(`PUT ue/${ue.code}`, rq, function(rs){ api.call(`PUT ue/${ue.code}`, rq, function(rs){
/* (5.8.1.1) Abort on error */ /* (5.8.1.1) Abort on error */
console.log(rq, rs.error != 0, rs.updated != true);
if( rs.error != 0 || rs.updated != true ) if( rs.error != 0 || rs.updated != true )
return reject(rs.error); return reject(rs.error);
@ -438,7 +439,7 @@ gstore.add('ie_handler', function(ue_i){
/* (5.9.1) update VueJS element */ /* (5.9.1) update VueJS element */
gstore.get.ues[ue_i].label = label; 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].idForm = parseInt(form);
gstore.get.ues[ue_i].volumeCours = parseInt(vco); gstore.get.ues[ue_i].volumeCours = parseInt(vco);
gstore.get.ues[ue_i].volumeTD = parseInt(vtd); gstore.get.ues[ue_i].volumeTD = parseInt(vtd);
@ -448,10 +449,16 @@ gstore.add('ie_handler', function(ue_i){
var fi = gstore.get.formations.map( (data, i) => { return ( data.idForm && data.idForm == form ) ? i : ''; }).join(''); var fi = gstore.get.formations.map( (data, i) => { return ( data.idForm && data.idForm == form ) ? i : ''; }).join('');
/* (5.9.3) Exit if not found */ /* (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 */
gstore.get.ues[ue_i].labelForm = gstore.get.formations[fi].labelForm; 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 */ /* (5.9.5) Remove edit mode */
gstore.add('edit_i', -1); gstore.add('edit_i', -1);