mirror of
https://github.com/status-im/burnchart.git
synced 2025-02-20 22:28:10 +00:00
a simple model for mapping closed issues into a chart
This commit is contained in:
parent
eba859bcbc
commit
b36f11846b
@ -3,10 +3,6 @@
|
||||
|
||||
[ ](https://www.codeship.io/projects/5855)
|
||||
|
||||
##Next
|
||||
|
||||
Map closed tasks to a range of dates while maintaining the points remaining stats.
|
||||
|
||||
##Project Charter
|
||||
|
||||
The app is to display a burndown chart from a set of GitHub issues in a milestone.
|
||||
|
9
src/chart.coffee
Normal file
9
src/chart.coffee
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env coffee
|
||||
{ _ } = require 'lodash'
|
||||
|
||||
module.exports =
|
||||
# Map closed issues ready to be visualized.
|
||||
# Assumes collection has been `filter`ed and is ordered.
|
||||
'closed': (collection, total, cb) ->
|
||||
cb null, _.map collection, ({ closed_at, size }) ->
|
||||
{ x: +new Date(closed_at), y: total -= size }
|
@ -4,6 +4,7 @@ async = require 'async'
|
||||
|
||||
req = require './request'
|
||||
reg = require './regex'
|
||||
dates = require './dates'
|
||||
|
||||
module.exports =
|
||||
# Used on an initial fetch of issues for a repo.
|
||||
|
20
test/chart.coffee
Normal file
20
test/chart.coffee
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env coffee
|
||||
assert = require 'assert'
|
||||
path = require 'path'
|
||||
|
||||
chart = require path.resolve __dirname, '../src/chart.coffee'
|
||||
|
||||
module.exports =
|
||||
'chartize closed issues': (done) ->
|
||||
a = { number: 2, closed_at: '2013-05-09T09:04:53Z', size: 6 }
|
||||
b = { number: 1, closed_at: '2013-05-09T10:04:53Z', size: 4 }
|
||||
c = { number: 3, closed_at: '2013-05-12T09:04:53Z', size: 2 }
|
||||
|
||||
chart.closed [ a, b, c ], 20, (err, data) ->
|
||||
assert.ifError err
|
||||
assert.deepEqual data, [
|
||||
{ x: 1368090293000, y: 14 }
|
||||
{ x: 1368093893000, y: 10 }
|
||||
{ x: 1368349493000, y: 8 }
|
||||
]
|
||||
done.call null
|
@ -8,7 +8,7 @@ req = {}
|
||||
issues = proxy path.resolve(__dirname, '../src/issues.coffee'),
|
||||
'./request': req
|
||||
|
||||
module.exports =
|
||||
module.exports =
|
||||
'all empty': (done) ->
|
||||
called = 0
|
||||
req.all_issues = (opts, cb) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user