<commit_before><?php
get_header();
?>

<main id="main-content">

  <div id="page-home" class="container">

    <?php
      if (IGV_get_option('_igv_home_options', '_igv_carousel_shown')) {
        get_template_part('partials/custom-pages/home/carousel');
      }
    ?>

    <?php
      $now = new \Moment\Moment('now', 'Europe/London');
      $tomorrow = $now->addDays(1);
      $midnight = $tomorrow->startOf('day');
      $midnight_timestamp = strtotime($midnight->format());

      $forthcoming_events = new WP_Query(array(
        'post_type' => 'event',
        'posts_per_page' => 3,
        'orderby' => 'meta_value',
        'order' => 'ASC',
        'meta_key' => '_igv_event_datetime',

        'meta_query' => array(
          array(
            'key'     => '_igv_event_datetime',
            'value'   => $midnight_timestamp,
            'type'    => 'numeric',
            'compare' => '>',
          ),
        ),
      ));

      if ($forthcoming_events->have_posts()) {
        $post_count = $forthcoming_events->post_count;
    ?>

    <div class="grid-row margin-top-basic margin-bottom-small">
      <?php render_divider('<a href="' . home_url('live') . '">Forthcoming Live Events +</a>'); ?>
    </div>

    <div class="grid-row justify-center margin-bottom-large">
    <?php
        while ($forthcoming_events->have_posts()) {
          $forthcoming_events->the_post();
          get_template_part('partials/custom-pages/event-forthcoming');
        }
    ?>
    </div>

    <?php
      }

      $ad1_text = IGV_get_option('_igv_home_options', '_igv_ad1_text');
      $ad1_image_id = IGV_get_option('_igv_home_options', '_igv_ad1_image_id');
      $ad1_link = IGV_get_option('_igv_home_options', '_igv_ad1_link');
      $ad1_link_external = IGV_get_option('_igv_home_options', '_igv_ad1_link_external');

      if ($ad1_text && $ad1_image_id) {
    ?>
    <div class="grid-row margin-bottom-mid">
      <?php render_ad($ad1_text, $ad1_image_id, $ad1_link, $ad1_link_external); ?>
    </div>
    <?php
      }
    ?>

    <div class="grid-row margin-bottom-small">
      <?php render_divider('<a href="' . home_url('sound-and-vision') . '">Sound & Vision +</a>'); ?>
    </div>

    <div class="shuffle-section media-items margin-bottom-basic">
      <div class="shuffle-preloader"></div>
      <div class="shuffle-container grid-row hidden">

    <?php
      $overrides = IGV_get_option('_igv_home_options', '_igv_override_events');
      $posts = 3;
      $not_in = array();

      if ($overrides) {
        $overrides = explode(', ', $overrides);

        $posts = $posts - count($overrides);
        $not_in = $overrides;
      }

      $past_args = array(
        'post_type' => 'event',
        'posts_per_page' => $posts,
        'post__not_in' => $not_in,

        'meta_query' => array(
          array(
            'key'     => '_igv_event_datetime',
            'value'   => $midnight_timestamp,
            'type'    => 'numeric',
            'compare' => '<',
          ),
          array(
            'relation' => 'OR',
            array(
              'key' => '_igv_vimeo_id',
              'compare' => 'EXISTS'
            ),
            array(
              'key' => '_igv_soundcloud_url',
              'compare' => 'EXISTS'
            )
          )
        ),
      );

      $past_events = get_posts($past_args);

      $past_event_ids = array_map('array_map_filter_ids', $past_events);

      if ($overrides) {
        $past_event_ids = array_merge($overrides, $past_event_ids);
      }

      $past_events = new WP_Query(array(
        'post_type' => 'event',
        'post__in' => $past_event_ids,
        'meta_query' => array(
          array(
            'key'     => '_igv_event_datetime',
            'value'   => $midnight_timestamp,
            'type'    => 'numeric',
            'compare' => '<',
          ),
          array(
            'relation' => 'OR',
            array(
              'key' => '_igv_vimeo_id',
              'compare' => 'EXISTS'
            ),
            array(
              'key' => '_igv_soundcloud_url',
              'compare' => 'EXISTS'
            )
          )
        ),
      ));

      if ($past_events->have_posts()) {
        while ($past_events->have_posts()) {
          $past_events->the_post();
          get_template_part('partials/custom-pages/event-media');
        }<commit_msg>fix overrides logic<commit_after><?php
get_header();
?>

<main id="main-content">

  <div id="page-home" class="container">

    <?php
      if (IGV_get_option('_igv_home_options', '_igv_carousel_shown')) {
        get_template_part('partials/custom-pages/home/carousel');
      }
    ?>

    <?php
      $now = new \Moment\Moment('now', 'Europe/London');
      $tomorrow = $now->addDays(1);
      $midnight = $tomorrow->startOf('day');
      $midnight_timestamp = strtotime($midnight->format());

      $forthcoming_events = new WP_Query(array(
        'post_type' => 'event',
        'posts_per_page' => 3,
        'orderby' => 'meta_value',
        'order' => 'ASC',
        'meta_key' => '_igv_event_datetime',

        'meta_query' => array(
          array(
            'key'     => '_igv_event_datetime',
            'value'   => $midnight_timestamp,
            'type'    => 'numeric',
            'compare' => '>',
          ),
        ),
      ));

      if ($forthcoming_events->have_posts()) {
        $post_count = $forthcoming_events->post_count;
    ?>

    <div class="grid-row margin-top-basic margin-bottom-small">
      <?php render_divider('<a href="' . home_url('live') . '">Forthcoming Live Events +</a>'); ?>
    </div>

    <div class="grid-row justify-center margin-bottom-large">
    <?php
        while ($forthcoming_events->have_posts()) {
          $forthcoming_events->the_post();
          get_template_part('partials/custom-pages/event-forthcoming');
        }
    ?>
    </div>

    <?php
      }

      $ad1_text = IGV_get_option('_igv_home_options', '_igv_ad1_text');
      $ad1_image_id = IGV_get_option('_igv_home_options', '_igv_ad1_image_id');
      $ad1_link = IGV_get_option('_igv_home_options', '_igv_ad1_link');
      $ad1_link_external = IGV_get_option('_igv_home_options', '_igv_ad1_link_external');

      if ($ad1_text && $ad1_image_id) {
    ?>
    <div class="grid-row margin-bottom-mid">
      <?php render_ad($ad1_text, $ad1_image_id, $ad1_link, $ad1_link_external); ?>
    </div>
    <?php
      }
    ?>

    <div class="grid-row margin-bottom-small">
      <?php render_divider('<a href="' . home_url('sound-and-vision') . '">Sound & Vision +</a>'); ?>
    </div>

    <div class="shuffle-section media-items margin-bottom-basic">
      <div class="shuffle-preloader"></div>
      <div class="shuffle-container grid-row hidden">

    <?php
      $overrides = IGV_get_option('_igv_home_options', '_igv_override_events');
      $total_posts = 3;
      $posts_needed = $total_posts;
      $not_in = array();

      if ($overrides) {
        $overrides = explode(', ', $overrides);

        $posts_needed = $posts_needed - count($overrides);
        $not_in = $overrides;
      }

      if ($posts_needed > 0) {

        $past_args = array(
          'post_type' => 'event',
          'posts_per_page' => $posts_needed,
          'post__not_in' => $not_in,

          'meta_query' => array(
            array(
              'key'     => '_igv_event_datetime',
              'value'   => $midnight_timestamp,
              'type'    => 'numeric',
              'compare' => '<',
            ),
            array(
              'relation' => 'OR',
              array(
                'key' => '_igv_vimeo_id',
                'compare' => 'EXISTS'
              ),
              array(
                'key' => '_igv_soundcloud_url',
                'compare' => 'EXISTS'
              )
            )
          ),
        );

        $past_events = get_posts($past_args);

        $past_event_ids = array_map('array_map_filter_ids', $past_events);

        if ($overrides) {
          $past_event_ids = array_merge($overrides, $past_event_ids);
        }

      } else {

        $past_event_ids = $overrides;

      }

      $past_events = new WP_Query(array(
        'post_type' => 'event',
        'posts_per_page' => $total_posts,
        'post__in' => $past_event_ids,
        'meta_query' => array(
          array(
            'key'     => '_igv_event_datetime',
            'value'   => $midnight_timestamp,
            'type'    => 'numeric',
            'compare' => '<',
          ),
          array(
            'relation' => 'OR',
            array(
              'key' => '_igv_vimeo_id',
              'compare' => 'EXISTS'
            ),
            array(
              'key' => '_igv_soundcloud_url',
              'compare' => 'EXISTS'
            )
          )
        ),
      ));

      if ($past_events->have_posts()) {
        while ($past_events->have_posts()) {
          $past_events->the_post();
          get_template_part('partials/custom-pages/event-media');
        }
{'fraction_non_alphanumeric': 0.16162958042732203, 'fraction_numerical': 0.0038746817225727885, 'mean_word_length': 1.9884220972543831, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 151, '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': '2586127', 'n_tokens_mistral': 3072, 'n_tokens_neox': 2966, 'n_words': 442}