You are here

function acquia_lift_config_min_runtime in Acquia Lift Connector 7

Calculates and returns the minimum runtime for campaigns in seconds.

Return value

int The minium number of seconds all campaigns must be allowed to run for before being stopped automatically when a winner is found.

1 call to acquia_lift_config_min_runtime()
AcquiaLiftAgent::create in plugins/agent_types/AcquiaLiftAgent.inc
Implements PersonalizeAgentInterface::create().

File

./acquia_lift.module, line 2996
acquia_lift.module Provides Acquia Lift-specific personalization functionality.

Code

function acquia_lift_config_min_runtime() {
  $num = variable_get('acquia_lift_min_runtime_num', 2);
  if (empty($num)) {
    return 0;
  }
  $unit = variable_get('acquia_lift_min_runtime_unit', 'week');
  switch ($unit) {
    case 'minute':
      return $num * 60;
    case 'hour':
      return $num * 60 * 60;
    case 'day':
      return $num * 60 * 60 * 24;
    case 'week':
      return $num * 60 * 60 * 24 * 7;
  }
  return 0;
}