From e337a29003c41ae328b2c24f003a289fdc0bdda0 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 24 Nov 2023 22:48:01 +1100 Subject: [PATCH] Determine unsent netmails by their flags, not sent_at for the status --- app/Http/Controllers/HomeController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 3bb372a..366bedd 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -10,7 +10,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Gate; use App\Classes\File; -use App\Classes\FTN\Packet; +use App\Classes\FTN\{Message,Packet}; use App\Http\Requests\SetupRequest; use App\Models\File as FileModel; use App\Models\{Address,Echomail,Netmail,Setup,System}; @@ -259,7 +259,11 @@ class HomeController extends Controller $n = Address::select(['addresses.id',DB::raw('0 as e'),DB::raw('count(*) as n'),DB::raw('0 as f')]) ->join('netmails',['netmails.tftn_id'=>'addresses.id']) - ->whereNull('sent_at') + ->where(function($query) { + return $query->whereRaw(sprintf('(flags & %d) > 0',Message::FLAG_INTRANSIT)) + ->orWhereRaw(sprintf('(flags & %d) > 0',Message::FLAG_LOCAL)); + }) + ->whereRaw(sprintf('(flags & %d) = 0',Message::FLAG_SENT)) ->where('datetime','<',$date) ->groupBy('addresses.id');