changes
This commit is contained in:
parent
6dcbb36c9c
commit
eebea3a337
|
@ -12,6 +12,7 @@ const mats = require('./mats.json');
|
||||||
const outs = require('./outs.json');
|
const outs = require('./outs.json');
|
||||||
|
|
||||||
//genItems(); //generate base item collection
|
//genItems(); //generate base item collection
|
||||||
|
//genSystems(); //generate systems
|
||||||
|
|
||||||
console.log("Updating Items!");
|
console.log("Updating Items!");
|
||||||
newUpdateItems();
|
newUpdateItems();
|
||||||
|
@ -60,6 +61,36 @@ function bpBuilder(){
|
||||||
writeToFile(bparr);
|
writeToFile(bparr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function genSystems(){
|
||||||
|
let esiurl = "https://esi.evetech.net/latest/industry/systems/?datasource=tranquility";
|
||||||
|
request(esiurl, function(err, res, body) {
|
||||||
|
let esi = JSON.parse(body);
|
||||||
|
let sys = [];
|
||||||
|
for (let i = 0; i < systems.length; i++) {
|
||||||
|
let temp = {
|
||||||
|
"insertOne": {
|
||||||
|
"_id": systems[i].solarSystemID,
|
||||||
|
"name": systems[i].solarSystemName,
|
||||||
|
"index": getSystem(esi, systems[i].solarSystemID).cost_indices[5].cost_index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sys.push(temp);
|
||||||
|
}
|
||||||
|
mongo.connect(svurl, function(err, db) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
} else {
|
||||||
|
db.collection('systems').bulkWrite(sys, { "ordered": true, "w": 1 }, function(err, result) {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log(result.modifiedCount);
|
||||||
|
console.log("Cost Index UPDATED!");
|
||||||
|
db.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function writeToFile(arr){
|
function writeToFile(arr){
|
||||||
console.log("A escrever ficheiro...");
|
console.log("A escrever ficheiro...");
|
||||||
fs.writeFile("./new_bps.json",JSON.stringify(arr));
|
fs.writeFile("./new_bps.json",JSON.stringify(arr));
|
||||||
|
@ -106,7 +137,7 @@ function getSystem(arr, id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCostIndex() {
|
function updateCostIndex() {
|
||||||
let esiurl = "https://esi.tech.ccp.is/latest/industry/systems/?datasource=tranquility";
|
let esiurl = "https://esi.evetech.net/latest/industry/systems/?datasource=tranquility";
|
||||||
request(esiurl, function(err, res, body) {
|
request(esiurl, function(err, res, body) {
|
||||||
let esi = JSON.parse(body);
|
let esi = JSON.parse(body);
|
||||||
let sys = [];
|
let sys = [];
|
||||||
|
@ -287,4 +318,4 @@ function addDaily() { //need to re-write this
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ function getSimplePrice(data, id) {
|
||||||
"sell": tempsell,
|
"sell": tempsell,
|
||||||
"buy": tempbuy
|
"buy": tempbuy
|
||||||
}
|
}
|
||||||
|
console.log(exp);
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1004,4 +1005,4 @@ router.get('/:id',function(req, res, next){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -660,4 +660,4 @@ router.get('/:id',function(req, res, next){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
<div class="card w-100 mt-3">
|
<div class="card w-100 mt-3">
|
||||||
<div class="card-header bg-info text-white text-center w-100">
|
<div class="card-header bg-info text-white text-center w-100">
|
||||||
Complex Chain Reactions
|
Complex Chain Reactions (broken)
|
||||||
</div>
|
</div>
|
||||||
<table width="100%" id="chtab" class="table table-bordered text-center">
|
<table width="100%" id="chtab" class="table table-bordered text-center">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
Loading…
Reference in New Issue