for sub_filter view fix time for grafana and grant
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 31 Aug 2023 09:50:01 +0000 (11:50 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 31 Aug 2023 09:50:01 +0000 (11:50 +0200)
views.pl

index bffb582..e3b2678 100755 (executable)
--- a/views.pl
+++ b/views.pl
@@ -68,7 +68,7 @@ where pn = $pn $time
 
        push @sql_location, qq{
 select 
-       to_char(time, 'YYYY-MM-DD HH24:MI:SS') as time, x_axis_angle + $offset_x as x_axis_angle, y_axis_angle + $offset_y as y_axis_angle, sensor_temperature, power_source_voltage, zc.pn
+       timezone('UTC-2'::text, "time") AS "time", x_axis_angle + $offset_x as x_axis_angle, y_axis_angle + $offset_y as y_axis_angle, sensor_temperature, power_source_voltage, zc.pn
 from zc
 where pn = $pn $time
 };
@@ -116,4 +116,7 @@ drop view sub_$filter ;
 create or replace view sub_$filter as
 }, join(' union ', @sql_location) . qq{
        order by 1 asc
+;
+grant select on sub_$filter to grafana; 
 };
+