Add last_remark()
method
This commit is contained in:
parent
e62c29462f
commit
2331110768
|
@ -72,4 +72,19 @@ sub get_last_page_by_thread_id($self, $thread_id) {
|
|||
$last_page;
|
||||
}
|
||||
|
||||
sub last_remark($self, $thread_id) {
|
||||
my $date_format = $self->{'date_format'};
|
||||
|
||||
$self->pg->db->query(<<~'END_SQL', $date_format, $thread_id)->hash();
|
||||
SELECT remark_id AS id,
|
||||
TO_CHAR(remark_date, ?) AS date,
|
||||
remark_author AS author,
|
||||
remark_body AS body
|
||||
FROM remarks
|
||||
WHERE thread_id = ?
|
||||
ORDER BY remark_date
|
||||
DESC LIMIT 1;
|
||||
END_SQL
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in a new issue