<commit_before>{layout ../@layout.latte}
{block title}{$data->original_title}{/block}
{block head}{/block}
{block content}

{if isset($data->poster_file)}
    <div id="image">
        <img src="{php getcwd().$data->poster_file}"/>
    </div>
{/if}

<h2>{$data|rating}</h2>
{if $data->type === 'series' && false}
    <h3>Average rating from seasons: { $ratingModel->getRatingFromSeasons($data->id)|number:2}</h3>
{/if}
<h3>Men's rating: {$ratingModel->getMenRating($data->id)|number: 2}</h3>
<h3>Women's rating: {$ratingModel->getWomenRating($data->id)|number: 2}</h3>

{var $rating => $ratingModel->getUserRating($data->id, $user->getId())}
{if $rating}
    <h3>My rating:
        {$rating->value}
    </h3>
{/if}

<section>
    {if $data->type === 'season'}
        <ul class="inline-buttons">
            <li>
                <a href="{plink Entity:view $data->season_series_id, type => series}">← Series</a>
            </li>
        </ul>
    {/if}
    <ul class="inline-buttons">
        <li>
            <a href="{plink Entity:default type => $data->type}">← Overview</a>
        </li>
        <li>
            <a href="{plink Entity:list type => $data->type}">← List</a>
        </li>
    </ul>
    <ul class="inline-buttons">
        <li>
            <a href="{plink Entity:edit $data->id}">Edit details</a>
        </li>
        {if $rating}
            <li>
                <a href="{plink Entity:editRating $rating->id}">Edit rating</a>
            </li>
            <li>
                <a href="{plink Entity:removeRating $rating->id}">Remove rating</a>
            </li>
        {else}
            <li>
                <a href="{plink Entity:rate $data->id}">Rate</a>
            </li>
        {/if}
    </ul>
</section>
<section>
    <table class="list">
        {if isset($data->english_title)}
            <tr>
                <th>English title</th>
                <td>{$data->english_title}</td>
            </tr>
        {/if}
        {if isset($data->czech_title)}
            <tr>
                <th>Czech title</th>
                <td>{$data->czech_title}</td>
            </tr>
        {/if}
        {if $data->type === 'series'}
            <tr>
                <th>Status</th>
                <td>{$data->series_active ? 'Running' : 'Finished'}</td>
            </tr>
            {var range = $data->related('entity.season_series_id')->select('MIN(year) AS min, MAX(year) AS max')->fetch()}
            {if $range}
                <tr>
                    <th>Year</th>
                    <td>{$range->min} - {$data->series_active ? 'present' : $range->max}</td>
                </tr>
            {/if}
        {else}<commit_msg>snippe in entity view<commit_after>{layout ../@layout.latte}
{block title}{$data->original_title}{/block}
{block head}{/block}
{block content}

{if isset($data->poster_file)}
    <div id="image">
        <img src="{php getcwd().$data->poster_file}"/>
    </div>
{/if}

<section n:snippet="ratingSection">
    <h2>{$data|rating}</h2>
    {if $data->type === 'series' && false}
        <h3>Average rating from seasons: { $ratingModel->getRatingFromSeasons($data->id)|number:2}</h3>
    {/if}
    <h3>Men's rating: {$ratingModel->getMenRating($data->id)|number: 2}</h3>
    <h3>Women's rating: {$ratingModel->getWomenRating($data->id)|number: 2}</h3>

    {var $rating => $ratingModel->getUserRating($data->id, $user->getId())}
    {if $rating}
        <h3>My rating: {$rating->value}</h3>
    {/if}
    {if $data->type === 'season'}
        <ul class="inline-buttons">
            <li>
                <a href="{plink Entity:view $data->season_series_id, type => series}">← Series</a>
            </li>
        </ul>
    {/if}
    <ul class="inline-buttons">
        <li>
            <a href="{plink Entity:default type => $data->type}">← Overview</a>
        </li>
        <li>
            <a href="{plink Entity:list type => $data->type}">← List</a>
        </li>
    </ul>
    <ul class="inline-buttons">
        <li>
            <a href="{plink Entity:edit $data->id}">Edit details</a>
        </li>
        {if $rating}
            <li>
                <a class="iframePopup" href="{plink Entity:editRating $rating->id, control => ratingSection}">Edit rating</a>
            </li>
        {else}
            <li>
                <a class="iframePopup" href="{plink Entity:rate $data->id, control => ratingSection}">Rate</a>
            </li>
        {/if}
    </ul>
</section>
<section>
    <table class="list">
        {if isset($data->english_title)}
            <tr>
                <th>English title</th>
                <td>{$data->english_title}</td>
            </tr>
        {/if}
        {if isset($data->czech_title)}
            <tr>
                <th>Czech title</th>
                <td>{$data->czech_title}</td>
            </tr>
        {/if}
        {if $data->type === 'series'}
            <tr>
                <th>Status</th>
                <td>{$data->series_active ? 'Running' : 'Finished'}</td>
            </tr>
            {var range = $data->related('entity.season_series_id')->select('MIN(year) AS min, MAX(year) AS max')->fetch()}
            {if $range}
                <tr>
                    <th>Year</th>
                    <td>{$range->min} - {$data->series_active ? 'present' : $range->max}</td>
                </tr>
            {/if}
        {else}
{'fraction_non_alphanumeric': 0.20171994765376705, 'fraction_numerical': 0.004860721630211255, 'mean_word_length': 1.8442317916002127, 'pattern_counts': {'":': 0, '<': 149, '<?xml version=': 0, '>': 226, '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': '4914958', 'n_tokens_mistral': 1835, 'n_tokens_neox': 1777, 'n_words': 331}