feat(soccer-app): add shared team metrics utilities - #29
Open
ayushtr-aws wants to merge 1 commit into
Open
Conversation
Task-Id: 01KZPA8T6FNVA1NRZSVEYMVHJV Prompt-Version: 1c9c10e027a2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces reusable, typed soccer team metric helpers in a new
soccer-app/src/utils/teamMetrics.tsmodule (TG-10). No UI changes — this only adds utilities for future consumption.Exported helpers:
goalDifference(stats)— goals scored minus goals conceded (signed).winRate(stats)— wins as a fraction of matches played, in[0, 1], rounded to 4 decimals for deterministic output. Returns0when no matches have been played (safe zero-division handling).performanceLabel(stats)— a concisePerformanceLabel("Elite" | "Strong" | "Average" | "Struggling") derived from the win rate. Teams with zero matches get a neutral"Average"default.All helpers accept the existing
TeamStatstype fromsrc/data/teams.tsand are pure/deterministic.Task
TG-10: Add shared team metrics utilities (sub-issue of epic "ABCA Jira stacked corrections acceptance round 2").
Build & test results
Ran from
soccer-app(dependencies installed withnpm cifirst, asnode_moduleswas absent):mise run build(tsc -b && vite build) — PASS: 20 modules transformed, built successfully.mise run lint(oxlint) — PASS: no warnings or errors (exit 0).The repository has no test suite; validation was done via the TypeScript compiler (strict
noUnusedLocals/noUnusedParameters) and the linter.Decisions made
soccer-app/src/utils/teamMetrics.ts) and reused the existingTeamStatsinterface rather than defining a new shape, to stay consistent with the codebase.performanceLabel(0.7 / 0.5 / 0.3) as a simple, deterministic mapping. Zero-match teams return"Average"andwinRatereturns0to handle division safely.winRateto 4 decimal places to keep outputs deterministic.import typeto comply with the project'sverbatimModuleSyntaxsetting.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.
Agent notes
TeamStatsinterface made typing straightforward.soccer-app/node_moduleswas not installed despite the setup step reportingmise install: OK—tsc/vite/oxlintbinaries were missing, sonpm cihad to be run insidesoccer-appbefore the build/lint tasks would work.soccer-app/; build istsc -b && vite build, lint isoxlint(config in.oxlintrc.json).mise.tomlat the root proxiesbuild/lint/devtasks into thesoccer-appdir. TS config enablesverbatimModuleSyntax, so type-only imports must useimport type.soccer-appdeps are pre-installed in the environment would also speed up build/lint verification.