trendline not editing actual values

This commit is contained in:
Radek Stepan 2013-09-26 21:21:42 +01:00
parent 7d209034e3
commit 256eb5388b

View File

@ -79,13 +79,13 @@ module.exports =
'trendline': (actual, created_at, due_on) -> 'trendline': (actual, created_at, due_on) ->
start = +actual[0].date 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 }) -> values = _.map actual, ({ date, points }) ->
[ +date - start, 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 b1 = 0 ; e = 0 ; c1 = 0
a = (l = values.length) * _.reduce(values, (sum, [ a, b ]) -> a = (l = values.length) * _.reduce(values, (sum, [ a, b ]) ->
b1 += a ; e += b b1 += a ; e += b