Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.
If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!
If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!
We need to fetch and display the questions for a given user (like on their profile!) in a few different places, but don't have an easy way to do it -- we write a chained ActiveRecord method like here:
https://github.com/publiclab/plots2/blob/master/app/controllers/users_controller.rb#L119
It looks like:
DrupalNode.questions.where(status: 1, uid: @user.id)
We should make a method in the User model to make this easier, and reduce repetition. The user model is in: https://github.com/publiclab/plots2/tree/master/app/models/user.rb
We can add a new method (at the bottom of the file is fine) like:
def questions
DrupalNode.questions.where(status: 1, uid: @user.id)
end
Then we could replace these two lines: https://github.com/publiclab/plots2/blob/master/app/controllers/users_controller.rb#L119-L120
with this (the double "user" is unfortunate, but has to do with some legacy issues in our database setup):
@questions = @user.user.questions
We should also write a unit test for this new function, in: https://github.com/publiclab/plots2/blob/master/test/unit/user_test.rb
Right after line 26, we could add:
assert user.questions.count > 0
This would confirm that, in our tests, our new method correctly returns that the user "jeff" has more than 0 questions.
Please email the developers list (see https://publiclab.org/developers) if you have questions!
Hello! I wanna do this!
I'll clone the project and start working on this. I'll post any questions I have here on this thread, ok?
That would be absolutely super, Ruan! A bunch of us are here and can help
discuss, etc.
+1 336-269-1539
@lizbarry http://twitter.com/lizbarry
On Mon, Oct 31, 2016 at 3:23 PM, Ruan Brandão [email protected]
wrote:
Hello! I wanna do this!
I'll clone the project and start working on this. I'll post any questions
I have here on this thread, ok?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/935#issuecomment-257393869,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJ2nwHp2MkZdaMqnOZJg2xXUpNQu2bcks5q5kBGgaJpZM4KkpxJ
.
Hi @ruan-brandao! Thank you for reaching out to Public Lab! I would like to invite you to join us in a video conference to say a few words about what you found engaging about the Public Lab community and/or this particular github issue. The event is https://publiclab.org/openhour, and it’s coming right up on November 7th, at 1pm EDT which is UTC/GMT -4.
Please feel free to respond here, or else email [email protected], [email protected], [email protected].
Hi @ebarry. Unfortunately, I won't be able to attend to the Open Hour :disappointed: