-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new dashboard for reporting to Dutch tax & matching of Titles/labels now match pie-charts in Charging stats #998
Conversation
Solves #814 - just had to reverse the "ORDER BY" for the pie-charts...
Should we collaborate to make a new table hold hold a "classification" of drives (personal vs. business), as well as a "note" (could be costumer, if geo-fencing is not applicable in rare cases..?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -21,3 +21,13 @@ providers: | |||
updateIntervalSeconds: 86400 | |||
options: | |||
path: /dashboards_internal | |||
- name: 'teslamate_reports' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to put those specialized dashboards in a separate folder 👍
} | ||
], | ||
"title": "Drive", | ||
"type": "table" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I migrated this table to the new table component. It comes with a bunch of new features and looks better on mobile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -320,7 +320,7 @@ | |||
"group": [], | |||
"metricColumn": "none", | |||
"rawQuery": true, | |||
"rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n car.id as car_id,\n -- Columns\n drives.id as drive_id,\n start_date,\n start_km,\n end_date,\n end_km,\n CONCAT_WS(', ', nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), ''), start_address.city) AS start_address,\n CONCAT_WS(', ', nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), ''), end_address.city) AS end_address,\n duration_min,\n distance\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id\n ORDER BY drive_id DESC\n)\nSELECT\n start_date_ts,\n car_id,\n -- Columns\n drive_id,\n start_date as start_date,\n convert_km(start_km::numeric, '$length_unit') AS start_km_$length_unit,\n start_address,\n end_date as end_date,\n convert_km(end_km::numeric, '$length_unit') AS end_km_$length_unit,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit\nFROM data;", | |||
"rawSql": "WITH data AS (\n SELECT\n drives.id as drive_id,\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n start_km,\n end_km,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id\n ORDER BY drive_id DESC\n)\nSELECT\n drive_id,\n start_date_ts,\n convert_km(start_km::numeric, '$length_unit') as start_$length_unit,\n start_address,\n end_date_ts,\n convert_km(end_km::numeric, '$length_unit') as end_$length_unit,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit\nFROM data;", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was intentionally that I didn't show geofences as the requirement in #989 was to have the address - so I anticipated, that a geofence or location-name wouldn't be valid for the tax-authority....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. I assumed that the same behaviour as in the Drive dashboard would be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adriankumpf : Did you see my concerns regarding "missing start of drives", and the issue where a late start of logging has the consequence that start_km of drive x is not equal to end_km for drive x-1....
It can (will) result in missing km in a tax report - similar to how the current "trip" report goes from start_km of first drive to end_km of last drive... And that is obviously not always the sum of the logged drives...
- So perhaps a way to cluster subsequent drives with the same tag (same logical trips)???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always have to expect that trips can be recorded incompletely or even missing completely. A manual follow-up check will always be necessary imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my point - adding the end_km from the previous drive could be of value... It probably shouldn't be visible in a standard report - but when exporting to excel it could be used to quickly do this validation - and adjust in there, since adjust the start_km directly in the database is probably not without implications (or perhaps it is fine to adjust the start_km - and we should aim to allow for that in the frontend?)
…now match pie-charts in Charging stats (#998) * new dashboard for reporting to Dutch tax based on #989 * Titles/labels now match pie-charts in Charging stats Solves #814 - just had to reverse the "ORDER BY" for the pie-charts... * Include reports in Docker image * Use new table component * Show geo fences where applicable Closes #989 Fixes #814 Co-authored-by: Adrian Kumpf <[email protected]>
solves #989 and #814 - sorry for mixing into one PR. Seems that I have to learn more about Git -.-