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

Devrel 1074 import taxonomies #9

Merged
merged 2 commits into from
Dec 8, 2023
Merged

Conversation

JiriLojda
Copy link
Member

Motivation

Which issue does this fix? Fixes #issue number

If no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

If manual testing is required, what are the steps?

@JiriLojda JiriLojda requested a review from a team as a code owner December 6, 2023 11:26
@JiriLojda
Copy link
Member Author

Builds on top of #7, merge it before this PR. Review only the commits that are not in the #7.

@JiriLojda JiriLojda force-pushed the DEVREL-1074_import_taxonomies branch from d7356ba to 306692b Compare December 7, 2023 09:48

return {
...context,
taxonomyGroupIdsByOldIds: new Map(zip(fileTaxonomies.map(t => t.id), projectTaxonomies.map(t => t.id))),
Copy link
Contributor

Choose a reason for hiding this comment

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

so we can assume that the order of taxonomies in the project are the same that are in the file? Even though that's probably true and makes sense, is there no possibility that the MAPI response can't mess this up and change the order?

Copy link
Member Author

Choose a reason for hiding this comment

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

The order of taxonomies is intentional, it is not a dictionary, but a list. You can even reorder them in the UI (not sure about MAPI). So I would be really surprised if it reordered them from what I sent it.

return {
...context,
taxonomyGroupIdsByOldIds: new Map(zip(fileTaxonomies.map(t => t.id), projectTaxonomies.map(t => t.id))),
taxonomyTermIdsByOldIds: new Map(zip(fileTaxonomies.flatMap(t => t.terms), projectTaxonomies.flatMap(t => t.terms)).flatMap(extractTermIdsEntries)),
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need two Maps for taxonomies? we can have the same internal ID for taxonomy group and term? I think that it is not probable.. if not, what is the advantage having map for groups and terms?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought it would be a better separation. You never have an id that can be a group or a term. In content types you reference groups in variants you reference terms so why not have them in two maps.

arr1
.slice(0, Math.min(arr1.length, arr2.length))
.map((el1, i) => [el1, arr2[i]] as const) as unknown as Zip<T1, T2>;

Copy link
Contributor

Choose a reason for hiding this comment

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

this is really hard to follow.. maybe adding some comments, why is the array different from Tuple,

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean on the type-level or where?

@JiriLojda JiriLojda force-pushed the DEVREL-1074_import_taxonomies branch from 306692b to 56ded2d Compare December 7, 2023 13:15
@JiriLojda JiriLojda force-pushed the DEVREL-1074_import_taxonomies branch from 56ded2d to 08e2cd0 Compare December 8, 2023 06:34
@JiriLojda JiriLojda merged commit 68d4ac9 into main Dec 8, 2023
1 check passed
@JiriLojda JiriLojda deleted the DEVREL-1074_import_taxonomies branch December 8, 2023 07:03
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.

2 participants