Update code to match master
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
@@ -15,7 +14,7 @@ use Watson\Validating\ValidatingTrait;
|
||||
*/
|
||||
class ComponentGroup extends Model
|
||||
{
|
||||
use SoftDeletes, ValidatingTrait;
|
||||
use ValidatingTrait;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
@@ -33,13 +32,6 @@ class ComponentGroup extends Model
|
||||
*/
|
||||
protected $fillable = ['name'];
|
||||
|
||||
/**
|
||||
* The attributes that should be mutated to dates.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
/**
|
||||
* A group can have many components.
|
||||
*
|
||||
|
||||
@@ -14,6 +14,8 @@ use Watson\Validating\ValidatingTrait;
|
||||
* @property string $name
|
||||
* @property string $suffix
|
||||
* @property string $description
|
||||
* @property float $default_value
|
||||
* @property int $calc_type
|
||||
* @property int $display_chart
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
@@ -90,6 +92,8 @@ class Metric extends Model
|
||||
$queryType = "sum(metric_points.value)";
|
||||
} elseif ($this->calc_type === self::CALC_AVG) {
|
||||
$queryType = "avg(metric_points.value)";
|
||||
} else {
|
||||
$queryType = "sum(metric_points.value)";
|
||||
}
|
||||
|
||||
$query = DB::select("select {$queryType} as aggregate FROM metrics JOIN metric_points ON metric_points.metric_id = metrics.id WHERE to_char(metric_points.created_at, 'YYYYMMDDHH') = :timestamp AND to_char(metric_points.created_at, 'H') = to_char(now() - interval '{$hour} hour', 'H') GROUP BY to_char(metric_points.created_at, 'H')", [
|
||||
|
||||
Reference in New Issue
Block a user