From 7885d3901b3689bb4c73bb25df1260a7f9c7a233 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 8 Dec 2024 18:45:29 +1100 Subject: [PATCH] Update NodesNew report --- app/Jobs/AddressIdle.php | 3 ++- app/Jobs/NodesNew.php | 3 ++- app/Notifications/Netmails/NodesNew.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Jobs/AddressIdle.php b/app/Jobs/AddressIdle.php index a7cd73f..4bde45a 100644 --- a/app/Jobs/AddressIdle.php +++ b/app/Jobs/AddressIdle.php @@ -204,7 +204,8 @@ class AddressIdle implements ShouldQueue ->where(fn($query)=>$query->where('point_id',0)->orWhereNull('point_id')) ->whereIn('addresses.id',our_nodes($do)->pluck('id')) ->when($ao,fn($query)=>$query->where('addresses.id',$ao->id)) - ->where(fn($q)=>$q->where('last_session','<',$age)->orWhereNull('last_session')) + ->where(fn($q)=>$q->where('last_session','<',$age) + ->orWhere(fn($q)=>$q->whereNull('last_session')->where('updated_at','<',Carbon::now()->subDays(14)->startOfDay()))) ->whereRaw(sprintf('((role IS NULL) OR (role=0) OR ((role & %d) > 0))',$flags)) ->whereRaw(sprintf('((role IS NULL) OR ((role & %d) = 0))',Address::NODE_KEEP)) ->join('systems',['systems.id'=>'addresses.system_id']) diff --git a/app/Jobs/NodesNew.php b/app/Jobs/NodesNew.php index 122714f..013d3cb 100644 --- a/app/Jobs/NodesNew.php +++ b/app/Jobs/NodesNew.php @@ -11,7 +11,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Notification; -use App\Models\{Address, Domain, System}; +use App\Models\{Address,Domain}; use App\Notifications\Netmails\NodesNew as NotificationNodesNew; class NodesNew implements ShouldQueue @@ -43,6 +43,7 @@ class NodesNew implements ShouldQueue $result = Address::FTN() ->ActiveFTN() + ->addSelect('addresses.created_at') ->join('systems',['systems.id'=>'addresses.system_id']) ->join('system_zone',['system_zone.system_id'=>'systems.id','system_zone.zone_id'=>'zones.id']) ->whereIn('zones.id',$this->do->zones->pluck('id')) diff --git a/app/Notifications/Netmails/NodesNew.php b/app/Notifications/Netmails/NodesNew.php index 26c68b7..69f2c1e 100644 --- a/app/Notifications/Netmails/NodesNew.php +++ b/app/Notifications/Netmails/NodesNew.php @@ -60,7 +60,8 @@ class NodesNew extends Netmails //implements ShouldQueue if ($c++) $msg->addText("\r"); - $msg->addText(sprintf("* %s - %s from %s.\r",$oo->ftn4D,$oo->system->sysop,$oo->system->location)); + $msg->addText(sprintf("* %s - %s (%s) from %s.\r",$oo->ftn4D,$oo->system->sysop,$oo->system->name,$oo->system->location)); + $msg->addText(sprintf("%s Address registered: %s\r\r",$space,$oo->created_at->format('Y-m-d'))); if ($oo->system->method) { switch ($oo->system->method) {