Skip to content

Commit b359f89

Browse files
committed
54. Improves offline user data update
Updates the logic for identifying offline users needing data updates. Now considers users with missing last names or birth dates.
1 parent 2674c83 commit b359f89

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/Console/Commands/OneRun/UpdateOfflineUsersData.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Models\OneC\DiscountCard;
66
use App\Models\User\User;
77
use Illuminate\Console\Command;
8+
use Illuminate\Contracts\Database\Eloquent\Builder;
89
use Illuminate\Database\Eloquent\Collection;
910

1011
class UpdateOfflineUsersData extends Command
@@ -31,8 +32,11 @@ public function handle()
3132
/** @var Collection|User[] */
3233
$users = User::query()
3334
->has('offlineOrders')
34-
->whereNull('last_name')
35-
->get(['id', 'discount_card_number', 'first_name', 'last_name', 'patronymic_name']);
35+
->where(function (Builder $query) {
36+
$query->orWhereNull('last_name')
37+
->orWhereNull('birth_date');
38+
})
39+
->get(['id', 'discount_card_number', 'first_name', 'last_name', 'patronymic_name', 'birth_date']);
3640

3741
$this->output->progressStart($users->count());
3842

0 commit comments

Comments
 (0)