-
Notifications
You must be signed in to change notification settings - Fork 4
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
Bugfix- Fetch parent feature using topLevel flag #478
Bugfix- Fetch parent feature using topLevel flag #478
Conversation
Can we simplify this more by not even calling diff --git a/packages/apollo-collaboration-server/src/features/features.service.ts b/packages/apollo-collaboration-server/src/features/features.service.ts
--- a/packages/apollo-collaboration-server/src/features/features.service.ts
+++ b/packages/apollo-collaboration-server/src/features/features.service.ts
@@ -86,12 +86,14 @@ export class FeaturesService {
this.logger.error(errMsg)
throw new NotFoundException(errMsg)
}
+ if (topLevel) {
+ return topLevelFeature
+ }
// Now we need to find correct top level feature or sub-feature inside the feature
const foundFeature = this.getFeatureFromId(
topLevelFeature,
featureId,
- topLevel,
)
if (!foundFeature) {
const errMsg = 'ERROR when searching feature by featureId'
@@ -111,8 +113,6 @@ export class FeaturesService {
getFeatureFromId(
feature: Feature,
featureId: string,
- topLevel?: boolean,
- parent?: Feature | null,
): Feature | null {
this.logger.verbose(`Entry=${JSON.stringify(feature)}`)
@@ -120,9 +120,6 @@ export class FeaturesService {
this.logger.debug(
`Top level featureId matches in object ${JSON.stringify(feature)}`,
)
- if (topLevel && parent) {
- return parent
- }
return feature
}
// Check if there is also childFeatures in parent feature and it's not empty
@@ -134,13 +131,8 @@ export class FeaturesService {
const subFeature = this.getFeatureFromId(
childFeature,
featureId,
- topLevel,
- feature,
)
if (subFeature) {
- if (topLevel) {
- return feature
- }
return subFeature
}
} |
This will return topLevelFeature (gene) for all requests. We need to return immediate parent of requested featureId. Sorry for the confusion with description, I've updated it now. |
I guess I don't understand what we're trying to do. Could you provide a small example of what it's doing now and what you want it to do? |
The current behaviour is returning top level feature for all requests when topLevel flag is true. Here
The desired behaviour is to return the immediate parent of requested feature when topLevel flag is true and return the requested feature when the flag is false. Ex:
When topLevel flag is true,
Immediate parent is determined by below base case of the
Maybe the |
That wasn't the original intention of I think we need to always return the top-level feature if |
The current behavior is returning the top-level feature (gene) for all requests, but the desired behavior is to return the immediate parent of the featureId.