Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api
This commit is contained in:
commit
1ca66fc72d
@ -39,7 +39,7 @@ abstract class AbstractRepository
|
|||||||
{
|
{
|
||||||
$model = app()->make($this->model);
|
$model = app()->make($this->model);
|
||||||
|
|
||||||
if (!$model instanceof Model) {
|
if (!($model instanceof Model)) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"Class {$this->model} must be an instance of Illuminate\\Database\\Eloquent\\Model"
|
"Class {$this->model} must be an instance of Illuminate\\Database\\Eloquent\\Model"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -7,7 +7,6 @@ namespace App\Repositories\Med5min;
|
|||||||
use App\Helpers\Helpers;
|
use App\Helpers\Helpers;
|
||||||
use App\Models\Med5min;
|
use App\Models\Med5min;
|
||||||
use App\Repositories\AbstractRepository;
|
use App\Repositories\AbstractRepository;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
@ -245,22 +244,19 @@ class Med5minRepository extends AbstractRepository implements Med5minContractInt
|
|||||||
|
|
||||||
$field =
|
$field =
|
||||||
[
|
[
|
||||||
// DB::raw("(SUM(med_5min.ativa_consumo)/SQRT(((SUM(med_5min.ativa_consumo)^2) + (SUM(med_5min.reativa_consumo+med_5min.reativa_geracao)^2)))) as FP"),
|
|
||||||
DB::raw("
|
DB::raw("
|
||||||
(
|
(
|
||||||
SUM(med_5min.ativa_consumo)
|
SUM(med_5min.ativa_consumo)
|
||||||
/
|
/
|
||||||
SQRT(
|
CASE WHEN SQRT(SUM(med_5min.reativa_consumo+med_5min.reativa_geracao)^2) <> 0
|
||||||
SUM(med_5min.ativa_consumo)^2
|
THEN SQRT(SUM(med_5min.reativa_consumo+med_5min.reativa_geracao)^2)
|
||||||
+
|
ELSE NULL
|
||||||
SUM(med_5min.reativa_consumo+med_5min.reativa_geracao)^2
|
END
|
||||||
)
|
|
||||||
) as FP"),
|
) as FP"),
|
||||||
DB::raw("0.92 as F_ref")
|
DB::raw("0.92 as F_ref")
|
||||||
];
|
];
|
||||||
|
|
||||||
return $collection->merge($field);
|
return $collection->merge($field);
|
||||||
|
|
||||||
}, function ($collection, $value) use ($period) {
|
}, function ($collection, $value) use ($period) {
|
||||||
|
|
||||||
$multiplyBy = 1;
|
$multiplyBy = 1;
|
||||||
@ -278,9 +274,7 @@ class Med5minRepository extends AbstractRepository implements Med5minContractInt
|
|||||||
];
|
];
|
||||||
|
|
||||||
return $collection->merge($field);
|
return $collection->merge($field);
|
||||||
|
|
||||||
})->all();
|
})->all();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function groupField($typeField, $type = null): array
|
public function groupField($typeField, $type = null): array
|
||||||
@ -306,6 +300,4 @@ class Med5minRepository extends AbstractRepository implements Med5minContractInt
|
|||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,10 @@
|
|||||||
"name": "laravel/laravel",
|
"name": "laravel/laravel",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"description": "The Laravel Framework.",
|
"description": "The Laravel Framework.",
|
||||||
"keywords": ["framework", "laravel"],
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"laravel"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
@ -52,7 +55,24 @@
|
|||||||
],
|
],
|
||||||
"post-create-project-cmd": [
|
"post-create-project-cmd": [
|
||||||
"@php artisan key:generate --ansi"
|
"@php artisan key:generate --ansi"
|
||||||
]
|
],
|
||||||
|
"cached": [
|
||||||
|
"@php artisan optimize --ansi",
|
||||||
|
"@php artisan view:clear --ansi",
|
||||||
|
"@php artisan view:cache --ansi",
|
||||||
|
"@php artisan route:clear --ansi",
|
||||||
|
"@php artisan event:cache --ansi"
|
||||||
|
],
|
||||||
|
"clear-cached": [
|
||||||
|
"@php artisan optimize:clear",
|
||||||
|
"@php artisan cache:clear --ansi",
|
||||||
|
"@php artisan view:clear --ansi",
|
||||||
|
"@php artisan route:clear --ansi",
|
||||||
|
"@php artisan event:clear --ansi",
|
||||||
|
"@php artisan config:clear --ansi",
|
||||||
|
"@php artisan schedule:clear-cache --ansi"
|
||||||
|
],
|
||||||
|
"dev": "@php artisan serve --host=0.0.0.0 --port=8080 --ansi"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user