コード例 #1
0
ファイル: Tag.php プロジェクト: kalenjordan/insightengine
 /**
  * @param $tagRecord ORM
  * @return string
  */
 public function lastSentStatus($tagRecord)
 {
     $biggestGap = $tagRecord['biggest_gap_last_30_days'];
     $lastSent = new \Carbon\Carbon($tagRecord['last_sent']);
     $lastSentHoursAgo = $lastSent->diffInHours();
     /**
      * Margin of error
      *
      * If sent 30 emails in last 30 days, 60 / 30 = 2.  So Biggest gap can be 2X of last sent hours ago
      */
     if (isset($tagRecord['send_count_30_days']) && $tagRecord['send_count_30_days'] > 0) {
         $marginOfError = 1.5 + 60 / $tagRecord['send_count_30_days'];
     } else {
         $marginOfError = 99;
     }
     // If the last sent is more than 30% bigger than the biggest gap, flag it
     $status = "good";
     if ($lastSentHoursAgo > $biggestGap * $marginOfError) {
         $status = "bad";
     }
     return $status;
 }
コード例 #2
0
ファイル: coming-soon.blade.php プロジェクト: livecms/core
                // targetDate: {
                //     'day': 30,
                //     'month': 9,
                //     'year': 2015,
                //     'hour': 0,
                //     'min': 0,
                //     'sec': 0
                // },
                // omitWeeks: true

                <?php 
$launchingDateTime = !empty($global_params['launching_datetime']) ? $global_params['launching_datetime'] : '2017-01-01 00:00:00';
$datetime = new Carbon\Carbon($launchingDateTime);
$sec = $datetime->diffInSeconds() % 60;
$min = $datetime->diffInMinutes() % 60;
$hour = $datetime->diffInHours() % 24;
$day = $datetime->diffInDays() % 30;
$month = $datetime->diffInMonths() % 12;
$year = $datetime->diffInYears();
?>

                 targetOffset: {
                    'day':      {{ $day }},
                    'month':    {{ $month }},
                    'year':     {{ $year }},
                    'hour':     {{ $hour }},
                    'min':      {{ $min }},
                    'sec':      {{ $sec }}
                },
                omitWeeks: true