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

GO-4719: After import I can no longer add an object to a collection #1989

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AnastasiaShemyakinskaya
Copy link
Member

Add mapping of default object type id to the new one in import, so we get new id of default type in result collection object

Copy link

github-actions bot commented Jan 6, 2025

New Coverage 50.4% of statements
Patch Coverage 81.1% of changed statements (30/37)

Coverage provided by https://github.com/seriousben/go-patch-cover-action

Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
)
for id, details := range e.docs {
layout := details.GetInt64(bundle.RelationKeyLayout)
if layout == int64(model.ObjectType_collection) {
Copy link
Member

Choose a reason for hiding this comment

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

These settings could be set for views of sets by relations as well, so check on set layout should be added

Copy link
Member

Choose a reason for hiding this comment

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

And unit test on it

Copy link
Member Author

Choose a reason for hiding this comment

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

Default object type is only applicable for collection, doesn't it? 🧐

Copy link
Member

Choose a reason for hiding this comment

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

If set is aggregated by relation, then we can choose default object type for views

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

err := cache.Do(e.picker, id, func(sb sb.SmartBlock) error {
st := sb.NewState()
return st.Iterate(func(b simple.Block) (isContinue bool) {
if dv := b.Model().GetDataview(); dv != nil {
Copy link
Member

Choose a reason for hiding this comment

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

This code could be simplified:

dv := b.Model().GetDataview()
if dv == nil {
  return true
}
for ...
return false

@@ -413,6 +420,55 @@ func (e *exportContext) processProtobuf() error {
return nil
}

func (e *exportContext) addDependentObjectsFromDataview() error {
var (
viewDependantObjectsIds []string
Copy link
Member

Choose a reason for hiding this comment

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

viewDependentObjectsIds 🙃

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I always make an error in this word 😅

}
}
}
viewDependantObjects, err := e.queryAndFilterObjectsByRelation(e.spaceId, viewDependantObjectsIds, bundle.RelationKeyId)
Copy link
Member

Choose a reason for hiding this comment

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

viewDependentObjects 🙃

Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
Signed-off-by: AnastasiaShemyakinskaya <[email protected]>
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