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

Contributor count on tag pages not reflecting number of contributors #6675

Closed
steviepubliclab opened this issue Nov 4, 2019 · 5 comments · Fixed by #6954
Closed

Contributor count on tag pages not reflecting number of contributors #6675

steviepubliclab opened this issue Nov 4, 2019 · 5 comments · Fixed by #6954
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute

Comments

@steviepubliclab
Copy link
Contributor

I was looking for the number of posts and contributors to this tag (https://publiclab.org/tag/oil-and-gas) and saw that the number was listed here as Zero:
Screen Shot 2019-11-04 at 11 59 38 AM

But there are actually 73 contributors and 38 posts. This can be found here https://publiclab.org/contributors/oil-and-gas:
Screen Shot 2019-11-04 at 12 00 54 PM

@steviepubliclab steviepubliclab added the bug the issue is regarding one of our programs which faces problems when a certain task is executed label Nov 4, 2019
@ebarry
Copy link
Member

ebarry commented Nov 4, 2019

great catch!

@jywarren
Copy link
Member

jywarren commented Nov 4, 2019

So, here are the queries used for the 0 posts by 0 contributors | 0 followers area:

<p class="contributor-info"><%= Tag.find_nodes_by_type(tag.name, 'note', false).count %> posts by
<a href="/contributors/<%= params[:id] %>"><%= Tag.contributor_count(tag.name) %> contributors</a> |
<a href="/contributors/<%= params[:id] %>"><%= Tag.follower_count(tag.name) %> followers</a>
<a href="https://publiclab.org/wiki/contributors"><i class="fa fa-question-circle-o" aria-hidden="true"></i></a>
</p>

Here's somewhere they seem to be counting correctly, in the lower right of the main image:

<%= Tag.follower_count(params[:id]) %> following

Is it possible that tag.name is not correct?

Yes! This relates to the error on

<a rel="tooltip" title="<%= t('sidebar._post_button.share_your_work') %>" data-placement="bottom" href="/post?tags=<%= tag.name %>" class="btn btn-primary requireLogin">New post <i class="fa fa-plus fa-white"></i></a>

This has the same error! #6592

We should be able to solve both by replacing tag.name with params[:id] for these lines.


This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!

@jywarren jywarren added fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute labels Nov 4, 2019
@nicoleiocana
Copy link
Contributor

I would also like to piggy-back off of @jywarren to mention that the entire show.html.erb code should be refactored to include the instance variable @title since the tag_controller.rb file has @title = params[:id]. Since we should be practicing DRY, it is redundant to have params[:id] in the show.html.erb file when it was passed along as the @title instance variable from the tag_controller.rb.

@jywarren
Copy link
Member

jywarren commented Nov 4, 2019 via email

@nicoleiocana
Copy link
Contributor

nicoleiocana commented Nov 4, 2019

You are very welcome. I totally agree with you...... trust me. But since this isn't my code, I didn't want to edit out their usage of certain definitions; I was just using what they gave me. I'll submit this PR using @title, then, if someone wants to refactor the code to redefine @title to mean something else, I'll just let them have that responsibility. =)

EDIT: Due to my conversation with @jywarren in #6592, the PR for this issue will replace @title with params[:id] in locations where the code is referencing the params passed from the previous link, not where it refers to the page header title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute
Projects
None yet
4 participants