lot/app.js
2017-09-08 10:49:24 +01:00

38 lines
692 B
JavaScript

const loader = require('./libs/loader');
const lot = require('./libs/lot');
const lotv2 = require('./libs/lotV2');
const pusher = require('./libs/pusher');
const log4js = require('log4js');
const logger = log4js.getLogger();
function run(data) {
const v1 = lot.calculate(data);
const v2 = lotv2.calculate(data);
const msg =
`V2: ${v2} stars: ${v1.mainstars}
V1: ${v1.mainline} stars: ${v1.mainstars}
Other: ${v1.otherLine} stars: ${v1.otherStars}
`;
pusher.push(msg);
logger.debug(msg);
loader.save(data);
}
function go() {
logger.info('GO!');
loader.load(run);
}
cron.schedule('10 13 * * 2,5', () => {
go();
return -1;
});
logger.info('Lot V3 started...');