Merge pull request #69 from tobiasehlert/bug-43

Remove charges and drives that have null on end_date
This commit is contained in:
Tobias Lindberg
2021-06-01 10:07:06 +02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ func TeslaMateAPICarsChargesV1(c *gin.Context) {
LEFT JOIN addresses address ON address_id = address.id
LEFT JOIN positions position ON position_id = position.id
LEFT JOIN geofences geofence ON geofence_id = geofence.id
WHERE charging_processes.car_id=$1
WHERE charging_processes.car_id=$1 AND charging_processes.end_date IS NOT NULL
ORDER BY start_date DESC
LIMIT $2 OFFSET $3;`
rows, err := db.Query(query, CarID, ResultShow, ResultPage)
+1 -1
View File
@@ -136,7 +136,7 @@ func TeslaMateAPICarsChargesDetailsV1(c *gin.Context) {
LEFT JOIN positions position ON position_id = position.id
LEFT JOIN geofences geofence ON geofence_id = geofence.id
LEFT JOIN charges ON charging_processes.id = charges.id
WHERE charging_processes.car_id=$1 AND charging_processes.id=$2
WHERE charging_processes.car_id=$1 AND charging_processes.id=$2 AND charging_processes.end_date IS NOT NULL
ORDER BY start_date DESC;`
rows, err := db.Query(query, CarID, ChargeID)