diff --git a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/ActiveNodeWithAge.pm b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/ActiveNodeWithAge.pm index 8f9cedfb..39097275 100644 --- a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/ActiveNodeWithAge.pm +++ b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/ActiveNodeWithAge.pm @@ -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 }); diff --git a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/NodeWithAge.pm b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/NodeWithAge.pm index 6679f0f2..94a98ef9 100644 --- a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/NodeWithAge.pm +++ b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/NodeWithAge.pm @@ -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 }); diff --git a/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm b/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm index 755aa568..58b7ba55 100644 --- a/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm +++ b/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm @@ -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]],