no due date milestones are always on track

This commit is contained in:
Radek Stepan 2014-09-20 11:45:28 -07:00
parent 85e947fb87
commit 8c7caaa3cc
5 changed files with 37 additions and 4 deletions

View File

@ -15,7 +15,7 @@ GitHub Burndown Chart as a service. Public repos are free, for private access au
### The 20% ### The 20%
- [ ] deal with no due date milestones - always on track - [ ] progress needs to be calculated based on strategy even on homepage
- [ ] be able to go back to homepage - [ ] be able to go back to homepage
- [ ] calculate left margin based on the total number of points text width - [ ] calculate left margin based on the total number of points text width
- [ ] Do not show login/logged-in state when we are still fetching that information from Firebase - [ ] Do not show login/logged-in state when we are still fetching that information from Firebase
@ -25,6 +25,7 @@ GitHub Burndown Chart as a service. Public repos are free, for private access au
- [ ] Check that we have not run out of requests to make - [ ] Check that we have not run out of requests to make
- [ ] Show loading sign on top of [browser window](https://github.com/buunguyen/topbar) which is unobtrusive enough we can show it immediately. - [ ] Show loading sign on top of [browser window](https://github.com/buunguyen/topbar) which is unobtrusive enough we can show it immediately.
- [ ] show a countdown clock towards the end of the milestone or show overdue - [ ] show a countdown clock towards the end of the milestone or show overdue
- [x] deal with no due date milestones - always on track
- [x] show title on the chart page - [x] show title on the chart page
- [x] work for `mbostock/d3` - [x] work for `mbostock/d3`
- [x] allow people to go straight to a URL that fetches the repo, if public, for them; to demo our app without adding a repo (add it behind the scenes); *req* cache repos - [x] allow people to go straight to a URL that fetches the repo, if public, for them; to demo our app without adding a repo (add it behind the scenes); *req* cache repos

View File

@ -40748,7 +40748,7 @@ if (typeof exports === 'object') {
// projects.mustache // projects.mustache
root.require.register('burnchart/src/templates/projects.js', function(exports, require, module) { root.require.register('burnchart/src/templates/projects.js', function(exports, require, module) {
module.exports = ["{{#projects.list.length}}"," <div id=\"projects\">"," <div class=\"header\">"," <a href=\"#\" class=\"sort\"><span class=\"icon sort-alphabet\"></span> Sorted by priority</a>"," <h2>Projects</h2>"," </div>",""," <table>"," {{#projects.list}}"," {{#milestones}}"," <tr>"," <td><a class=\"repo\">{{owner}}/{{name}}</a></td>"," <td>"," <a class=\"milestone\" href=\"#chart/{{owner}}/{{name}}/{{number}}\">{{ title }}</a>"," </td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">{{Math.floor(format.progress(closed_issues, open_issues))}}%</span>"," <span class=\"due\">{{format.due(due_on)}}</span>"," <div class=\"outer bar\">"," <div class=\"inner bar {{format.onTime(this)}}\" style=\"width:{{format.progress(closed_issues, open_issues)}}%\"></div>"," </div>"," </div>"," </td>"," </tr>"," {{/milestones}}"," {{/projects.list}}",""," <!--"," <tr>"," <td><a class=\"repo\" href=\"#\">radekstepan/disposable</a></td>"," <td><span class=\"milestone\">Milestone 1.0 <span class=\"icon down-open\"></span></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">40%</span>"," <span class=\"due\">due on Friday</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:40%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr class=\"done\">"," <td><a class=\"repo\" href=\"#\">radekstepan/burnchart</a></td>"," <td><span class=\"milestone\">Beta Milestone <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">100%</span>"," <span class=\"due\">due tomorrow</span>"," <div class=\"outer bar\">"," <div class=\"inner bar green\" style=\"width:100%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">intermine/intermine</a></td>"," <td><span class=\"milestone\">Emma Release 96 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">27%</span>"," <span class=\"due\">due in 2 weeks</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:27%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">microsoft/windows</a></td>"," <td><span class=\"milestone\">RC 9 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">90%</span>"," <span class=\"due red\">overdue by a month</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:90%\"></div>"," </div>"," </div>"," </td>"," </tr>"," -->"," </table>",""," <div class=\"footer\">"," <a href=\"#\"><span class=\"icon cog\"></span> Edit</a>"," </div>"," </div>","{{/projects.list}}"].join("\n"); module.exports = ["{{#projects.list.length}}"," <div id=\"projects\">"," <div class=\"header\">"," <a href=\"#\" class=\"sort\"><span class=\"icon sort-alphabet\"></span> Sorted by priority</a>"," <h2>Projects</h2>"," </div>",""," <table>"," {{#projects.list}}"," {{#milestones}}"," <tr>"," <td><a class=\"repo\">{{owner}}/{{name}}</a></td>"," <td>"," <a class=\"milestone\" href=\"#chart/{{owner}}/{{name}}/{{number}}\">{{ title }}</a>"," </td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">{{Math.floor(format.progress(closed_issues, open_issues))}}%</span>"," <span class=\"due\">{{{ format.due(due_on) }}}</span>"," <div class=\"outer bar\">"," <div class=\"inner bar {{format.onTime(this)}}\" style=\"width:{{format.progress(closed_issues, open_issues)}}%\"></div>"," </div>"," </div>"," </td>"," </tr>"," {{/milestones}}"," {{/projects.list}}",""," <!--"," <tr>"," <td><a class=\"repo\" href=\"#\">radekstepan/disposable</a></td>"," <td><span class=\"milestone\">Milestone 1.0 <span class=\"icon down-open\"></span></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">40%</span>"," <span class=\"due\">due on Friday</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:40%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr class=\"done\">"," <td><a class=\"repo\" href=\"#\">radekstepan/burnchart</a></td>"," <td><span class=\"milestone\">Beta Milestone <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">100%</span>"," <span class=\"due\">due tomorrow</span>"," <div class=\"outer bar\">"," <div class=\"inner bar green\" style=\"width:100%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">intermine/intermine</a></td>"," <td><span class=\"milestone\">Emma Release 96 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">27%</span>"," <span class=\"due\">due in 2 weeks</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:27%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">microsoft/windows</a></td>"," <td><span class=\"milestone\">RC 9 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">90%</span>"," <span class=\"due red\">overdue by a month</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:90%\"></div>"," </div>"," </div>"," </td>"," </tr>"," -->"," </table>",""," <div class=\"footer\">"," <a href=\"#\"><span class=\"icon cog\"></span> Edit</a>"," </div>"," </div>","{{/projects.list}}"].join("\n");
}); });
// date.coffee // date.coffee
@ -40765,23 +40765,35 @@ if (typeof exports === 'object') {
// format.coffee // format.coffee
root.require.register('burnchart/src/utils/format.js', function(exports, require, module) { root.require.register('burnchart/src/utils/format.js', function(exports, require, module) {
var config;
config = require('../models/config');
module.exports = { module.exports = {
'progress': _.memoize(function(a, b) { 'progress': _.memoize(function(a, b) {
return 100 * (a / (b + a)); return 100 * (a / (b + a));
}), }),
'onTime': _.memoize(function(milestone) { 'onTime': _.memoize(function(milestone) {
var a, b, c, points, time; var a, b, c, points, time;
if (!milestone.due_on) {
return 'green';
}
points = this.progress(milestone.closed_issues, milestone.open_issues); points = this.progress(milestone.closed_issues, milestone.open_issues);
a = +new Date(milestone.created_at); a = +new Date(milestone.created_at);
b = +(new Date); b = +(new Date);
c = +new Date(milestone.due_on); c = +new Date(milestone.due_on);
time = this.progress(b - a, c - b); time = this.progress(b - a, c - b);
return ['red', 'green'][+(points > time)]; return ['red', 'green'][+(points > time)];
}, function(m) {
return [m.created_at, m.number].join('/');
}), }),
'fromNow': _.memoize(function(jsonDate) { 'fromNow': _.memoize(function(jsonDate) {
return moment(new Date(jsonDate)).fromNow(); return moment(new Date(jsonDate)).fromNow();
}), }),
'due': function(jsonDate) { 'due': function(jsonDate) {
if (!jsonDate) {
return '&nbsp;';
}
return ['due', this.fromNow(jsonDate)].join(' '); return ['due', this.fromNow(jsonDate)].join(' ');
}, },
'markdown': function(markup) { 'markdown': function(markup) {

View File

@ -782,7 +782,7 @@
// projects.mustache // projects.mustache
root.require.register('burnchart/src/templates/projects.js', function(exports, require, module) { root.require.register('burnchart/src/templates/projects.js', function(exports, require, module) {
module.exports = ["{{#projects.list.length}}"," <div id=\"projects\">"," <div class=\"header\">"," <a href=\"#\" class=\"sort\"><span class=\"icon sort-alphabet\"></span> Sorted by priority</a>"," <h2>Projects</h2>"," </div>",""," <table>"," {{#projects.list}}"," {{#milestones}}"," <tr>"," <td><a class=\"repo\">{{owner}}/{{name}}</a></td>"," <td>"," <a class=\"milestone\" href=\"#chart/{{owner}}/{{name}}/{{number}}\">{{ title }}</a>"," </td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">{{Math.floor(format.progress(closed_issues, open_issues))}}%</span>"," <span class=\"due\">{{format.due(due_on)}}</span>"," <div class=\"outer bar\">"," <div class=\"inner bar {{format.onTime(this)}}\" style=\"width:{{format.progress(closed_issues, open_issues)}}%\"></div>"," </div>"," </div>"," </td>"," </tr>"," {{/milestones}}"," {{/projects.list}}",""," <!--"," <tr>"," <td><a class=\"repo\" href=\"#\">radekstepan/disposable</a></td>"," <td><span class=\"milestone\">Milestone 1.0 <span class=\"icon down-open\"></span></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">40%</span>"," <span class=\"due\">due on Friday</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:40%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr class=\"done\">"," <td><a class=\"repo\" href=\"#\">radekstepan/burnchart</a></td>"," <td><span class=\"milestone\">Beta Milestone <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">100%</span>"," <span class=\"due\">due tomorrow</span>"," <div class=\"outer bar\">"," <div class=\"inner bar green\" style=\"width:100%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">intermine/intermine</a></td>"," <td><span class=\"milestone\">Emma Release 96 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">27%</span>"," <span class=\"due\">due in 2 weeks</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:27%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">microsoft/windows</a></td>"," <td><span class=\"milestone\">RC 9 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">90%</span>"," <span class=\"due red\">overdue by a month</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:90%\"></div>"," </div>"," </div>"," </td>"," </tr>"," -->"," </table>",""," <div class=\"footer\">"," <a href=\"#\"><span class=\"icon cog\"></span> Edit</a>"," </div>"," </div>","{{/projects.list}}"].join("\n"); module.exports = ["{{#projects.list.length}}"," <div id=\"projects\">"," <div class=\"header\">"," <a href=\"#\" class=\"sort\"><span class=\"icon sort-alphabet\"></span> Sorted by priority</a>"," <h2>Projects</h2>"," </div>",""," <table>"," {{#projects.list}}"," {{#milestones}}"," <tr>"," <td><a class=\"repo\">{{owner}}/{{name}}</a></td>"," <td>"," <a class=\"milestone\" href=\"#chart/{{owner}}/{{name}}/{{number}}\">{{ title }}</a>"," </td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">{{Math.floor(format.progress(closed_issues, open_issues))}}%</span>"," <span class=\"due\">{{{ format.due(due_on) }}}</span>"," <div class=\"outer bar\">"," <div class=\"inner bar {{format.onTime(this)}}\" style=\"width:{{format.progress(closed_issues, open_issues)}}%\"></div>"," </div>"," </div>"," </td>"," </tr>"," {{/milestones}}"," {{/projects.list}}",""," <!--"," <tr>"," <td><a class=\"repo\" href=\"#\">radekstepan/disposable</a></td>"," <td><span class=\"milestone\">Milestone 1.0 <span class=\"icon down-open\"></span></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">40%</span>"," <span class=\"due\">due on Friday</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:40%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr class=\"done\">"," <td><a class=\"repo\" href=\"#\">radekstepan/burnchart</a></td>"," <td><span class=\"milestone\">Beta Milestone <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">100%</span>"," <span class=\"due\">due tomorrow</span>"," <div class=\"outer bar\">"," <div class=\"inner bar green\" style=\"width:100%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">intermine/intermine</a></td>"," <td><span class=\"milestone\">Emma Release 96 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">27%</span>"," <span class=\"due\">due in 2 weeks</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:27%\"></div>"," </div>"," </div>"," </td>"," </tr>"," <tr>"," <td><a class=\"repo\" href=\"#\">microsoft/windows</a></td>"," <td><span class=\"milestone\">RC 9 <span class=\"icon down-open\"></span></a></td>"," <td>"," <div class=\"progress\">"," <span class=\"percent\">90%</span>"," <span class=\"due red\">overdue by a month</span>"," <div class=\"outer bar\">"," <div class=\"inner bar red\" style=\"width:90%\"></div>"," </div>"," </div>"," </td>"," </tr>"," -->"," </table>",""," <div class=\"footer\">"," <a href=\"#\"><span class=\"icon cog\"></span> Edit</a>"," </div>"," </div>","{{/projects.list}}"].join("\n");
}); });
// date.coffee // date.coffee
@ -799,23 +799,35 @@
// format.coffee // format.coffee
root.require.register('burnchart/src/utils/format.js', function(exports, require, module) { root.require.register('burnchart/src/utils/format.js', function(exports, require, module) {
var config;
config = require('../models/config');
module.exports = { module.exports = {
'progress': _.memoize(function(a, b) { 'progress': _.memoize(function(a, b) {
return 100 * (a / (b + a)); return 100 * (a / (b + a));
}), }),
'onTime': _.memoize(function(milestone) { 'onTime': _.memoize(function(milestone) {
var a, b, c, points, time; var a, b, c, points, time;
if (!milestone.due_on) {
return 'green';
}
points = this.progress(milestone.closed_issues, milestone.open_issues); points = this.progress(milestone.closed_issues, milestone.open_issues);
a = +new Date(milestone.created_at); a = +new Date(milestone.created_at);
b = +(new Date); b = +(new Date);
c = +new Date(milestone.due_on); c = +new Date(milestone.due_on);
time = this.progress(b - a, c - b); time = this.progress(b - a, c - b);
return ['red', 'green'][+(points > time)]; return ['red', 'green'][+(points > time)];
}, function(m) {
return [m.created_at, m.number].join('/');
}), }),
'fromNow': _.memoize(function(jsonDate) { 'fromNow': _.memoize(function(jsonDate) {
return moment(new Date(jsonDate)).fromNow(); return moment(new Date(jsonDate)).fromNow();
}), }),
'due': function(jsonDate) { 'due': function(jsonDate) {
if (!jsonDate) {
return '&nbsp;';
}
return ['due', this.fromNow(jsonDate)].join(' '); return ['due', this.fromNow(jsonDate)].join(' ');
}, },
'markdown': function(markup) { 'markdown': function(markup) {

View File

@ -16,7 +16,7 @@
<td> <td>
<div class="progress"> <div class="progress">
<span class="percent">{{Math.floor(format.progress(closed_issues, open_issues))}}%</span> <span class="percent">{{Math.floor(format.progress(closed_issues, open_issues))}}%</span>
<span class="due">{{format.due(due_on)}}</span> <span class="due">{{{ format.due(due_on) }}}</span>
<div class="outer bar"> <div class="outer bar">
<div class="inner bar {{format.onTime(this)}}" style="width:{{format.progress(closed_issues, open_issues)}}%"></div> <div class="inner bar {{format.onTime(this)}}" style="width:{{format.progress(closed_issues, open_issues)}}%"></div>
</div> </div>

View File

@ -1,3 +1,5 @@
config = require '../models/config'
module.exports = module.exports =
# Progress in percentages. # Progress in percentages.
@ -6,6 +8,9 @@ module.exports =
# Is a milestone on time? # Is a milestone on time?
'onTime': _.memoize (milestone) -> 'onTime': _.memoize (milestone) ->
# Milestones with no due date are always on track.
return 'green' unless milestone.due_on
# Progress in points. # Progress in points.
points = @progress milestone.closed_issues, milestone.open_issues points = @progress milestone.closed_issues, milestone.open_issues
@ -18,6 +23,8 @@ module.exports =
time = @progress b - a, c - b time = @progress b - a, c - b
[ 'red', 'green' ][ +(points > time) ] [ 'red', 'green' ][ +(points > time) ]
, (m) -> # resolver
[ m.created_at, m.number ].join '/'
# Time from now. # Time from now.
'fromNow': _.memoize (jsonDate) -> 'fromNow': _.memoize (jsonDate) ->
@ -25,6 +32,7 @@ module.exports =
# When is a milestone due? # When is a milestone due?
'due': (jsonDate) -> 'due': (jsonDate) ->
return '&nbsp;' unless jsonDate
[ 'due', @fromNow jsonDate ].join(' ') [ 'due', @fromNow jsonDate ].join(' ')
# Markdown formatting. # Markdown formatting.