Last active
April 18, 2017 13:05
-
-
Save higordiego/2659ad64fa709c8beceb4fa00cfc92c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axio = require('axios') | |
const url = 'https://api.playbets.com.br/painel/update/list' | |
axio.get(url) | |
.then(response =>{ | |
let objetoCompost = []; | |
let regras = []; | |
const object = response.data.campeonatos; | |
object.map((campeonato,index) => { | |
let retornoObject = {}; | |
let retirar,one,x,two = 0; | |
campeonato.jogos.map(jogos =>{ | |
retirar = (( parseInt((1/jogos.regras[0].valor)*100) + parseInt((1/jogos.regras[1].valor)*100) + parseInt((1/jogos.regras[2].valor)*100) ) - 100 )/3 | |
let jogoObject = { | |
jogo: jogos.titulo, | |
probability: [ | |
{ | |
one: parseInt(((1/jogos.regras[0].valor)*100) - retirar) | |
}, | |
{ | |
x: parseInt(((1/jogos.regras[1].valor)*100) - retirar) | |
}, | |
{ | |
two: parseInt(((1/jogos.regras[2].valor)*100) - retirar) | |
} | |
] | |
} | |
regras.push(jogoObject) | |
}) | |
retornoObject = { | |
campeonato_nome: campeonato.campeonato_nome, | |
regras | |
} | |
objetoCompost.push(retornoObject) | |
}) | |
console.log(objetoCompost) | |
}) | |
.catch(err => { | |
console.log(err) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment