mirror of
https://github.com/status-im/burnchart.git
synced 2025-02-03 06:13:40 +00:00
fix empty milestones div by 0
This commit is contained in:
parent
bd9a43e1a9
commit
391adb5388
@ -1,5 +1,6 @@
|
||||
#Tasks to do
|
||||
|
||||
- [ ] success/warn topbar on milestone page is only shown if we async load data
|
||||
- [ ] create notes about how original people can upgrade to burnchart
|
||||
- [ ] clean up docs, track them on git or using Assembly system?
|
||||
- [ ] rename repo to burnchart
|
||||
@ -14,12 +15,12 @@
|
||||
##Next Release
|
||||
|
||||
- [ ] https://github.com/medic/medic-webapp project is overdue and trendline & ideal line end on that date; should max on that date or today's date
|
||||
- [*] https://github.com/ractivejs/ractive gives me NaN for a milestone progress %
|
||||
- [ ] http://burnchart.io#rails I would expect it to list all the projects for that owner so I can select one of them (Ryan)
|
||||
- [ ] why didn't Reset DB load demo data? (Ryan)
|
||||
|
||||
##Backlog
|
||||
|
||||
- [ ] be able to specify milestone by name (will nicely show in title)
|
||||
- [ ] focus on form fields style (blue outline etc)
|
||||
- [ ] switch off `user-select` on buttons
|
||||
- [ ] make async pages transition so that there is no "jumping" on the page
|
||||
@ -30,7 +31,6 @@
|
||||
- [ ] responsive layout
|
||||
- [ ] show project name on the milestone page, in the title
|
||||
- [ ] conctact the people that have starred the original burndown chart telling them about the repo; keep track of connects via a tiny crm/spreadsheet and use a custom email address like radek@burnchart.io
|
||||
- [ ] success/warn topbar on milestone page is only shown if we async load data
|
||||
- [ ] html entities (like & at the bottom of the page) are not being rendered correctly; {{{}}} ?
|
||||
- [ ] `rails/rails/24` has issues in two clusters as if merged from two milestones
|
||||
- [ ] trendline cutting into axes
|
||||
|
@ -1,19 +1,24 @@
|
||||
moment = require 'moment'
|
||||
|
||||
# Progress in %.
|
||||
progress = (a, b) -> 100 * (a / (b + a))
|
||||
progress = (a, b) ->
|
||||
if a + b is 0 then 0 else 100 * (a / (b + a))
|
||||
|
||||
# Calculate the stats for a milestone.
|
||||
# Is it on time? What is the progress?
|
||||
module.exports = (milestone) ->
|
||||
isDone = no ; isOnTime = yes ; isOverdue = no
|
||||
isDone = no ; isOnTime = yes ; isOverdue = no ; isEmpty = yes; points = 0
|
||||
|
||||
# Progress in points.
|
||||
points = progress milestone.issues.closed.size, milestone.issues.open.size
|
||||
isDone = yes if points is 100
|
||||
a = milestone.issues.closed.size
|
||||
b = milestone.issues.open.size
|
||||
if a + b > 0
|
||||
isEmpty = no
|
||||
points = progress a, b
|
||||
isDone = yes if points is 100
|
||||
|
||||
# Milestones with no due date are always on track.
|
||||
return { isOverdue, isOnTime, isDone, 'progress': { points } } unless milestone.due_on
|
||||
return { isOverdue, isOnTime, isDone, isEmpty, 'progress': { points } } unless milestone.due_on
|
||||
|
||||
a = +new Date milestone.created_at
|
||||
b = +new Date
|
||||
|
@ -62,9 +62,17 @@ module.exports = Eventful.extend
|
||||
'system': yes
|
||||
'ttl': null
|
||||
} if err
|
||||
|
||||
|
||||
# Save the milestone with issues.
|
||||
projects.addMilestone project, data
|
||||
|
||||
# No issues?
|
||||
return @publish '!app/notify', {
|
||||
'text': 'The milestone has no issues'
|
||||
'type': 'warn'
|
||||
'system': yes
|
||||
'ttl': null
|
||||
} if data.stats.isEmpty
|
||||
|
||||
# Done?
|
||||
@publish '!app/notify', {
|
||||
|
Loading…
x
Reference in New Issue
Block a user