<commit_before>package R6::Controller::Manager;
use Mojo::Base 'Mojolicious::Controller';
use Mojo::JSON qw/to_json/;
use Number::Denominal;
use Date::Manip;

sub settings {
    my $self = shift;
    return $self->reply->not_found unless ($self->user)[1];

    $self->vars( $_ => $self->param($_) )
        for qw/last_release_date  next_release_date/;

    $self->redirect_to( $self->req->headers->referrer );
}

sub release_stats {
    my $self = shift;

    my ($last_release, $next_release) = map UnixDate($_, '%s')//0,
            $self->vars('last_release_date'),
            $self->vars('next_release_date');

    my $when_release = $next_release - time;
    if ( abs($when_release) <= 60*60*24 ) {
        $when_release = 'is today';
    }
    elsif ( $when_release < 0 ) {
        $when_release = 'is in the past';
    }
    else {
        $when_release = 'will be in ' . denominal(
            $when_release, \'time', { precision => 2 },
        );
    }

    my @tickets = grep {
        UnixDate($_->{created}, '%s') >= $last_release
    } $self->rt->all;

    my @commits = $self->rakudo_commits->all;

    for (@commits) {
        $_->{log_message} = '- ' . (split /\n/, $_->{message})[0]
            . ' [' . substr($_->{sha}, 0, 8) .']';
        $_->{log_message} =~ s/Fix/Fixed/g;
        $_->{log_message} =~ s/Make/Made/g;
        $_->{log_message} =~ s/\Q[io grant] //;
        $_->{log_message} =~ s/(\S+?[`><*]\S+)/`$1`/g;
    }

    my $blockers         = grep $_->{is_blocker},  @tickets;
    my $reviewed_tickets = grep $_->{is_reviewed}, @tickets;
    my $reviewed_commits = grep $_->{is_added},    @commits;

    my %info = (
        when_release => $when_release,
        tickets      => \@tickets,
        commits      => \@commits,
        blockers     => $blockers,
        unreviewed_tickets => @tickets - $reviewed_tickets,
        unreviewed_commits => @commits - $reviewed_commits,
    );

    $self->stash(%info);
    $self->respond_to(
        html => { template => 'manager/release_stats' },<commit_msg>Use `+` instead of `-` for log messages<commit_after>package R6::Controller::Manager;
use Mojo::Base 'Mojolicious::Controller';
use Mojo::JSON qw/to_json/;
use Number::Denominal;
use Date::Manip;

sub settings {
    my $self = shift;
    return $self->reply->not_found unless ($self->user)[1];

    $self->vars( $_ => $self->param($_) )
        for qw/last_release_date  next_release_date/;

    $self->redirect_to( $self->req->headers->referrer );
}

sub release_stats {
    my $self = shift;

    my ($last_release, $next_release) = map UnixDate($_, '%s')//0,
            $self->vars('last_release_date'),
            $self->vars('next_release_date');

    my $when_release = $next_release - time;
    if ( abs($when_release) <= 60*60*24 ) {
        $when_release = 'is today';
    }
    elsif ( $when_release < 0 ) {
        $when_release = 'is in the past';
    }
    else {
        $when_release = 'will be in ' . denominal(
            $when_release, \'time', { precision => 2 },
        );
    }

    my @tickets = grep {
        UnixDate($_->{created}, '%s') >= $last_release
    } $self->rt->all;

    my @commits = $self->rakudo_commits->all;

    for (@commits) {
        $_->{log_message} = '+ ' . (split /\n/, $_->{message})[0]
            . ' [' . substr($_->{sha}, 0, 8) .']';
        $_->{log_message} =~ s/Fix/Fixed/g;
        $_->{log_message} =~ s/Make/Made/g;
        $_->{log_message} =~ s/\Q[io grant] //;
        $_->{log_message} =~ s/(\S+?[`><*]\S+)/`$1`/g;
    }

    my $blockers         = grep $_->{is_blocker},  @tickets;
    my $reviewed_tickets = grep $_->{is_reviewed}, @tickets;
    my $reviewed_commits = grep $_->{is_added},    @commits;

    my %info = (
        when_release => $when_release,
        tickets      => \@tickets,
        commits      => \@commits,
        blockers     => $blockers,
        unreviewed_tickets => @tickets - $reviewed_tickets,
        unreviewed_commits => @commits - $reviewed_commits,
    );

    $self->stash(%info);
    $self->respond_to(
        html => { template => 'manager/release_stats' },
{'fraction_non_alphanumeric': 0.19182083739045763, 'fraction_numerical': 0.007302823758519961, 'mean_word_length': 2.4014900662251657, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1656293', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1453, 'n_words': 271}