Skip to content

Add recent uploads to stats page#1238

Closed
bobwhitelock wants to merge 6 commits into
rubygems:masterfrom
bobwhitelock:add_recent_uploads_to_stats_page
Closed

Add recent uploads to stats page#1238
bobwhitelock wants to merge 6 commits into
rubygems:masterfrom
bobwhitelock:add_recent_uploads_to_stats_page

Conversation

@bobwhitelock
Copy link
Copy Markdown
Contributor

This PR adds a table for the 10 most recently uploaded gem versions to the stats page, as suggested in #1217.

I've tried to keep this in a similar style to the rest of the page but this might be able to be improved. Potentially more information could also be added to this table, e.g. displaying how long ago uploads took place might be useful.

I did encounter one issue just now after rebasing this branch to be up to date with the latest changes - when I visit the stats page after this I get the following error:

NoMethodError (undefined method `gem_download' for nil:NilClass):
app/controllers/stats_controller.rb:7:in `index'

I think this is because I have no downloads yet in my local database; I then tried to download a gem to see if this would fix this however I get the following error when visiting the download page:

ActionController::RoutingError (No route matches [GET] "/gems/rake-11.1.2.gem"):

I'm not sure why this route would be failing though.

@arthurnn
Copy link
Copy Markdown
Member

arthurnn commented Apr 1, 2016

Hi,

Even if you dont have downloads locally this should work.

Can you also provide a screenshot of the change?
thanks

@bobwhitelock
Copy link
Copy Markdown
Contributor Author

Hi,

If you'd like to see if you can reproduce this: I set up a development environment as described in https://github.com/rubygems/rubygems.org/blob/master/CONTRIBUTING.md#development-setup, and the only data in my database I imported from the latest postgres database dump (2016-03-28T21:21:28), and with this branch currently receive that NoMethodError. I haven't imported any Redis data.

I believe this error occurs because in StatsController#index, @most_downloaded is an empty array, which in turn is the case because the gem_downloads table in my database has no data. I think I saw that a recent change (between my initial branch and rebase) moved gem downloads from being stored in Redis to Postgres, so maybe this has caused this issue to occur now before any downloads have been made? If this is the cause, then if future database dumps include downloads data that would prevent this from happening - although it would still occur if a database dump is not imported.

In any case, here's a screenshot of the change (I've commented out the problem line so I can take this, which is why the most downloaded graph is not showing):

screenshot - 030416 - 14 17 29

Thanks

@bobwhitelock
Copy link
Copy Markdown
Contributor Author

Hi, I wondered if anyone had a chance to look at this or has any feedback on this PR? Cheers

@dwradcliffe
Copy link
Copy Markdown
Member

I think Version.just_updated is already there which should be what you need. A rebase should fix the Travis CI errors.

@bobwhitelock bobwhitelock force-pushed the add_recent_uploads_to_stats_page branch from bcdcf96 to 4fb51e6 Compare May 1, 2016 11:09
@bobwhitelock
Copy link
Copy Markdown
Contributor Author

Thanks for your response, I've rebased on master now and it looks ok.

Regarding Version.just_updated, I believe this will only give you new versions of existing gems but won't include the first upload of a gem due to the HAVING COUNT(versions.id) > 1) section. However I thought these would be something we would want to include in this table as they are recent uploads, hence the need for a new method.

@homu
Copy link
Copy Markdown
Contributor

homu commented May 2, 2016

☔ The latest upstream changes (presumably #1259) made this pull request unmergeable. Please resolve the merge conflicts.

This commit displays the gem name and version number for recently
uploaded gems within a new table on the stats page.
These link to the gem's page for the gem name, and the particular
version's page for the version number.
@bobwhitelock bobwhitelock force-pushed the add_recent_uploads_to_stats_page branch from 4fb51e6 to 1bccd78 Compare May 2, 2016 20:09
@bobwhitelock
Copy link
Copy Markdown
Contributor Author

Sure, done

@dwradcliffe
Copy link
Copy Markdown
Member

Thinking about this some more, and I think this might fit better on it's own page. Recent uploads aren't really stats. A "recent" page might work well?

@bobwhitelock
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @dwradcliffe, I think that sounds reasonable that these should be separate pages rather than dumping everything on the stats page. I'll try to take another look at this at some point soon.

@homu
Copy link
Copy Markdown
Contributor

homu commented Jun 16, 2016

☔ The latest upstream changes (presumably #1272) made this pull request unmergeable. Please resolve the merge conflicts.

@tadityar tadityar mentioned this pull request Sep 9, 2016
@jvanbaarsen
Copy link
Copy Markdown
Contributor

@bobwhitelock Are you still working on this?

@bobwhitelock
Copy link
Copy Markdown
Contributor Author

@jvanbaarsen: Nope, I meant to come back to it but looks like I haven't yet so probably will never happen!

@jvanbaarsen
Copy link
Copy Markdown
Contributor

@bobwhitelock Ok! Can you close this PR in that case? Keeps the backlog a bit cleaner :-)

@bobwhitelock
Copy link
Copy Markdown
Contributor Author

OK :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants