Commit fe7ec0e6 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

refactor(db): removed unnecessary field

Also force date_changed from table requests preventing
future conflicts

issue #1271
parent f018bb10
...@@ -875,22 +875,21 @@ sub list_requests($self, $id_domain_req=undef, $seconds=60) { ...@@ -875,22 +875,21 @@ sub list_requests($self, $id_domain_req=undef, $seconds=60) {
my $time_recent = ($now[5]+=1900)."-".$now[4]."-".$now[3] my $time_recent = ($now[5]+=1900)."-".$now[4]."-".$now[3]
." ".$now[2].":".$now[1].":".$now[0]; ." ".$now[2].":".$now[1].":".$now[0];
my $sth = $CONNECTOR->dbh->prepare( my $sth = $CONNECTOR->dbh->prepare(
"SELECT requests.id, command, args, date_changed, requests.status" "SELECT requests.id, command, args, requests.date_changed, requests.status"
." ,requests.error, id_domain ,domains.name as domain" ." ,requests.error, id_domain ,domains.name as domain"
." ,date_changed "
." FROM requests left join domains " ." FROM requests left join domains "
." ON requests.id_domain = domains.id" ." ON requests.id_domain = domains.id"
." WHERE " ." WHERE "
." requests.status <> 'done' " ." requests.status <> 'done' "
." OR ( date_changed >= ?) " ." OR ( requests.date_changed >= ?) "
." ORDER BY date_changed " ." ORDER BY requests.date_changed "
); );
$sth->execute($time_recent); $sth->execute($time_recent);
my @reqs; my @reqs;
my ($id_request, $command, $j_args, $date_changed, $status my ($id_request, $command, $j_args, $date_changed, $status
, $error, $id_domain, $domain, $date); , $error, $id_domain, $domain);
$sth->bind_columns(\($id_request, $command, $j_args, $date_changed, $status $sth->bind_columns(\($id_request, $command, $j_args, $date_changed, $status
, $error, $id_domain, $domain, $date)); , $error, $id_domain, $domain));
while ( $sth->fetch) { while ( $sth->fetch) {
my $epoch_date_changed = time; my $epoch_date_changed = time;
...@@ -938,7 +937,7 @@ sub list_requests($self, $id_domain_req=undef, $seconds=60) { ...@@ -938,7 +937,7 @@ sub list_requests($self, $id_domain_req=undef, $seconds=60) {
push @reqs,{ id => $id_request, command => $command, date_changed => $date_changed, status => $status, name => $args->{name} push @reqs,{ id => $id_request, command => $command, date_changed => $date_changed, status => $status, name => $args->{name}
,domain => $domain ,domain => $domain
,date => $date ,date => $date_changed
,message => $message ,message => $message
,error => $error ,error => $error
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment