mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 05:12:11 +01:00
fix: show more authors
This commit is contained in:
parent
fe198b1018
commit
95176aeed0
1 changed files with 7 additions and 6 deletions
13
lib/index.js
13
lib/index.js
|
@ -1175,15 +1175,15 @@ GitStats.prototype.authors = function (options, callback) {
|
||||||
*/
|
*/
|
||||||
GitStats.prototype.authorsPie = function (options, callback) {
|
GitStats.prototype.authorsPie = function (options, callback) {
|
||||||
|
|
||||||
const radius = Math.round(process.stdout.rows / 2) || 20;
|
|
||||||
|
|
||||||
if (typeof options === "string") {
|
if (typeof options === "string") {
|
||||||
options = {
|
options = {
|
||||||
repo: options
|
repo: options
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
options = Ul.merge(options, { radius });
|
options = Ul.merge(options, {
|
||||||
|
radius: process.stdout.rows / 2 || 20
|
||||||
|
});
|
||||||
|
|
||||||
if (!IsThere(options.repo)) {
|
if (!IsThere(options.repo)) {
|
||||||
return callback(new Error("The repository folder doesn't exist."));
|
return callback(new Error("The repository folder doesn't exist."));
|
||||||
|
@ -1196,15 +1196,16 @@ GitStats.prototype.authorsPie = function (options, callback) {
|
||||||
;
|
;
|
||||||
|
|
||||||
self.authors(options, function (err, authors) {
|
self.authors(options, function (err, authors) {
|
||||||
|
const maxAuthors = 2 * options.radius;
|
||||||
if (err) { return callback(err); }
|
if (err) { return callback(err); }
|
||||||
if (authors.length > radius) {
|
if (authors.length > maxAuthors) {
|
||||||
var others = {
|
var others = {
|
||||||
value: authors.slice(radius).reduce(function (a, b) {
|
value: authors.slice(maxAuthors).reduce(function (a, b) {
|
||||||
return a + b.value;
|
return a + b.value;
|
||||||
}, 0)
|
}, 0)
|
||||||
, label: "Others"
|
, label: "Others"
|
||||||
};
|
};
|
||||||
authors = authors.slice(0, radius);
|
authors = authors.slice(0, maxAuthors);
|
||||||
authors.push(others);
|
authors.push(others);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue