<commit_before><?php

use app\models\Event;
use app\models\Cart;
use yii\helpers\Html;

/* @var $this yii\web\View */

$_event = Event::findOne(2);
$location = $_event->getLocation()->one();
$formatter = Yii::$app->formatter;

$this->title = Yii::t('app', '{owner} - {event}', ['owner' => $_event->owner->name, 'event' => $_event->name]);
?>
<div class="site-index">

    <h1><?= $this->title; ?></h1>
    <h2><?= $formatter->asDate($_event->start_time) ?> - <?= $formatter->asDate($_event->end_time) ?></h2>
    <h3><?= Yii::t('app', '{name}, {address}, {postcode}', ['name' => $location->name, 'address' => $location->address, 'postcode' => $location->postcode]) ?></h3>

    <p><?= $_event->description ?></p>
    <hr>
    <div class="body-content">
        <?php if (Yii::$app->user->isGuest) : ?>
            <p>
                <?=
                Yii::t('app', "If you're not registered, do so now or login: {register} {login}", [
                    'register' => Html::a(Yii::t('app', 'Register'), ['/register'], ['class' => 'btn btn-warning']),
                    'login' => Html::a(Yii::t('app', 'Login'), ['/login'], ['class' => 'btn btn-success'])
                ]);
                ?>
            </p>
        <?php else : ?>
            <p><?= Yii::t('app', "You're logged in! Add tickets to {cartbtn}!", ['cartbtn' => Html::a(Yii::t('app', 'your cart'), ['/cart'])]) ?></p>
        <?php endif; ?>

        <?php
        foreach ($_event->ticketGroups as $group) {
            if (sizeof($_event->ticketGroups) > 1) {
                ?><h2><?= $group->name ?></h2><?php
            }
            $group_sold_out = false;
            if ($group->ticket_limit > 0) { // limited sales
                $sold_count_all = 0;
                $sold_count = [];
                foreach ($group->tickets as $ticket) {
                    $sold_count[$ticket->id] = 0;
                    foreach ($ticket->cartItems as $cartItems) {
                        if ($cartItems->cart->status == Cart::CART_SOLD) {
                            $sold_count_all += $cartItems->quantity;
                            $sold_count[$ticket->id] += $cartItems->quantity;
                        }
                    }
                }
                if ($sold_count_all >= $group->ticket_limit) {
                    $group_sold_out = true;
                }
            }
<commit_msg>event updates<commit_after><?php

use app\models\Event;
use app\models\Cart;
use yii\helpers\Html;

/* @var $this yii\web\View */

$_event = Event::findOne(2);
$location = $_event->getLocation()->one();
$formatter = Yii::$app->formatter;

$this->title = Yii::t('app', '{owner} - {event}', ['owner' => $_event->owner->name, 'event' => $_event->name]);
?>
<div class="site-index">

    <h1><?= $this->title; ?></h1>
    <h2><?= $formatter->asDate($_event->start_time) ?> - <?= $formatter->asDate($_event->end_time) ?></h2>
    <h3><?= Yii::t('app', '{name}, {address}, {postcode}', ['name' => $location->name, 'address' => $location->address, 'postcode' => $location->postcode]) ?></h3>

    <p><?= nl2br( $_event->description ) ?></p>
    <hr>
    <div class="body-content">
        <?php if (Yii::$app->user->isGuest) : ?>
            <p>
                <?=
                Yii::t('app', "If you're not registered, do so now or login: {register} {login}", [
                    'register' => Html::a(Yii::t('app', 'Register'), ['/register'], ['class' => 'btn btn-warning']),
                    'login' => Html::a(Yii::t('app', 'Login'), ['/login'], ['class' => 'btn btn-success'])
                ]);
                ?>
            </p>
        <?php else : ?>
            <p><?= Yii::t('app', "You're logged in! Add tickets to {cartbtn}!", ['cartbtn' => Html::a(Yii::t('app', 'your cart'), ['/cart'])]) ?></p>
        <?php endif; ?>

        <?php
        foreach ($_event->ticketGroups as $group) {
            if (sizeof($_event->ticketGroups) > 1 && sizeof($group->tickets) > 0) {
                ?><h2><?= $group->name ?></h2><?php
            }
            $group_sold_out = false;
            if ($group->ticket_limit > 0) { // limited sales
                $sold_count_all = 0;
                $sold_count = [];
                foreach ($group->tickets as $ticket) {
                    $sold_count[$ticket->id] = 0;
                    foreach ($ticket->cartItems as $cartItems) {
                        if ($cartItems->cart->status == Cart::CART_SOLD) {
                            $sold_count_all += $cartItems->quantity;
                            $sold_count[$ticket->id] += $cartItems->quantity;
                        }
                    }
                }
                if ($sold_count_all >= $group->ticket_limit) {
                    $group_sold_out = true;
                }
            }

{'fraction_non_alphanumeric': 0.21583333333333332, 'fraction_numerical': 0.005833333333333334, 'mean_word_length': 1.8904274533413605, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 153, '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': '216405', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1507, 'n_words': 292}