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

Fixes #8453: added the number of followers/following in the profile of the user #8462

Merged
merged 3 commits into from
Oct 12, 2020

Conversation

BatoolMM
Copy link
Contributor

@BatoolMM BatoolMM commented Oct 6, 2020

I was trying to display the list of user's followers and the list of people whom the user is following.
This is the link for the issue: #8453

I can display the list of followers/following but not their count. I added the code in profile.html.erb
Can you have a look? Any help would be greatly appreciated?

Regards,
Batool

@BatoolMM BatoolMM requested a review from a team as a code owner October 6, 2020 15:41
@gitpod-io
Copy link

gitpod-io bot commented Oct 6, 2020

@welcome
Copy link

welcome bot commented Oct 6, 2020

Thanks for opening this pull request! This space is protected by our Code of Conduct - and we're here to help.
Dangerbot will test out your code and reply in a bit with some pointers and requests.
Also please refer here for installation help 💿
There may be some errors, but don't worry! We'll work through them with you! 👍🎉😄
It would be great if you can tell us your Twitter handle so we can thank you properly?

@codecov
Copy link

codecov bot commented Oct 6, 2020

Codecov Report

Merging #8462 into main will decrease coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8462      +/-   ##
==========================================
- Coverage   82.01%   81.89%   -0.12%     
==========================================
  Files         101      101              
  Lines        5899     5894       -5     
==========================================
- Hits         4838     4827      -11     
- Misses       1061     1067       +6     
Impacted Files Coverage Δ
app/models/node.rb 91.45% <ø> (-0.07%) ⬇️
app/controllers/comment_controller.rb 86.95% <100.00%> (ø)
app/controllers/map_controller.rb 50.00% <100.00%> (ø)
app/controllers/questions_controller.rb 90.78% <100.00%> (ø)
app/controllers/search_controller.rb 97.67% <100.00%> (ø)
app/controllers/users_controller.rb 81.04% <100.00%> (-0.08%) ⬇️
app/services/execute_search.rb 88.88% <0.00%> (-5.56%) ⬇️
app/api/srch/search.rb 66.87% <0.00%> (-3.83%) ⬇️
app/models/spamaway.rb 97.43% <0.00%> (+2.56%) ⬆️

@@ -268,6 +268,8 @@
<li><h5><a href = "/tag/activity:*/author/<%= params[:id] %>"><%= pluralize(@count_activities_posted, 'activity posted', plural:'activities posted') %> </a></h5></li>
<li><h5><a href = "/tag/replication:*/author/<%= params[:id] %>"><%= pluralize(@count_activities_attempted, 'activity attempted', plural:'activities attempted')%></a> </h5></li>
<li><h5><a href = "/tag/with:<%= @profile_user.username %>"><%= pluralize(Tag.find_nodes_by_type("with:#{@profile_user.username}").count, 'note co-authored', plural: 'notes co-authored')%></a> </h5></li>
<li><h5><a href = "/people/<%= params[:id]%>/followers"><%= pluralize(following_path(@user.username).count, 'follower', plural:'followers')%></a></h5></li>
Copy link
Member

Choose a reason for hiding this comment

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

Hi! Thanks so much for taking this on! Can you help me unpack this line... where is the definition for following_path() that should yield the count? I searched for https://github.com/publiclab/plots2/search?q=following_path but didn't get a definition. Could we instead use followers.size?

Suggested change
<li><h5><a href = "/people/<%= params[:id]%>/followers"><%= pluralize(following_path(@user.username).count, 'follower', plural:'followers')%></a></h5></li>
<li><h5><a href = "/people/<%= params[:id]%>/followers"><%= @user.size %> following</a></h5></li>

Copy link
Contributor Author

@BatoolMM BatoolMM Oct 6, 2020

Choose a reason for hiding this comment

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

Sorry, but can I ask why did you use@user.size %>following</a> rather than @user.size %>followers</a> since we are counting the followers?

