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

sub-segments of used segment will show as used in segments list #1057

Merged
merged 5 commits into from
Oct 16, 2023

Conversation

Yagnik56
Copy link
Collaborator

This PR will resolve the issue of sub-segments of used segments not showing as used.

Copy link
Collaborator

@bcb37 bcb37 left a comment

Choose a reason for hiding this comment

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

One suggestion

@@ -110,6 +110,24 @@ export class SegmentService {
});
}

segmentsData.forEach((segment) => {
segmentsUsedLockedList.forEach((usedSegment) => {
if (segment.id === usedSegment) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can replace this third-level loop with something like: segmentsUsedLockedList.push(...segment.subSegments.map(subSegment => subSegment.id))
and also below for the unlocked list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

the second level loop can be replaced with an if condition
if(segmentUsedList.includes(segment.id))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved

@Yagnik56 Yagnik56 requested a review from bcb37 October 12, 2023 08:03
return { ...segment, status: SEGMENT_STATUS.USED }; // TODO change to locked
} else if (segmentsUsedUnlockedList.find((segmentId) => segmentId === segment.id)) {
return { ...segment, status: SEGMENT_STATUS.USED }; // TODO change to unlocked
} else if (segmentsUsedList.find((segmentId) => segmentId === segment.id)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use includes over here also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved

@@ -85,38 +85,35 @@ export class SegmentService {
const allExperimentSegmentsInclusion = await this.getExperimentSegmenInclusionData();
const allExperimentSegmentsExclusion = await this.getExperimentSegmenExclusionData();
Copy link
Collaborator

Choose a reason for hiding this comment

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

These three sequential awaits should be executed parallelly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved

Copy link
Collaborator

@VivekFitkariwala VivekFitkariwala left a comment

Choose a reason for hiding this comment

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

I have added some comments

@Yagnik56 Yagnik56 merged commit 7fdf95b into dev Oct 16, 2023
9 checks passed
@Yagnik56 Yagnik56 deleted the bugfix/subsegments-of-used-segment-not-showed-as-used branch October 16, 2023 11:14
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.

We are not detecting sub segments if they are being used within the main segment
3 participants