From 256eb5388b7cb6993ad0f1c586df25597b2f5e33 Mon Sep 17 00:00:00 2001 From: Radek Stepan Date: Thu, 26 Sep 2013 21:21:42 +0100 Subject: [PATCH] trendline not editing actual values --- src/modules/graph.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/graph.coffee b/src/modules/graph.coffee index b5e2f6d..309b9e9 100644 --- a/src/modules/graph.coffee +++ b/src/modules/graph.coffee @@ -78,14 +78,14 @@ module.exports = # http://classroom.synonym.com/calculate-trendline-2709.html 'trendline': (actual, created_at, due_on) -> start = +actual[0].date - - # Now is an actual point too. - last = actual[actual.length - 1] - actual.push { 'date': new Date(), 'points': last.points } values = _.map actual, ({ date, points }) -> [ +date - start, points ] + # Now is an actual point too. + last = actual[actual.length - 1] + values.push [ + new Date() - start, last.points ] + b1 = 0 ; e = 0 ; c1 = 0 a = (l = values.length) * _.reduce(values, (sum, [ a, b ]) -> b1 += a ; e += b