<commit_before>package FixMyStreet::App::Controller::My;
use Moose;
use namespace::autoclean;

BEGIN { extends 'Catalyst::Controller'; }

=head1 NAME

FixMyStreet::App::Controller::My - Catalyst Controller

=head1 DESCRIPTION

Catalyst Controller.

=head1 METHODS

=cut

=head2 index

=cut

sub my : Path : Args(0) {
    my ( $self, $c ) = @_;

    $c->detach( '/auth/redirect' ) unless $c->user;

    my $p_page = $c->req->params->{p} || 1;
    my $u_page = $c->req->params->{u} || 1;

    my $pins = [];
    my $problems = {};
    my $rs = $c->user->problems->search( undef,
        { rows => 50 } )->page( $p_page );

    while ( my $problem = $rs->next ) {
        push @$pins, {
            latitude  => $problem->latitude,
            longitude => $problem->longitude,
            colour    => $problem->state eq 'fixed' ? 'green' : 'red',
            id        => $problem->id,
            title     => $problem->title,
        };
        push @{ $problems->{$problem->state} }, $problem;
    }
    $c->stash->{problems_pager} = $rs->pager;
    $c->stash->{problems} = $problems;

    $rs = $c->user->comments->search(
        { state => 'confirmed' },
        { rows => 50 } )->page( $u_page );
    my @updates = $rs->all;
    $c->stash->{updates} = \@updates;
    $c->stash->{updates_pager} = $rs->pager;

    $c->stash->{page} = 'my';
    FixMyStreet::Map::display_map(
        $c,<commit_msg>Sort reports on My Reports page, whoops.<commit_after>package FixMyStreet::App::Controller::My;
use Moose;
use namespace::autoclean;

BEGIN { extends 'Catalyst::Controller'; }

=head1 NAME

FixMyStreet::App::Controller::My - Catalyst Controller

=head1 DESCRIPTION

Catalyst Controller.

=head1 METHODS

=cut

=head2 index

=cut

sub my : Path : Args(0) {
    my ( $self, $c ) = @_;

    $c->detach( '/auth/redirect' ) unless $c->user;

    my $p_page = $c->req->params->{p} || 1;
    my $u_page = $c->req->params->{u} || 1;

    my $pins = [];
    my $problems = {};
    my $rs = $c->user->problems->search( undef, {
        order_by => { -desc => 'confirmed' },
        rows => 50
    } )->page( $p_page );

    while ( my $problem = $rs->next ) {
        push @$pins, {
            latitude  => $problem->latitude,
            longitude => $problem->longitude,
            colour    => $problem->state eq 'fixed' ? 'green' : 'red',
            id        => $problem->id,
            title     => $problem->title,
        };
        push @{ $problems->{$problem->state} }, $problem;
    }
    $c->stash->{problems_pager} = $rs->pager;
    $c->stash->{problems} = $problems;

    $rs = $c->user->comments->search(
        { state => 'confirmed' },
        {
            order_by => { -desc => 'confirmed' },
            rows => 50
        } )->page( $u_page );
    my @updates = $rs->all;
    $c->stash->{updates} = \@updates;
    $c->stash->{updates_pager} = $rs->pager;

    $c->stash->{page} = 'my';
    FixMyStreet::Map::display_map(
        $c,
{'fraction_non_alphanumeric': 0.20047409414155096, 'fraction_numerical': 0.007450050795800881, 'mean_word_length': 2.3191011235955057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 97, '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': '1676528', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1058, 'n_words': 213}