a simple model for mapping closed issues into a chart
This commit is contained in:
parent
eba859bcbc
commit
b36f11846b
|
@ -3,10 +3,6 @@
|
|||
|
||||
[ ![Codeship Status for radekstepan/github-burndown-chart](https://www.codeship.io/projects/d69f4420-e5b0-0130-bbae-1632ddfb80f8/status?branch=rework)](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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue