Sort saved searches
This commit is contained in:
parent
b15743385f
commit
4b1699da22
11
pr-status.pl
11
pr-status.pl
@ -55,10 +55,14 @@ sub save_search {
|
||||
@$searches,
|
||||
{
|
||||
pull_request => $r->{pull_request},
|
||||
title => $r->{title}
|
||||
title => $r->{title},
|
||||
epoch => time
|
||||
}
|
||||
) unless grep { $r->{pull_request} == $_->{pull_request} } @$searches;
|
||||
|
||||
my @sorted = reverse sort { $a->{epoch} <=> $b->{epoch} } @$searches;
|
||||
$searches = \@sorted;
|
||||
|
||||
open my $fh, ">", "${work_dir}/searches.json" or die $!;
|
||||
print $fh encode_json($searches);
|
||||
close $fh;
|
||||
@ -70,6 +74,8 @@ sub load_searches {
|
||||
$searches = decode_json <$fh>;
|
||||
close $fh;
|
||||
}
|
||||
my @sorted = reverse sort { $a->{epoch} <=> $b->{epoch} } @$searches;
|
||||
$searches = \@sorted;
|
||||
}
|
||||
|
||||
sub get_commit {
|
||||
@ -214,6 +220,9 @@ get '/:pr' => sub ($c) {
|
||||
|
||||
my ( $release, $status ) = figure_status($list);
|
||||
|
||||
my @sorted = reverse sort { $a->{epoch} <=> $b->{epoch} } @$searches;
|
||||
$searches = \@sorted;
|
||||
|
||||
my $result = {
|
||||
title => $title,
|
||||
branches => $list,
|
||||
|
Loading…
Reference in New Issue
Block a user