feat: make catalog-pages dedup a choosable step in Fix alles
The maintenance "Fix alles" now has a checkbox to include or skip the duplicate catalog_pages merge, so admins can choose whether to run it. removeDuplicates takes an includePages flag and fixEverything threads it through to the action.
This commit is contained in:
1 parent
6dced0fb54
commit
3a292a44f1
3 files changed
+45
-11
No files matched your search
@@ -388,9 +388,13 @@ async function dedupCatalogTable(table: string): Promise<number> {
|
||||
* product on the same page). The page merge runs before the row dedup so items
|
||||
* moved onto the survivor are still de-duplicated within the page afterwards.
|
||||
*/
|
||||
export async function removeDuplicates(): Promise<DedupResult> {
|
||||
export async function removeDuplicates(
|
||||
includePages = true,
|
||||
): Promise<DedupResult> {
|
||||
const ib = await removeDuplicateItemsBase();
|
||||
const pageDedup = await dedupeCatalogPages();
|
||||
const pageDedup = includePages
|
||||
? await dedupeCatalogPages()
|
||||
: { groups: 0, removed: 0, remapped: 0 };
|
||||
const catalogRemoved = await dedupCatalogTable("catalog_items");
|
||||
const catalogBcRemoved = await dedupCatalogTable("catalog_items_bc");
|
||||
return {
|
||||
@@ -630,12 +634,14 @@ export interface FixAllResult {
|
||||
}
|
||||
|
||||
/** Run every repair in a sensible order, then return before/after health. */
|
||||
export async function fixEverything(): Promise<FixAllResult> {
|
||||
export async function fixEverything(
|
||||
opts: { dedupePages?: boolean } = {},
|
||||
): Promise<FixAllResult> {
|
||||
const healthBefore = await getFurniHealth();
|
||||
const sprite = await fixSpriteIds();
|
||||
const offers = await fixCatalogOffers();
|
||||
const reconcile = await reconcileIds();
|
||||
const dedup = await removeDuplicates();
|
||||
const dedup = await removeDuplicates(opts.dedupePages ?? true);
|
||||
const align = await forceItemsBaseIdsToFurnidata(true);
|
||||
const healthAfter = await getFurniHealth();
|
||||
return { healthBefore, sprite, offers, reconcile, dedup, align, healthAfter };
|
||||
|
||||
Reference in new issue
Block a user