Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

63: Fix discountCode export with deleted codes #64

Closed
wants to merge 2 commits into from

Conversation

ValeSauer
Copy link
Contributor

@ValeSauer ValeSauer commented Dec 20, 2017

This PR

Fixes #63

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 94.412% when pulling 29f4857 on 63-discountCode-export into e069a55 on master.

@coveralls
Copy link

coveralls commented Dec 21, 2017

Coverage Status

Coverage decreased (-89.5%) to 5.072% when pulling 29f4857 on 63-discountCode-export into e069a55 on master.

Copy link
Contributor

@wizzy25 wizzy25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @ValeSauer 🥇
Is it possible that you could add a test for it?

Copy link
Contributor

@junajan junajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ValeSauer .. please check my comment

@@ -68,6 +68,11 @@ class CsvMapping
else [entry]

formatDiscountCodes = (discountCodes) ->
discountCodes = _.each(discountCodes, ({ discountCode }) ->
if !discountCode.obj
discountCode.obj = { code: 'discountCode_deleted' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ValeSauer .. is this a correct solution? What if somebody wants to export discount codes to the external system? He would import also discountCode_deleted code. Shouldn't we filter out deleted discount codes instead of replacing them with some constant value?

@wizzy25 what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which approach is better. My first idea was to export nothing in this case, but after I discussed with a customer I switched over to above's solution. It gives you more insights and is (as long as you now what discountCode_deleted means) better to understand. If you just export nothing, this could be misunderstood as no discountCode used.
@wizzy25 Do you want to decide?

Copy link
Contributor

@wizzy25 wizzy25 Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ValeSauer I agree with @junajan. Using any form of constant value (even discountCode_deleted) could also mean that the discount code exists (in this case, that discountCode_deleted was the discount code used.

A solution may be to add a new boolean CSV column (for example: isDiscountCodeDeleted) which we set to true or false and leave the actual code column empty. Doesn't have to be exactly this, but something along this line.

A flag can also be used so it's not breaking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wizzy25 Is there already an example in which order-export exports columns that were not specified in the csv template? This might be unexpected too.
Suggestion:

  1. We simply export nothing for now. By doing so we at least make it possible to export such orders again.
  2. We create an issue to discuss how to deal with these cases in a proper way.
    Alright?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ValeSauer I don't think there's an example for that, although it can be done. If it should be done is another discussion.
By exporting "nothing", do you mean no order should be exported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By exporting "nothing", I mean no discount code should be exported.

@ValeSauer ValeSauer closed this Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export of discountCodes fails if discountCode is deleted
4 participants