Browse Source

Issue #24 - Sort authors by lastname || firstname

If several authors have the same lastname, they are swapped in the list between the different runs.
merge-requests/21/head
Jonathan Druart 3 years ago
parent
commit
081feda766
  1. 33
      lib/Koha/Release.pm

33
lib/Koha/Release.pm

@ -276,6 +276,19 @@ qx|git log --pretty=format:'~-%ct,%an,%ae%n%s%n%n%b%n~----~' $range 2>/dev/null|
}
}
sub sort_authors {
my $authors = shift;
sort {
my ($alast) = $a =~ /(\S+)$/;
my ($blast) = $b =~ /(\S+)$/;
my $cmp = lc($alast) cmp lc($blast);
return $cmp if $cmp;
my ($a2last) = $a =~ /(\S+)\s\S+$/;
my ($b2last) = $b =~ /(\S+)\s\S+$/;
lc($a2last) cmp lc($b2last);
} keys %$authors
}
if (@commits) {
say "Range $range: ", scalar(@commits), " commits";
$self->range_commits( \@commits );
@ -284,11 +297,7 @@ qx|git log --pretty=format:'~-%ct,%an,%ae%n%s%n%n%b%n~----~' $range 2>/dev/null|
$self->range_authors(
[
map { { name => $_, commits => $authors->{$_} } }
sort {
my ($alast) = $a =~ /(\S+)$/;
my ($blast) = $b =~ /(\S+)$/;
lc($alast) cmp lc($blast)
} keys %{$authors}
sort_authors $authors
]
);
@ -296,23 +305,15 @@ qx|git log --pretty=format:'~-%ct,%an,%ae%n%s%n%n%b%n~----~' $range 2>/dev/null|
$self->range_signers(
[
map { { name => $_, signoffs => $signers->{$_} } }
sort {
my ($alast) = $a =~ /(\S+)$/;
my ($blast) = $b =~ /(\S+)$/;
lc($alast) cmp lc($blast)
} keys %{$signers}
sort_authors $signers
]
);
# alphabetised by last 'name' list of mentors
$self->range_mentors(
[
map { { name => $_, mentees => $mentors->{$_} } }
sort {
my ($alast) = $a =~ /(\S+)$/;
my ($blast) = $b =~ /(\S+)$/;
lc($alast) cmp lc($blast)
} keys %{$mentors}
sort_authors $mentors
]
);

Loading…
Cancel
Save