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

You must first set the end date to null, then add the new plan #2

Open
sferoze opened this issue Oct 3, 2017 · 0 comments
Open

You must first set the end date to null, then add the new plan #2

sferoze opened this issue Oct 3, 2017 · 0 comments

Comments

@sferoze
Copy link

sferoze commented Oct 3, 2017

There is an issue in the order of things done in this method

You must first update endDate, and then setAppPlansObject like so

// Update endDate to be null
  Utility.updateAppPlansObject(options, planName, {
    $unset: {
      'appPlans.list.$.endDate': '',
    },
  });

  Utility.setAppPlansObject(options, modifier);

  return true;

Otherwise, the $addToSet modifier does not work and it adds duplicate plans with exact same parameters in the appPlans.list object

https://github.com/aldeed/meteor-plans/blob/a6b2919600ca65317bdef021ae23350caa1bce60/server/utility.js#L86

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

No branches or pull requests

1 participant