solar-scores
Version:
Compute scores for solar decathlon competition - Cali 2015
33 lines (27 loc) • 1.08 kB
JavaScript
;
var byDay = require('./src/periods').byDay;
var moment = require('moment');
var begins = [];
var ends = [];
function doOne(byDay, name, description) {
for(var i=0; i < byDay[name].length; i++) {
var el = byDay[name][i];
var begin = el.periods[0].begin;
var end = el.periods[el.periods.length-1].end;
ends.push(`${Math.round(end.getTime()/1000)}:Day ${i} - ${description} - ${moment(end).format('DD/MM')}`)
begins.push(`${Math.round(begin.getTime()/1000)}:Day ${i} - ${description} - ${moment(begin).format('DD/MM')}`)
}
begins.push('------:------');
ends.push('------:------');
}
doOne(byDay, 'Refrigeration', 'All day');
doOne(byDay, 'Luminosity', 'Luminosity');
doOne(byDay, 'Temperature', 'Temperature');
begins = begins.slice(0, begins.length-1);
ends = ends.slice(0, begins.length-1);
begins.unshift('0:Begin of times');
ends.unshift('0:Begin of times');
begins.push('2449369767:End of times');
ends.push('2449369767:End of times');
console.log(begins.join(';'), '\n\n\n');
console.log(ends.join(';'));