Correction of PLD implementation, Daily Values.
This commit is contained in:
parent
b13d34a38c
commit
3ae85054a5
@ -21,7 +21,7 @@ class Helpers
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function orderByDate($result, $format ='M/Y', $field = 'mes'): array
|
public static function orderByDate($result, $format ='M/Y', $field = 'mes'): array
|
||||||
{
|
{
|
||||||
return collect($result)
|
return collect($result)
|
||||||
->transform(fn($value) => Arr::set(
|
->transform(fn($value) => Arr::set(
|
||||||
|
|||||||
@ -159,7 +159,8 @@ class PldRepository extends AbstractRepository implements PldContractInterface
|
|||||||
'pld.submercado as submarket',
|
'pld.submercado as submarket',
|
||||||
DB::raw("AVG(pld.valor) as value"),
|
DB::raw("AVG(pld.valor) as value"),
|
||||||
DB::raw("pld.mes_ref as year_month"),
|
DB::raw("pld.mes_ref as year_month"),
|
||||||
DB::raw("TO_CHAR(TO_DATE(pld.mes_ref, 'YYMM'::text)::timestamp with time zone, 'MM/YYYY'::text) as year_month_formatted")
|
DB::raw("TO_CHAR(TO_DATE(pld.mes_ref, 'YYMM'::text)::timestamp with time zone, 'MM/YYYY'::text) as year_month_formatted"),
|
||||||
|
DB::raw("TO_CHAR(TO_DATE(pld.mes_ref, 'YYMM'), 'MM/YYYY') AS mes_ref"),
|
||||||
];
|
];
|
||||||
|
|
||||||
$fields2 = ['day_formatted',
|
$fields2 = ['day_formatted',
|
||||||
@ -181,6 +182,7 @@ class PldRepository extends AbstractRepository implements PldContractInterface
|
|||||||
)
|
)
|
||||||
->orderByRaw("('1899-12-30'::date + ('1 day'::interval day * (pld.dia_num)::double precision))");
|
->orderByRaw("('1899-12-30'::date + ('1 day'::interval day * (pld.dia_num)::double precision))");
|
||||||
|
|
||||||
|
|
||||||
return $this->execute($fields2, $params)
|
return $this->execute($fields2, $params)
|
||||||
->from($query, 'plds')
|
->from($query, 'plds')
|
||||||
->orderBy('day_calc', 'asc')
|
->orderBy('day_calc', 'asc')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user