Merge branch 'config' of https://github.com/jomsdev/autobounty into config

This commit is contained in:
Pol.Alvarez@BSC 2018-01-22 17:08:27 +01:00
commit bcb7b939c8

View File

@ -37,8 +37,7 @@ const getAddress = function(req) {
}
const getLabel = function(req) {
return github.getLabels(req)
.then(labels => {
return github.getLabels(req).then(labels => {
if (labels.length === 1) {
resolve(labels[0]);
} else {
@ -50,16 +49,19 @@ const getLabel = function(req) {
}
const getAmount = function(req) {
return new Promise((resolve, reject) => {
let labelPromise = getLabel(req);
let tokenPricePromise = prices.getTokenPrice(config.token);
let label = getLabel(req);
Promise.all([labelPromise, tokenPricePromise]).then(function(values) {
let label = values[0];
let tockenPrice = values[1];
let amountToPayDollar = config.priceHour * config.workHours[label];
tokenPricePromise
.then((tokenPrice) => {return tokenPrice * config.amountToPayInDollars} )
.catch((err) => {console.log("TODO-ERROR: Failed token price request throw log error")});
// Check how to handle errors when promises does not arrive
reslove(config.amountToPayDollar/tockenPrice);
}).catch(error => {
// TODO: Handle error
});
});
}
const getGasPrice = function(req) {