update modules
This commit is contained in:
parent
cb5d6ea712
commit
3c79a905b3
|
@ -8,7 +8,7 @@ export default {
|
||||||
|
|
||||||
// A graph of closed issues.
|
// A graph of closed issues.
|
||||||
// `issues`: closed issues list
|
// `issues`: closed issues list
|
||||||
// `created_at`: milestone start date
|
// `created_at`: project start date
|
||||||
// `total`: total number of points (open & closed issues)
|
// `total`: total number of points (open & closed issues)
|
||||||
actual(issues, created_at, total) {
|
actual(issues, created_at, total) {
|
||||||
let min, max;
|
let min, max;
|
||||||
|
@ -44,8 +44,8 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// A graph of an ideal progression..
|
// A graph of an ideal progression..
|
||||||
// `a`: milestone start date
|
// `a`: project start date
|
||||||
// `b`: milestone end date
|
// `b`: project end date
|
||||||
// `total`: total number of points (open & closed issues)
|
// `total`: total number of points (open & closed issues)
|
||||||
ideal(a, b, total) {
|
ideal(a, b, total) {
|
||||||
// Swap if end is before the start...
|
// Swap if end is before the start...
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default {
|
||||||
return moment(jsonDate, moment.ISO_8601).fromNow();
|
return moment(jsonDate, moment.ISO_8601).fromNow();
|
||||||
},
|
},
|
||||||
|
|
||||||
// When is a milestone due?
|
// When is a project due?
|
||||||
due(jsonDate) {
|
due(jsonDate) {
|
||||||
if (!jsonDate) {
|
if (!jsonDate) {
|
||||||
return '\u00a0'; // for React
|
return '\u00a0'; // for React
|
||||||
|
@ -25,12 +25,12 @@ export default {
|
||||||
marked.apply(null, args);
|
marked.apply(null, args);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Format milestone title.
|
// Format project title.
|
||||||
title(text) {
|
title(text) {
|
||||||
if (text.toLowerCase().indexOf('milestone') > -1) {
|
if (text.toLowerCase().indexOf('project') > -1) {
|
||||||
return text;
|
return text;
|
||||||
} else {
|
} else {
|
||||||
return `Milestone ${text}`;
|
return `Project ${text}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import async from 'async';
|
||||||
import config from '../../../config.js';
|
import config from '../../../config.js';
|
||||||
import request from './request.js';
|
import request from './request.js';
|
||||||
|
|
||||||
|
// TODO needs a rewrite to support issues coming from GraphQL.
|
||||||
|
|
||||||
// Fetch issues for a milestone.
|
// Fetch issues for a milestone.
|
||||||
export default {
|
export default {
|
||||||
fetchAll: (user, repo, cb) => {
|
fetchAll: (user, repo, cb) => {
|
||||||
|
@ -68,13 +70,13 @@ let calcSize = (list) => {
|
||||||
let oneStatus = (user, repo, state, cb) => {
|
let oneStatus = (user, repo, state, cb) => {
|
||||||
// Concat them here.
|
// Concat them here.
|
||||||
let results = [];
|
let results = [];
|
||||||
|
|
||||||
let done = (err) => {
|
let done = (err) => {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
// Sort by closed time and add the size.
|
// Sort by closed time and add the size.
|
||||||
cb(null, calcSize(_.sortBy(results, 'closed_at')));
|
cb(null, calcSize(_.sortBy(results, 'closed_at')));
|
||||||
};
|
};
|
||||||
|
|
||||||
let fetchPage;
|
let fetchPage;
|
||||||
// One pageful fetch (next pages in series).
|
// One pageful fetch (next pages in series).
|
||||||
return (fetchPage = (page) => {
|
return (fetchPage = (page) => {
|
||||||
|
|
|
@ -10,11 +10,11 @@ let progress = (a, b) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate the stats for a milestone.
|
// Calculate the stats for a project.
|
||||||
// Is it on time? What is the progress?
|
// Is it on time? What is the progress?
|
||||||
export default (milestone) => {
|
export default (project) => {
|
||||||
// Makes testing easier...
|
// Makes testing easier...
|
||||||
if (milestone.stats != null) return milestone.stats;
|
if (project.stats != null) return project.stats;
|
||||||
|
|
||||||
let points = 0, a, b, c, time, days, span;
|
let points = 0, a, b, c, time, days, span;
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ export default (milestone) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Progress in points.
|
// Progress in points.
|
||||||
let i = milestone.issues.closed.size,
|
let i = project.issues.closed.size,
|
||||||
j = milestone.issues.open.size;
|
j = project.issues.open.size;
|
||||||
if (i) {
|
if (i) {
|
||||||
stats.isEmpty = false;
|
stats.isEmpty = false;
|
||||||
if (i + j > 0) {
|
if (i + j > 0) {
|
||||||
|
@ -36,20 +36,20 @@ export default (milestone) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that milestone hasn't been created after issue close; #100.
|
// Check that project hasn't been created after issue close; #100.
|
||||||
if (milestone.issues.closed.size) {
|
if (project.issues.closed.size) {
|
||||||
milestone.created_at = _.reduce(milestone.issues.closed.list
|
project.created_at = _.reduce(project.issues.closed.list
|
||||||
, (x, { closed_at }) => (x > closed_at) ? closed_at : x
|
, (x, { closed_at }) => (x > closed_at) ? closed_at : x
|
||||||
, milestone.created_at);
|
, project.created_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The dates in this milestone.
|
// The dates in this project.
|
||||||
a = moment(milestone.created_at, moment.ISO_8601);
|
a = moment(project.created_at, moment.ISO_8601);
|
||||||
b = moment.utc();
|
b = moment.utc();
|
||||||
c = moment(milestone.due_on, moment.ISO_8601);
|
c = moment(project.due_on, moment.ISO_8601);
|
||||||
|
|
||||||
// Milestones with no due date are always on track.
|
// Milestones with no due date are always on track.
|
||||||
if (!(milestone.due_on != null)) {
|
if (!(project.due_on != null)) {
|
||||||
// The number of days from start to now.
|
// The number of days from start to now.
|
||||||
span = b.diff(a, 'days');
|
span = b.diff(a, 'days');
|
||||||
return _.extend(stats, { span, 'progress': { points } });
|
return _.extend(stats, { span, 'progress': { points } });
|
||||||
|
|
Loading…
Reference in New Issue