fix broken Node Age, and anchor age() SQL to now()

This commit is contained in:
Oliver Gorwits
2013-09-12 08:25:14 +01:00
parent 51f109d108
commit f9a97687a2
3 changed files with 4 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ __PACKAGE__->table("active_node_with_age");
__PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(q{ __PACKAGE__->result_source_instance->view_definition(q{
SELECT *, 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 AS time_last_age
FROM node WHERE active FROM node WHERE active
}); });

View File

@@ -14,7 +14,7 @@ __PACKAGE__->table("node_with_age");
__PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(q{ __PACKAGE__->result_source_instance->view_definition(q{
SELECT *, 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 AS time_last_age
FROM node FROM node
}); });

View File

@@ -61,7 +61,7 @@ sub with_is_free {
{ {
'+columns' => { is_free => '+columns' => { is_free =>
\["up != 'up' and " \["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)) " ."- (device.uptime - lastchange)/100)) "
."> ?::interval", ."> ?::interval",
[{} => $interval]] }, [{} => $interval]] },
@@ -92,7 +92,7 @@ sub only_free_ports {
'up' => { '!=' => 'up' }, 'up' => { '!=' => 'up' },
},{ },{
where => where =>
\["age(to_timestamp(extract(epoch from device.last_discover) " \["age(now(), to_timestamp(extract(epoch from device.last_discover) "
."- (device.uptime - lastchange)/100)) " ."- (device.uptime - lastchange)/100)) "
."> ?::interval", ."> ?::interval",
[{} => $interval]], [{} => $interval]],