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

Showing contributors on /contributors/____ pages #2444

Closed
jywarren opened this issue Mar 7, 2018 · 3 comments
Closed

Showing contributors on /contributors/____ pages #2444

jywarren opened this issue Mar 7, 2018 · 3 comments
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 Ruby

Comments

@jywarren
Copy link
Member

jywarren commented Mar 7, 2018

https://publiclab.org/contributors/microplastics says 8 contributors, but below on that page nobody is listed.

The code is here: https://github.com/publiclab/plots2/blob/master/app/views/tag/contributors.html.erb

But it's driven by this controller code:

def contributors
set_sidebar :tags, [params[:id]], note_count: 20
@tagnames = [params[:id]]
@tag = Tag.find_by(name: params[:id])
@note_count = Tag.tagged_node_count(params[:id]) || 0
@users = Tag.contributors(@tagnames[0])
end

Any help fixing this would be appreciated!!!

We should also work to add a test to ensure this page gets properly populated. We could do a functional test in this file:

test 'tag contributors' do
get :contributors, id: Tag.last.name
assert :success
assert_not_nil :notes
assert_not_nil :users
assert_not_nil :tag
end

There, we don't really count contributors. We should!

Using assert_equal assigns(:users), 99 (where 99 is the expected number of users)

@jywarren jywarren added bug the issue is regarding one of our programs which faces problems when a certain task is executed help wanted requires help by anyone willing to contribute Ruby fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet labels Mar 7, 2018
@jywarren
Copy link
Member Author

I think there may have been a reversion in #2180 which affected @Gauravano's code in #2062:

https://github.com/publiclab/plots2/blob/ca820a87e083ed7aff95e6c903732d2d4fca7949/app/views/tag/_contributors.html.erb

It looks like @noteCount was changed to @note_count and I've reverted that in #2479. I want to add a functional test to ensure these are shown.

@jywarren
Copy link
Member Author

Attempting fix in #2479

@jywarren
Copy link
Member Author

with test at

assert_select ".users-row", assigns(:users).length

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 Ruby
Projects
None yet
Development

No branches or pull requests

1 participant