<commit_before><?php

require __DIR__ . '/vendor/autoload.php';

date_default_timezone_set('Asia/Tokyo');

if (! empty($_POST)) {
    $client = new Maknz\Slack\Client(getenv('SLACK_WEBHOOK_URL'), [
        'username'   => getenv('SLACK_USERNAME'),
        'channel'    => getenv('SLACK_CHANNEL'),
        'icon'       => getenv('SLACK_ICON'),
        'link_names' => true
    ]);

    ORM::configure('sqlite:./d-frag.db');
    $reports = ORM::for_table('reports')->select('reports.*')->find_many();

    $datetime = new DateTimeImmutable();
    $current  = $datetime->format('Y-m-d H:i:s');

    $text = '';
    if ($slackText = getenv('SLACK_TEXT')) {
        $text .= $slackText;
        $text .= "\n";
        $text .= '----- cut -----';
        $text .= "\n";
    }

    foreach ($reports as $report) {
        if (900 < strtotime($current) - strtotime($report['datetime'])) {
            $text .= '[Name]';
            $text .= "\n";
            $text .= $report['name'];
            $text .= "\n\n";
            $text .= '[Content]';
            $text .= "\n";
            $text .= $report['content'];
            $text .= "\n";
            $text .= '----- cut -----';
            $text .= "\n";

            ORM::for_table('reports')->where_equal('id', $report['id'])->delete_many();
        }
    }

    if ($text !== '') {
        $client->send($text);
    }
}
<commit_msg>Fix notice condition<commit_after><?php

require __DIR__ . '/vendor/autoload.php';

date_default_timezone_set('Asia/Tokyo');

if (! empty($_POST)) {
    ORM::configure('sqlite:./d-frag.db');
    $reports = ORM::for_table('reports')->select('reports.*')->find_many();

    $datetime = new DateTimeImmutable();
    $current  = $datetime->format('Y-m-d H:i:s');

    $text = '';
    if ($slackText = getenv('SLACK_TEXT')) {
        $text .= $slackText;
        $text .= "\n";
        $text .= '----- cut -----';
        $text .= "\n";
    }

    $isNotice = false;
    foreach ($reports as $report) {
        if (900 < strtotime($current) - strtotime($report['datetime'])) {
            $isNotice = true;

            $text .= '[Name]';
            $text .= "\n";
            $text .= $report['name'];
            $text .= "\n\n";
            $text .= '[Content]';
            $text .= "\n";
            $text .= $report['content'];
            $text .= "\n";
            $text .= '----- cut -----';
            $text .= "\n";

            ORM::for_table('reports')->where_equal('id', $report['id'])->delete_many();
        }
    }

    if ($isNotice) {
        $client = new Maknz\Slack\Client(getenv('SLACK_WEBHOOK_URL'), [
            'username'   => getenv('SLACK_USERNAME'),
            'channel'    => getenv('SLACK_CHANNEL'),
            'icon'       => getenv('SLACK_ICON'),
            'link_names' => true
        ]);

        $client->send($text);
    }
}

{'fraction_non_alphanumeric': 0.22593113141250878, 'fraction_numerical': 0.0021082220660576245, 'mean_word_length': 1.8527054108216432, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '4365524', 'n_tokens_mistral': 951, 'n_tokens_neox': 912, 'n_words': 150}