Projekt

Obecné

Profil

« Předchozí | Další » 

Revize fb12df6d

Přidáno uživatelem Jan Kohlíček před téměř 7 roky(ů)

refs #7014: přidané grafy denní průměry, optimalizace API, styly převedeny do SASS, zvětšený prostor pro grafy

Zobrazit rozdíly:

backend/app/Model/Zaznam.php
81 81
            ->select(DB::raw("
82 82
                date_format(datum.od, '%H:%i') as timeFrom,
83 83
                date_format(datum.do, '%H:%i') as timeTo,
84
                ROUND(avg(zaznam.rychlost_prumer),0) as speedAverage,
85
                CAST(sum(zaznam.vozidla_pocet) as UNSIGNED) as numberVehicle,
86
                ROUND(avg(zaznam.vozidla_pocet),0) as numberVehicleAverage,
84
                ROUND(AVG(zaznam.rychlost_prumer), 0) as speedAverage,
85
                CAST(SUM(zaznam.vozidla_pocet) as UNSIGNED) as numberVehicle,
86
                ROUND(AVG(zaznam.vozidla_pocet), 0) as numberVehicleAverage,
87 87
                zaznam.vozidlo_id as typeVehicleId
88 88
            "))
89 89
            ->whereDate('datum.od', '>=', $dateFrom == null ? $lastDate : $dateFrom)
90
            ->whereDate('datum.do', '<=', $dateTo == null ? $lastDate : $dateTo)
90
            ->whereDate('datum.od', '<=', $dateTo == null ? $lastDate : $dateTo)
91 91
            ->whereTime('datum.od', '>=', $timeFrom == null ? '08:00:00' : $timeFrom)
92 92
            ->whereTime('datum.od', '<=', $timeTo == null ? '23:59:59' : $timeTo)
93 93
            ->where('zaznam_cas.zarizeni_id', '=', $deviceId);
......
137 137
            ->join('datum', 'zaznam_prum_den.datum_id', '=', 'datum.id')
138 138
            ->select(DB::raw("
139 139
                date_format(datum.od, '%Y-%m-%d') as date,
140
                zaznam_prum_den.rychlost_prumer as speedAverage,
141
                zaznam_prum_den.vozidla_pocet as numberVehicle,
142
                zaznam_prum_den.vozidlo_id as typeVehicle
140
                ROUND(AVG(zaznam_prum_den.rychlost_prumer), 0) as speedAverage,
141
                CAST(SUM(zaznam_prum_den.vozidla_pocet) as UNSIGNED) as numberVehicle,
142
                zaznam_prum_den.vozidlo_id as typeVehicleId
143 143
            "))
144 144
            ->whereDate('datum.od', '>=', $dateFrom == null ? $lastDateFrom : $dateFrom)
145
            ->whereDate('datum.do', '<=', $dateTo == null ? $lastDateTo : $dateTo)
145
            ->whereDate('datum.od', '<=', $dateTo == null ? $lastDateTo : $dateTo)
146 146
            ->where('zaznam_prum_den.zarizeni_id', '=', $deviceId);
147 147

  
148 148
        if ($direction != null) {
......
151 151

  
152 152
        // pridat grouping a razeni nakonec
153 153
        $query = $query
154
            ->groupBy('date', 'typeVehicle')
154
            ->groupBy('date', 'zaznam_prum_den.vozidlo_id')
155 155
            ->orderBy('date', 'asc')
156 156
            ->orderBy('zaznam_prum_den.vozidlo_id', 'asc');
157 157

  

Také k dispozici: Unified diff