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

Show the real count of comments made by a user #371

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

bgeuken
Copy link
Contributor

@bgeuken bgeuken commented Oct 30, 2018

No description provided.

@bgeuken
Copy link
Contributor Author

bgeuken commented Oct 30, 2018

Note that I didn't test this in the UI.

Copy link
Contributor

@DavidKang DavidKang left a comment

Choose a reason for hiding this comment

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

Only a few comments 😸
Thanks @bgeuken

/ FIXME. Use real count
.btn.btn-default{:title=>"#{user.name} wrote #{user.projects.length} comments"}
0
.btn.btn-default{:title=>"#{user.name} wrote #{Comments.where(commenter_id: user).count} comments"}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be Comment instead of Comments.
BTW, this could be also written as: user.comments.size and in the relationship with comments we should add the foreign_key. Something like has_many :comments, foreign_key: 'commenter_id'

@bgeuken bgeuken force-pushed the fix_showing_count_of_user_comments branch from 081921b to cb66b2d Compare November 25, 2018 21:50
@bgeuken bgeuken force-pushed the fix_showing_count_of_user_comments branch from cb66b2d to eb17a36 Compare December 28, 2018 07:56
@DavidKang DavidKang merged commit 39cb120 into SUSE:master Jan 25, 2019
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