Skip to content

Instantly share code, notes, and snippets.

@lfalvarez
Created March 16, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfalvarez/b4e50bfe5b89a8f3e0e8ee7f885d8455 to your computer and use it in GitHub Desktop.
Save lfalvarez/b4e50bfe5b89a8f3e0e8ee7f885d8455 to your computer and use it in GitHub Desktop.
_arrayparseCsv(file_names, store){
let _parseAttributes = this._parseAttributes;
let studies = [];
_parseAttributes = _parseAttributes.bind(this);
let hashCode = this._hashCode;
let parses = [];
let _otroCsv = this._otroCsv;
_otroCsv = _otroCsv.bind(this);
_.forEach(file_names, function(fn){
let id = hashCode(fn.split('_')[1].split('-')[0] + fn.split('_')[1].split('-')[1].split('.')[0]);
let study = store.peekRecord('study', id);
parses.push(_otroCsv(fn, study));
studies.push(study);
});
let result = RSVP.allSettled(parses).then(function(resultados){
let resultado_final = {'data':[]};
_.forEach(resultados, function(resultado){
resultado_final.data = _.concat(resultado_final.data, resultado.value.data);
});
// console.log(JSON.stringify(resultado_final));
store.pushPayload(resultado_final);
console.log(studies);
return studies;
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment