Correction in the query of the PLD table referring to max, min, desv_pad.
This commit is contained in:
parent
1d5c83fd90
commit
e4f7b17958
@ -203,17 +203,17 @@ class PldRepository extends AbstractRepository implements PldContractInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static function max($query){
|
protected static function max($query){
|
||||||
return $query->max(DB::raw("(value / extract(days FROM DATE_TRUNC('month', TO_DATE(year_month, 'YYMM')::timestamptz) + interval '1 month - 1 day'))/24"));
|
return $query->max(DB::raw("value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function min($query){
|
protected static function min($query){
|
||||||
return $query->min(DB::raw("(value / extract(days FROM DATE_TRUNC('month', TO_DATE(year_month, 'YYMM')::timestamptz) + interval '1 month - 1 day'))/24"));
|
return $query->min(DB::raw("value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function standardDeviation($query): float|bool
|
protected static function standardDeviation($query): float|bool
|
||||||
{
|
{
|
||||||
$array = $query->addSelect([
|
$array = $query->addSelect([
|
||||||
DB::raw("(SUM(valor) / extract(days FROM DATE_TRUNC('month', TO_DATE(mes_ref, 'YYMM')::timestamptz) + interval '1 month - 1 day'))/24 as desv_pad")
|
DB::raw("AVG(valor)as desv_pad")
|
||||||
])->get()->toArray();
|
])->get()->toArray();
|
||||||
|
|
||||||
return stats_standard_deviation(collect($array)->pluck('desv_pad')->all());
|
return stats_standard_deviation(collect($array)->pluck('desv_pad')->all());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user