From b3f0fafa80721c01b7bdaf1e8aabe47e28605375 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 16 Nov 2010 11:21:42 -0600 Subject: [PATCH] graham's stupid date filter thing --- lib/Lacuna/DB/Result/Empire.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Lacuna/DB/Result/Empire.pm b/lib/Lacuna/DB/Result/Empire.pm index 1cc92717..5d84ee27 100644 --- a/lib/Lacuna/DB/Result/Empire.pm +++ b/lib/Lacuna/DB/Result/Empire.pm @@ -493,11 +493,11 @@ sub send_message { sub check_for_repeat_message { my ($self, $repeat) = @_; - return $self->received_messages->search( - { - repeat_check => $repeat, - date_sent => { '>=' => DateTime->now->subtract(hours=>6)} - } + my $six_hours_ago = DateTime->now->subtract(hours=>6); + return $self->received_messages->search_literal( + 'repeat_check = ? and ( date_sent >= ? or ( has_read = 1 and has_archived <> 1 ))', + $repeat, + $six_hours_ago->ymd.' '.$six_hours_ago->hms, )->count; } -- 2.51.2