Skip to content

Filter out non-deleted products from product-clean-up results #38

@pulkitsinghal

Description

@pulkitsinghal
  1. When product-clean-up command runs, it produces a CSV file with all the deleted and non-deleted products as part of the clean-up. It should only contain the list of those successfully deleted. Otherwise the CSV is not useful for rollback/reimports.
  2. The file which contains the reasons from Vend as to why some product deletions were "refused" ... does not always print out.

This code-block is not promise-capable:

.then(function deletionResults(deleteIt){
    if(deleteIt.status != "success"){
        unsuccessful++;
        fs.appendFileSync(defaultOutputDirectory+"nonDeletable.txt",unsuccessful+". Product : "+ singleProductToDelete.name +" Reason : "+ deleteIt.details+"\n",'utf8');
    }
    else {
        successful++;
    }
})

It uses code like fs.appendFileSync which is problematic and simply adding return Promise.resolve(); at the end of that block might not fix anything. Needs testing and rewrite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions