Refactored the way we store metrics
This commit is contained in:
committed by
James Brooks
parent
3730ca8811
commit
f9bc46b460
@@ -19,6 +19,16 @@ class MetricPointPresenter extends BasePresenter implements Arrayable
|
||||
{
|
||||
use TimestampsTrait;
|
||||
|
||||
/**
|
||||
* Show the actual calculated value; as per (value * counter).
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function calculated_value()
|
||||
{
|
||||
return $this->wrappedObject->value * $this->wrappedObject->counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the presenter instance to an array.
|
||||
*
|
||||
@@ -27,8 +37,9 @@ class MetricPointPresenter extends BasePresenter implements Arrayable
|
||||
public function toArray()
|
||||
{
|
||||
return array_merge($this->wrappedObject->toArray(), [
|
||||
'created_at' => $this->created_at(),
|
||||
'updated_at' => $this->updated_at(),
|
||||
'created_at' => $this->created_at(),
|
||||
'updated_at' => $this->updated_at(),
|
||||
'calculated_value' => $this->calculated_value(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user