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

feat : Show dependencies dependents count #342 #857

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

BorisLord
Copy link

@BorisLord BorisLord commented Dec 4, 2024

Fixes #342.

I think a should export some code to improve visibility in of the get_handler function in package.rs into an other file but where ? utils.rs ?

Ready to read suggestions and make changes if needed !

@CLAassistant
Copy link

CLAassistant commented Dec 4, 2024

CLA assistant check
All committers have signed the CLA.

@BorisLord BorisLord changed the title Show dependencies dependents count #342 feat : Show dependencies dependents count #342 Dec 5, 2024
Comment on lines +317 to +327
let deps = db
.list_package_version_dependencies(&scope, &package, &latest_version)
.await?;

api_package.dependency_count = {
let mut unique_deps = HashSet::new();
deps
.iter()
.filter(|dep| unique_deps.insert(&dep.dependency_name))
.count() as u64
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe convert this to a database COUNT as well, especially since this is an active hotpath and recomputing this constantly seems a bit unecessary

Copy link
Author

Choose a reason for hiding this comment

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

ok i'll do it.

@crowlKats
Copy link
Collaborator

@BorisLord overall this PR looks good to me; any reason this is marked as a draft?

@BorisLord
Copy link
Author

BorisLord commented Jan 15, 2025

@crowlKats There's no longer a good reason being marked at draft Thx

@BorisLord BorisLord marked this pull request as ready for review January 15, 2025 15:43
Copy link
Collaborator

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

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

LGTM, just waiting on the change to use a database COUNT instead of manual

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.

Show number of dependencies / dependents on the web
3 participants