codeforamerica / civic-issue-finder

UNMAINTAINED. An embeddable widget to find issues on the Code for America API
http://www.codeforamerica.org/geeks/civicissues
33 stars 15 forks source link

Only getting issues from 1 repo #21

Closed leahbannon closed 10 years ago

leahbannon commented 10 years ago

I'm only getting issues from one of our repos even though I know we have other issues with that tag. Are we doing something wrong? (p.s. @ondrae halp pretty plz - I'm hoping to use for a hackathon Friday.) cc @ultrasaurus

ondrae commented 10 years ago

No, its a legitimate bug. I'm looking into it.

@rebeccawilliams has the same thing happening.

ondrae commented 10 years ago

Okay I figured it out. Couldn't have without both of your clues.

The GitHub API returns Issues at something like 20 at a time. You have to make another request for the next page. Both of your orgs are so big that you have a bunch more than 20 issue a project.

There is also a change I can make that compares the last time they were updated. I'll do that to as well as adding in following paging links.

rebeccawilliams commented 10 years ago

NICE @ondrae. Too many Issues. :smile: Looking forward to embedding them all.

leahbannon commented 10 years ago

I'm not sure if this is my issue. I realized I'm pulling from mulitple repos now, BUT I'm only displaying 10 issues from 18F.

The mention of pagination got me thinking, though, and I realized that we're only pulling issues that are in page 1 of a repo's list of issues on GitHub.

adelevie commented 10 years ago

Hi @ondrae. I did a bit of digging and I think I have a solution. Sorry that I don't have time to run this code myself and test locally, but I think a "good-enough" fix can be made with a single line change.

Just add a ?per_page=100 query parameter to the URL in get_issues.

As far as @leahbannon and I can tell, we don't have (m)any repos with more than 100 outstanding issues.

ondrae commented 10 years ago

@adelevie I added what you suggested.

Lots of more open issues for everyone now.

I still need to explicitly handle paging better. Yet I wanted to help you all out in time for your hackathon tomorrow.

adelevie commented 10 years ago

Thanks for adding that! @leahbannon, did that fix the problem?

ondrae commented 10 years ago

Data.gov and @rebeccawilliams had more than 100 issues in some of their projects though!

I removed the per_page=100 and did proper paging with tests. Should be all good now.

rebeccawilliams commented 10 years ago

Yes, that fixed my issue! http://rebeccawilliams.us/testembed

Thanks both!