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

Count on relation should work for belongsToMany relations. #2093

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yoshiwarab
Copy link

@yoshiwarab yoshiwarab commented Dec 9, 2020

Introduction

When calling count on a relationship collection, if the relation is belongsToMany, count returns the count of the entire table instead of just the related entries. The belongsToMany case did not seem to be handled at all previously in sync.js.

Motivation

Describe the problems that this proposal seeks to address and why it's important. If it's completely new functionality
explain why this new functionality is necessary.

Proposed solution

Describe your solution to the problem. If possible provide examples and describe how they work. Show why your solution
is better than what's currently available: is it cleaner, safer, or more efficient?

Current PR Issues

Are there any known issues in this Pull Request? This will help others understand if more work will be needed.

Alternatives considered

Describe any alternative approaches to addressing the same problem that you have thought about, and why you chose this
approach instead.

@ricardograca ricardograca self-requested a review December 9, 2020 18:51
Copy link
Member

@ricardograca ricardograca left a comment

Choose a reason for hiding this comment

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

Can you fix the linter issues and add tests for this change?

@yoshiwarab
Copy link
Author

Will do!

@yoshiwarab
Copy link
Author

yoshiwarab commented Dec 11, 2020

@ricardograca, fixed the linter issue and added a test that seems to be passing. Not sure why the build is failing, could you take a look when you get the chance?

@ricardograca
Copy link
Member

Thanks! One of the jobs just hanged and timed out without any errors at the end, so I just restarted it. I'll check the code later.

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.

None yet

2 participants