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
fix(productSync): Update categories before categoryOrderHints #226
fix(productSync): Update categories before categoryOrderHints #226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a short discussion with @wizzy25 ,
I would rather see that the setCategoryHint
is moved out of the actionMapsBase
and that you create a separate mapper for this action, with the specified criteria (such as categories
should be linked to the product) to fulfil the action
code
// in utils/product.coffee
const actionCategoryOrderHint = {
action: 'setCategoryOrderHint',
key: 'categoryOrderHints',
}
actionsMapCategoryOrderHint: () => {
const action = this.buildBaseAttributesAction(actionCategoryOrderHint, diff, old_obj)
// do your thing then push to the actions list!
}
// in product-sync.coffee
// below 'categories' mapper configuration
allActions.push(
this._mapActionOrNot(
'categoryOrderHint',
() => this._utils.actionsMapCategoryOrderHint(diff)
)
)
Once you take this approach, make sure to remove the setCategoryHint
from actionsBaseList
, and you can move the categories
action configuration back to it original order
…ions are generated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me; with one minor change request from me.
you need to update @actionGroups
with the new categoryOrderHints
key.
good work
@wizzy25 can you please merge this PR? I am not authorized to do that 😢 |
@emmenko Could you review (and merge?) this PR? I don't have write access on this repo |
actions = Object.keys(action.categoryOrderHints) | ||
.map (categoryId) -> | ||
orderHint = action.categoryOrderHints[categoryId] | ||
if orderHint is null or orderHint is undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in coffee this line is same as orderHint?
Summary
This PR fixes #218
Description
When generating product update actions category actions should be placed before categoryOrderHint actions so we can add product to category and create a categoryOrderHint in one request.
Todo