<commit_before><?php

require_once __DIR__ . '/../index.php';

use Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository as ActivityRepository;
$activityRepository = new ActivityRepository($container['db_connection_locator']);
$pdo = $container['db_connection_locator']->getWrite();

$query = "
    SELECT *
    FROM `jpemeric_stream`.`hulu`
    ORDER BY `date` DESC";
$huluActivities = $pdo->fetchAll($query);
foreach ($huluActivities as $huluActivity) {
    $activityRepository->insertActivity(
        "Watched {$huluActivity['title']} on Hulu.",
        "<p>Watched {$huluActivity['title']} on Hulu.</p>",
        new DateTime($huluActivity['date'], $container['default_timezone']),
        [],
        'hulu',
        $huluActivity['id']
    );
}<commit_msg>Adds historical id to hulu import script<commit_after><?php

require_once __DIR__ . '/../index.php';

use Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository as ActivityRepository;
$activityRepository = new ActivityRepository($container['db_connection_locator']);
$pdo = $container['db_connection_locator']->getWrite();

$query = "
    SELECT `post`.`id`, `hulu`.`id` AS `type_id`, `hulu`.`title`, `hulu`.`date`
    FROM `jpemeric_stream`.`hulu`
    INNER JOIN `jpemeric_stream`.`post` ON `post`.`type_id` = `hulu`.`id` AND
                                           `post`.`type` = 'hulu'
    ORDER BY `hulu`.`date` DESC";
$huluActivities = $pdo->fetchAll($query);
foreach ($huluActivities as $huluActivity) {
    $query = "
        INSERT INTO `jpemeric_stream`.`activity`
            (`id`, `message`, `message_long`, `datetime`, `metadata`, `type`, `type_id`)
        VALUES
            (:id, :message, :message_long, :datetime, :metadata, :type, :type_id)";

    $bindings = [
        'id' => $huluActivity['id'],
        'message' => "Watched {$huluActivity['title']} on Hulu.",
        'message_long' => "<p>Watched {$huluActivity['title']} on Hulu.</p>",
        'datetime' => (new DateTime($huluActivity['date'], $container['default_timezone']))->format('Y-m-d H:i:s'),
        'metadata' => json_encode([]),
        'type' => 'hulu',
        'type_id' => $huluActivity['type_id'],
    ];

    $pdo->perform($query, $bindings);
}
{'fraction_non_alphanumeric': 0.18488529014844804, 'fraction_numerical': 0.0, 'mean_word_length': 3.813852813852814, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7376544', 'n_tokens_mistral': 742, 'n_tokens_neox': 724, 'n_words': 134}