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

Add graph for daily downloads #89

Open
bruno-garcia opened this issue Feb 7, 2020 · 2 comments
Open

Add graph for daily downloads #89

bruno-garcia opened this issue Feb 7, 2020 · 2 comments
Labels
enhancement New feature or request new-feature

Comments

@bruno-garcia
Copy link
Member

Currently we only have a ever growing graph.
The feature request is to add a second graph that will show the number of downloads for a time period.

Matthias' request: https://twitter.com/matkoch87/status/1225797785313796099

@bruno-garcia bruno-garcia added enhancement New feature or request new-feature labels Feb 7, 2020
@michael-hawker
Copy link

My SQL is rusty, it seems like this is where the data is grabbed from the DB:

const string sql = @"
SELECT AVG(COALESCE(d.download_count, NULL)) AS download_count,
DATE_TRUNC('day', (totalPeriod.day + CAST((-CAST(FLOOR(DATE_PART('dow', totalPeriod.day)) AS integer) || ' days') AS interval))) AS week
FROM
(
SELECT day
FROM generate_series(
DATE_TRUNC('day', (NOW() AT TIME ZONE 'UTC' + CAST((-@months || ' months') AS interval)))
, DATE_TRUNC('day', (NOW() AT TIME ZONE 'UTC'))
, interval '1 day') AS t(day)
) AS totalPeriod
LEFT JOIN daily_downloads AS d ON totalPeriod.day = d.date AND d.package_id = @packageId
GROUP BY week
ORDER BY week;";

Does the DB have the raw download data per day or is it stored in aggregate form already?

@joaopgrassi
Copy link
Member

@michael-hawker the data is stored per day, in the daily_downloads table. We do it by hitting the NuGet API daily for all stored packages we have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new-feature
Projects
None yet
Development

No branches or pull requests

3 participants