Campaign::isWithinDateRange function not correct

Created on 15 February 2024, 9 months ago

Problem/Motivation

Ads are visible when Campaign dates are passed. Also looks like the method does not deactivate ads if 'not running'

Steps to reproduce

  1. Create campaign with start and end-date in the past
  2. Configure ad to this campaign

Proposed resolution

Change function:


  public function isWithinDateRange() {
    $start_date = $this->getStartDate();
    $end_date = $this->getEndDate();
    $current_date = $this->getCurrentDate();

    if (!empty($end_date)):

      // Startdate is in te past and enddate is in the future
      if ($start_date <= $current_date && $end_date > $current_date):
        return TRUE;
      endif;
    else:

      // Startdate is in te past
      if ($start_date <= $current_date):
        return TRUE;
      endif;
      
    endif;

    return FALSE;
  }

Remaining tasks

Apply given solution!

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024