@@ -268,6 +268,8 @@
<li><h5><a href = "/tag/activity:*/author/<%= params[:id] %>"><%= pluralize(@count_activities_posted, 'activity posted', plural:'activities posted') %> </a></h5></li>
<li><h5><a href = "/tag/replication:*/author/<%= params[:id] %>"><%= pluralize(@count_activities_attempted, 'activity attempted', plural:'activities attempted')%></a> </h5></li>
<li><h5><a href = "/tag/with:<%= @profile_user.username %>"><%= pluralize(Tag.find_nodes_by_type("with:#{@profile_user.username}").count, 'note co-authored', plural: 'notes co-authored')%></a> </h5></li>
<li><h5><a href = "/people/<%= params[:id]%>/followers"><%= pluralize(following_path(@user.username).count, 'follower', plural:'followers')%></a></h5></li>
<li><h5><a href = "/people/<%= params[:id]%>/following"><%=pluralize(following_path(@user.username).count, 'following', plural:'following')%></a></h5></li>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<li><h5><a href = "/people/<%= params[:id]%>/following"><%=pluralize(following_path(@user.username).count, 'following', plural:'following')%></a></h5></li>
<li><h5><a href = "/people/<%= params[:id]%>/following"><%= @user.size %> following</a></h5></li>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks :)

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

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

Just a suggestion for database optimization and also slightly simpler code! Thanks!!!

@BatoolMM
Copy link
Contributor Author

BatoolMM commented Oct 6, 2020

Thank you so much @jywarren for your suggestions. I made the changes you requested.
Please let me know if you need me to change anything else :)

@BatoolMM BatoolMM requested a review from jywarren October 6, 2020 17:27
@cesswairimu cesswairimu closed this Oct 6, 2020
@cesswairimu cesswairimu reopened this Oct 6, 2020
@gitpod-io
Copy link

gitpod-io bot commented Oct 6, 2020

@jywarren jywarren closed this Oct 7, 2020
@jywarren jywarren reopened this Oct 7, 2020
@gitpod-io
Copy link

gitpod-io bot commented Oct 7, 2020

@jywarren
Copy link
Member

jywarren commented Oct 7, 2020

Sorry, just trying to retrigger the tests now that we've resolved an unrelated issue!

@BatoolMM
Copy link
Contributor Author

BatoolMM commented Oct 8, 2020

Hi @renugasaraswathy , can you review this pull request which is a fix for issue: #8453, please?

Copy link
Collaborator

@cesswairimu cesswairimu left a comment

Choose a reason for hiding this comment

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

Awesome 🎉 Thanks for working on this @BatoolMM

@jywarren jywarren merged commit 6f2e84f into publiclab:main Oct 12, 2020
@welcome
Copy link

welcome bot commented Oct 12, 2020

Congrats on merging your first pull request! 🙌🎉⚡️
Your code will likely be published to PublicLab.org in the next few days, but first it will be published to https://stable.publiclab.org/ (it will take some minutes for this to load, and until then you may see logs from the build process). Please test out your work on this testing server and report back with a comment that all has gone well!
Do join our weekly check-in to share your this week goal and the awesome work you did 😃. Please find the link pinned in the issue section 📝
Now that you've completed this, you can help someone else take their first step!
Reach out to someone else working on theirs on Public Lab's code welcome page (where you'll now be featured as a recent contributor!). Thanks!

Help others take their first step

Now that you've merged your first pull request, you're the perfect person to help someone else out with this challenging first step. 🙌

https://code.publiclab.org

Try looking at this list of `first-timers-only` issues, and see if someone else is waiting for feedback, or even stuck! 😕

People often get stuck at the same steps, so you might be able to help someone get unstuck, or help lead them to some documentation that'd help. Reach out and be encouraging and friendly! 😄 🎉

Read about how to help support another newcomer here, or find other ways to offer mutual support here.

@jywarren
Copy link
Member

Thank you!!!

piyushswain pushed a commit to piyushswain/plots2 that referenced this pull request Oct 22, 2020
…profile of the user (publiclab#8462)

* added the number of followers/following in the profile of the user

* minor changes

* tried to fix Functional Tests
manchere pushed a commit to manchere/plots2 that referenced this pull request Feb 13, 2021
…profile of the user (publiclab#8462)

* added the number of followers/following in the profile of the user

* minor changes

* tried to fix Functional Tests
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this pull request Mar 2, 2021
…profile of the user (publiclab#8462)

* added the number of followers/following in the profile of the user

* minor changes

* tried to fix Functional Tests
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
…profile of the user (publiclab#8462)

* added the number of followers/following in the profile of the user

* minor changes

* tried to fix Functional Tests
ampwang pushed a commit to ampwang/plots2 that referenced this pull request Oct 26, 2021
…profile of the user (publiclab#8462)

* added the number of followers/following in the profile of the user

* minor changes

* tried to fix Functional Tests
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
…profile of the user (publiclab#8462)

* added the number of followers/following in the profile of the user

* minor changes

* tried to fix Functional Tests
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.

3 participants