<commit_before>package GADS::Role::Presentation::Datum::Person;

use Moo::Role;

sub _presentation_details {
    my $self = shift;

    return [] unless $self->id;

    my $site = $self->column->layout->site;

    my @details;

    if (my $email = $self->email) {
        push @details, {
            value => $self->email,
            type  => 'email'
        };
    }

    for (
        [$self->freetext1, $site->register_freetext1_name],
        [$self->freetext2, $site->register_freetext2_name]
    ) {
        next unless $_->[0];

        push @details, {
            definition => $_->[1],
            value      => $_->[0],
            type       => 'text'
        };
    }

    return \@details;
}

sub presentation {
    my $self = shift;

    my $base = $self->presentation_base;
    delete $base->{value};

    $base->{text}    = $self->text;
    $base->{details} = $self->_presentation_details;
    $base->{id}      = $self->id;

    return $base;
}

1;<commit_msg>Fix display of names in group by person<commit_after>package GADS::Role::Presentation::Datum::Person;

use Moo::Role;

sub _presentation_details {
    my $self = shift;

    return [] unless $self->id;

    my $site = $self->column->layout->site;

    my @details;

    if (my $email = $self->email) {
        push @details, {
            value => $self->email,
            type  => 'email'
        };
    }

    for (
        [$self->freetext1, $site->register_freetext1_name],
        [$self->freetext2, $site->register_freetext2_name]
    ) {
        next unless $_->[0];

        push @details, {
            definition => $_->[1],
            value      => $_->[0],
            type       => 'text'
        };
    }

    return \@details;
}

sub presentation {
    my $self = shift;

    my $base = $self->presentation_base;
    delete $base->{value};

    $base->{text}    = $self->text;
    $base->{value}   = $self->text;
    $base->{details} = $self->_presentation_details;
    $base->{id}      = $self->id;

    return $base;
}

1;
{'fraction_non_alphanumeric': 0.17227722772277226, 'fraction_numerical': 0.007920792079207921, 'mean_word_length': 1.9676945668135095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 57, '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': '357958', 'n_tokens_mistral': 703, 'n_tokens_neox': 669, 'n_words': 136}