fix broken Node Age, and anchor age() SQL to now()
This commit is contained in:
@@ -14,7 +14,7 @@ __PACKAGE__->table("active_node_with_age");
|
||||
__PACKAGE__->result_source_instance->is_virtual(1);
|
||||
__PACKAGE__->result_source_instance->view_definition(q{
|
||||
SELECT *,
|
||||
replace(age( date_trunc( 'minute', time_last + interval '30 second' ) ) ::text, 'mon', 'month')
|
||||
replace( date_trunc( 'minute', age( now(), time_last + interval '30 second' ) ) ::text, 'mon', 'month')
|
||||
AS time_last_age
|
||||
FROM node WHERE active
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ __PACKAGE__->table("node_with_age");
|
||||
__PACKAGE__->result_source_instance->is_virtual(1);
|
||||
__PACKAGE__->result_source_instance->view_definition(q{
|
||||
SELECT *,
|
||||
replace(age( date_trunc( 'minute', time_last + interval '30 second' ) ) ::text, 'mon', 'month')
|
||||
replace( date_trunc( 'minute', age( now(), time_last + interval '30 second' ) ) ::text, 'mon', 'month')
|
||||
AS time_last_age
|
||||
FROM node
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ sub with_is_free {
|
||||
{
|
||||
'+columns' => { is_free =>
|
||||
\["up != 'up' and "
|
||||
."age(to_timestamp(extract(epoch from device.last_discover) "
|
||||
."age(now(), to_timestamp(extract(epoch from device.last_discover) "
|
||||
."- (device.uptime - lastchange)/100)) "
|
||||
."> ?::interval",
|
||||
[{} => $interval]] },
|
||||
@@ -92,7 +92,7 @@ sub only_free_ports {
|
||||
'up' => { '!=' => 'up' },
|
||||
},{
|
||||
where =>
|
||||
\["age(to_timestamp(extract(epoch from device.last_discover) "
|
||||
\["age(now(), to_timestamp(extract(epoch from device.last_discover) "
|
||||
."- (device.uptime - lastchange)/100)) "
|
||||
."> ?::interval",
|
||||
[{} => $interval]],
|
||||
|
||||
Reference in New Issue
Block a user