Skip to content

fix(company): scope company page stats to PRs credited to the company - #271

Merged
jolelievre merged 1 commit into
PrestaShop:developfrom
PrestaEdit:fix/company-page-scoped-stats
Sep 29, 2026
Merged

jolelievre merged 1 commit into
PrestaShop:developfrom
PrestaEdit:fix/company-page-scoped-stats

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Problem

On company pages (e.g. /company/wepika):

  1. "0 contributors" while one contributor is listed: employees is usually an empty array, and [].length ?? contributors.length never falls back.
  2. Stats belong to the members, not the company. aggregateContributors summed each member's lifetime stats, on the assumption that they matched the company's counters. They don't: Traces attributes each PR separately (sponsor company, else employee time frame). Wepika showed 492 merged PRs / 236 reviews, but only 3 PRs are attributed to it. 71 of 83 companies were inflated (Kiwik: 36 → 1325, AGRO-LA: 1 → 974…).

Fix

  • The page builds its view from the company object itself (merged_pull_requests(_by_year)), and aggregateContributors is removed.
  • Reviews, issues, opened PRs, merge rate and the PR breakdown donut are hidden on company pages: they have no sponsor company, so Traces cannot attribute them. The yearly chart and the year drilldown drop series that have no data.
  • New companyMembers() helper (employees if non-empty, else PR-derived contributors), used for the subtitle and the Contributors KPI.
  • Repository sections read the new per-company repositories / repositories_by_year from feat(topcompanies): emit merged PRs per repository for each company traces#254. They stay hidden until that data is published, so this PR can be merged first.

Verification

  • New unit tests in useEntityDetail.spec.ts: company counters, repos present or absent, companyMembers fallback. The full suite (61 tests) and eslint pass.
  • Checked in the browser: Wepika and Kiwik now show only the PRs attributed to them, with the right contributor count. With JSON generated by traces#254, Top repositories / All repos come back with per-company numbers. The contributor page is unchanged.

🤖 Generated with Claude Code

The company page summed its members' lifetime stats, so a company got
credited with everything its contributors ever did (e.g. Wepika showed
492 merged PRs and 236 reviews instead of its 3 attributed PRs). It now
uses the company's own counters from traces and hides reviews, issues,
opened PRs, merge rate and PR breakdown, which traces cannot attribute
to a company. Repository sections reappear once traces emits
per-company repositories.

Also fix the "0 contributors" subtitle: employees is often an empty
array, which short-circuited the fallback to PR-derived contributors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Sep 29, 2026
@jolelievre
jolelievre merged commit ca38e9c into PrestaShop:develop Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

4 participants