Correction of PLD implementation, Daily Values.

This commit is contained in:
Djonathan 2022-07-20 09:49:59 -03:00
parent b13d34a38c
commit 3ae85054a5
2 changed files with 4 additions and 2 deletions

View File

@ -159,7 +159,8 @@ class PldRepository extends AbstractRepository implements PldContractInterface
'pld.submercado as submarket',
DB::raw("AVG(pld.valor) as value"),
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',
@ -181,6 +182,7 @@ class PldRepository extends AbstractRepository implements PldContractInterface
)
->orderByRaw("('1899-12-30'::date + ('1 day'::interval day * (pld.dia_num)::double precision))");
return $this->execute($fields2, $params)
->from($query, 'plds')
->orderBy('day_calc', 'asc')