summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-05-21 21:12:55 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-12-13 16:59:38 +0100
commit54fabd353698717468e383879ea35e12902f09b1 (patch)
tree87e044ed9043454332449918232561f449748d97 /backend
parent34d38a5752a3e8c77e724f0f4f706b53e7bd88d4 (diff)
downloadbrokentalents-54fabd353698717468e383879ea35e12902f09b1.tar.gz
brokentalents-54fabd353698717468e383879ea35e12902f09b1.zip
Backend: Pick time range automatically
Diffstat (limited to 'backend')
-rw-r--r--backend/index.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/backend/index.js b/backend/index.js
index 9b69df4..c8be64e 100644
--- a/backend/index.js
+++ b/backend/index.js
@@ -15,11 +15,13 @@ const cleanPayloads = reduce.cleanPayloads(config.reduce);
const saveFPayloads = file.saveFPayloads(config.file);
function main() {
- const firstOfMay = moment('2018-05-16');
+ const start = moment('2018-05-16 16Z');
+ const end = moment().utc();
+ const duration = moment.duration(end.diff(start));
const later = R.curry((base, hs) => base.clone().add(hs, 'hours'));
- const hours = R.range(20, 24 * 5 + 15);
- const laterMoments = R.map(later(firstOfMay), hours);
+ const hours = R.range(0, Math.floor(duration.asHours()));
+ const laterMoments = R.map(later(start), hours);
const futures = R.map(loadFTimestamped, laterMoments);
Future.parallel(1, futures)