This commit is contained in:
Martin Donnelly 2016-10-07 13:39:19 +01:00
parent 09f5519dc9
commit 3a6c4b3494
2 changed files with 34 additions and 7 deletions

File diff suppressed because one or more lines are too long

39
lot.js
View File

@ -4,7 +4,7 @@ var jsonfile = require('jsonfile'),
https = require('https'),
UltraSES = require('ultrases'),cron = require('node-cron');
var file = 'data/data.json'
var file = 'data/data.json';
var m = [],
prev = [],
mo = [],
@ -150,8 +150,10 @@ function othercalc() {
var i = 0;
// var p = 1 / ((-1)*re.length);
var p = 1.0 / (re.length);
console.log('P', p);
for (i = 0; i < re.length - 1; i++) {
console.log((p * i));
// console.log(re[i]);
for (var s = 1; s < 6; s++) {
var cv = re[i][s];
@ -164,17 +166,30 @@ function othercalc() {
var flag = false;
for (var t = 0; t < mo.length; t++) {
if (mo[t].a == cv && mo[t].b == wv) {
if (typeof mo[t].c == 'undefined' || mo[t].c == null)
{
mo[t].c = 0;
}
mo[t].c++;
flag = true;
mo[t].v++;
// mo[t].v++;
/*
if (i < (re.length/2))
mo[t].v = mo[t].v - (p * i)
else
*/
mo[t].v = mo[t].v + (p * i);
// original weighting
//mo[t].v = mo[t].v + (p * i);
//reverse weighting..
mo[t].v = mo[t].v + (1-(p * i));
console.log(mo[t], 1-(p*i));
//;
//mo[t].v = mo[t].v + 1;
// ;
}
}
if (!flag) {
@ -433,7 +448,17 @@ function GO() {
console.log(err);
re = obj;
resultsQuery(function (a) {
performCalcs();
prepareResults();
console.log(resultsObj);
/* resultsQuery(function (a) {
processData(a);
performCalcs();
@ -442,10 +467,10 @@ function GO() {
console.log(resultsObj);
sendEmail();
// sendEmail();
saveData();
});
});*/
});
}
@ -462,3 +487,5 @@ cron.schedule('1 00 18 * * 2,5', function(){
// console.log('tick');
return -1;
});
GO();