Making WordPress.org

Changeset 11861


Ignore:
Timestamp:
05/20/2022 08:13:02 PM (2 years ago)
Author:
iandunn
Message:

Events: Move promo_start to where it's used.

All regional camps use the same value, so it doesn't need to be set individually. Moving it here makes it simpler.

Location:
sites/trunk/api.wordpress.org/public_html/events/1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r11860 r11861  
    11991199    );
    12001200
    1201     // `promo_start` should be 2 months before the Event's start date. See `maybe_add_regional_wordcamps()`.
    1202     foreach ( $events as & $event ) {
    1203         $event['promo_start'] = strtotime( $event['event']['date'] . ' - 2 months' );
    1204     }
    1205 
    12061201    return $events;
    12071202}
     
    12851280
    12861281    foreach ( $region_data as $region => $data ) {
    1287         if ( empty( $data['promo_start'] ) ) {
    1288             continue;
    1289         }
    1290 
    1291         $promo_start = $data['promo_start'];
    1292 
    1293         /**
    1294          * The targeted area of the regional camp promotion "zooms in" over the course of 6 weeks.
    1295          */
     1282        $promo_start = strtotime( $data['event']['date'] . ' - 2 months' );
     1283
     1284        // The targeted area of the regional camp promotion "zooms in" over the course of 6 weeks.
    12961285        if ( is_within_date_range( $current_time, $promo_start, strtotime( '+ 2 weeks', $promo_start ) ) ) {
    12971286            // Phase 1: Show worldwide for the first two weeks of the promo (8-6 weeks before the event).
  • sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index.php

    r11624 r11861  
    176176        $region_data = array(
    177177            'us' => array(
    178                 'promo_start' => strtotime( '2019-08-16 00:00:00' ),
    179 
    180178                'regional_countries' => array_merge(
    181179                    get_iso_3166_2_country_codes( 'south america' ),
Note: See TracChangeset for help on using the changeset viewer.