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

Added API framework and a package stats endpoint #76

Merged
merged 10 commits into from
Jan 3, 2015
Merged

Added API framework and a package stats endpoint #76

merged 10 commits into from
Jan 3, 2015

Conversation

ColdenCullen
Copy link
Contributor

The idea is that this should allow us to start adding badges to shields.io.

This PR also leads the way towards adding more stats in the future.

@PxlBuzzard
Copy link
Contributor

If you switched the import in registry.d#130 to be days instead of weeks, you could do the same math for perWeek and perMonth and add a perDay as well.

@ColdenCullen
Copy link
Contributor Author

@PxlBuzzard done.

@s-ludwig
Copy link
Member

My only nitpick would be to use a statically typed struct instead of Json for the return type of getPackageStats. I'd also exclude any downloads that are not for tagged versions (i.e. eclude those that have a version field starting with ~), because those are re-downloaded for every dub upgrade and thus would potentially yield unrealistic numbers.

@s-ludwig
Copy link
Member

(Maybe using Nullable to be able to express the Json(null))

@ColdenCullen
Copy link
Contributor Author

Done!

As far as the nullable goes, I realized that the db will throw if the package isn't found, so it's trivial to just pass the exception up another level.

@ColdenCullen
Copy link
Contributor Author

Ping?

1 similar comment
@ColdenCullen
Copy link
Contributor Author

Ping?

@ColdenCullen
Copy link
Contributor Author

Ping @s-ludwig again? I really want dub shields!

uint total;
uint perDay;
uint perWeek;
uint perMonth;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about daily, weekly and monthly instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

@MartinNowak
Copy link
Member

What about querying downloads by version?

@ColdenCullen
Copy link
Contributor Author

@MartinNowak I think I've addressed all of your concerns at this point, let me know if you spot anything else that could be better.

MartinNowak and others added 3 commits December 17, 2014 02:59
- fix api prefix (needs leading slash)

- add package_1_version_1 index on downloads
- responds with 404 otherwise
DB aggregation for downloads stats
@ColdenCullen ColdenCullen changed the title Added package stats route with download count Added API framework and a package stats endpoint Dec 22, 2014
@ColdenCullen
Copy link
Contributor Author

@MartinNowak now that your changes have been merged, is there anything else we're waiting on?

@ColdenCullen
Copy link
Contributor Author

Ping?

MartinNowak added a commit that referenced this pull request Jan 3, 2015
Added API framework and a package stats endpoint
@MartinNowak MartinNowak merged commit 50d5dbf into dlang:master Jan 3, 2015
@MartinNowak
Copy link
Member

thx

@ColdenCullen ColdenCullen deleted the packagestats branch January 3, 2015 02:27
@MartinNowak
Copy link
Member

Shield now available on http://shields.io/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants