Skip to content

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

@sferoze

Description

@sferoze

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions