Compare commits
1 Commits
card/4807-
...
card/4781-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cc2e59b45 |
@@ -84,17 +84,22 @@ class MergedTicketRepair
|
||||
*/
|
||||
public static function repairAll(string $by): int
|
||||
{
|
||||
$numbers = Ticket::query()->inconsistentlyMerged()->pluck('number')->all();
|
||||
$tickets = Ticket::query()->inconsistentlyMerged()->orderBy('id')->get();
|
||||
|
||||
if ($numbers === []) {
|
||||
if ($tickets->isEmpty()) {
|
||||
Log::info("[ticketing] #938 merged-ticket repair ({$by}): nothing to repair.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
$changed = Ticket::query()->inconsistentlyMerged()->update([
|
||||
'status' => Ticket::STATUS_MERGED,
|
||||
]);
|
||||
// Per model, not one builder update (#4781/#4807): `merged` makes a ticket
|
||||
// permanently read-only, and a bulk statement would freeze it with nothing
|
||||
// on the Changes log — while repair() below, the same change one ticket at
|
||||
// a time, is recorded.
|
||||
$tickets->each(fn (Ticket $ticket) => $ticket->forceFill(['status' => Ticket::STATUS_MERGED])->save());
|
||||
|
||||
$numbers = $tickets->pluck('number')->all();
|
||||
$changed = $tickets->count();
|
||||
|
||||
// The numbers, not just the count. These rows are being made read-only,
|
||||
// and "which ones" is the question the office will ask afterwards.
|
||||
|
||||
Reference in New Issue
Block a user