Skip to content

Commit 0116385

Browse files
committed
Auto-refresh every 30 seconds, fixed bug in "Elapsed time" when there are 2 or more recharges in the selected period
1 parent dedd9e8 commit 0116385

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

dashboards/current-charge-view.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"editable": true,
2323
"fiscalYearStartMonth": 0,
2424
"graphTooltip": 1,
25-
"iteration": 1675098717123,
25+
"iteration": 1675102698542,
2626
"links": [
2727
{
2828
"icon": "dashboard",
@@ -491,7 +491,7 @@
491491
"policy": "default",
492492
"query": "SELECT last(\"utc\") - first(\"utc\") as Seconds FROM \"ovms\" WHERE $timeFilter and is_charging = true",
493493
"rawQuery": true,
494-
"rawSql": "WITH start_process AS (\n SELECT date FROM charges \n\twhere charging_process_id=$charging_processes\n\tORDER BY DATE ASC\n \tLIMIT 1\n)\nSELECT\n EXTRACT(EPOCH FROM (charges.date - start_process.date)) AS \"Elapsed\"\nFROM charges, start_process\nWHERE \n charging_process_id = $charging_processes AND\n $__timeFilter(charges.date)\norder by charges.date desc \nLIMIT 1",
494+
"rawSql": "WITH elapsed_times AS (\n\tSELECT\n\t\tc.charging_process_id, \n\t\tEXTRACT(EPOCH FROM (MAX(c.date) - MIN(c.date))) AS total\n\tFROM charges c\n\tJOIN charging_processes cp ON cp.id = c.charging_process_id\n\tWHERE \n \t\t$__timeFilter(c.date)\n\t\tAND cp.car_id = $car_id\n\tGROUP BY charging_process_id\n)\nSELECT\n\tSUM(et.total) AS Elapsed\nFROM elapsed_times et",
495495
"refId": "A",
496496
"resultFormat": "time_series",
497497
"select": [
@@ -1373,7 +1373,7 @@
13731373
"type": "stat"
13741374
}
13751375
],
1376-
"refresh": false,
1376+
"refresh": "30s",
13771377
"schemaVersion": 36,
13781378
"style": "dark",
13791379
"tags": [

0 commit comments

Comments
 (0)