feat: remove duplicates in sql

This commit is contained in:
bzy107
2024-02-06 21:45:16 +09:00
parent e928a0c9aa
commit 3785a29f59
@@ -74,7 +74,7 @@ class PrepareCsvExport implements ShouldQueue
$recordsCount = count($records);
if (($totalRows + $recordsCount) > $this->export->total_rows) {
$records = array_slice(array_unique($records), 0, $this->export->total_rows - $totalRows);
$records = array_slice($records, 0, $this->export->total_rows - $totalRows);
$recordsCount = count($records);
}
@@ -111,6 +111,7 @@ class PrepareCsvExport implements ShouldQueue
$chunkKeySize = $this->chunkSize * 10;
$baseQuery = $query->toBase();
$baseQuery->distinct($qualifiedKeyName);
/** @phpstan-ignore-next-line */
$baseQueryOrders = $baseQuery->orders ?? [];