Skip to content

Filter fake components for statistics - #2832

Open
Hubtrick-Git wants to merge 2 commits into
mainfrom
filter-fake-components-for-statistics
Open

Filter fake components for statistics#2832
Hubtrick-Git wants to merge 2 commits into
mainfrom
filter-fake-components-for-statistics

Conversation

@Hubtrick-Git

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates statistics queries to exclude non-component “fake” dependency IDs (e.g., ROOT) by restricting results to valid pURL-like dependency IDs (pkg:%), improving the accuracy of component-related statistics.

Changes:

  • Add dependency_id LIKE 'pkg:%' filtering to the “most used components in org” query.
  • Add dependency_id LIKE 'pkg:%' filtering to the “top components across instance” query.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

COUNT(DISTINCT (cd.asset_id)) AS total_amount,
COALESCE(1.0 * COUNT(DISTINCT (cd.asset_id)) / NULLIF((SELECT COUNT(*) FROM assets), 0), 0) as relative_amount
FROM component_dependencies cd
WHERE cd.dependency_id LIKE 'pkg:%' -filter out non components like ROOT
Comment on lines 388 to 392
WHERE c.organization_id = ?
AND a.dependency_id LIKE 'pkg:%' --filter out non components like ROOT
GROUP BY a.dependency_id
ORDER BY total_amount DESC, a.dependency_id ASC
LIMIT ?;`, orgID, limit).Find(&components).Error
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.

2 participants