Skip to content

Count only guns toward the compare page's accuracy [patch] - #95

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/compare-accuracy-guns-only
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/compare-accuracy-guns-only

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #93

What changed

CompareViewBuilder.Side summed Hits and Shots over every weapon. Only guns record shots: OnWeaponFire returns early for anything that isn't a gun. So knife and Zeus hits were added to the numerator with no matching shots in the denominator. For example, 20 AK hits from 100 shots plus 30 knife hits showed 50% accuracy.

Hits and shots are now summed only over weapons where WeaponCatalog.Find(key)?.IsGun == true. This matches LifeTracker's per-life accuracy. Kills and headshot % still count every weapon.

Tests

  • New: CompareTests.Build_AccuracyCountsOnlyGunsBecauseKnifeAndZeusRecordNoShots. It adds knife and taser hits to a player and checks that Accuracy stays at the gun-only 50%. It fails without the fix and passes with it.
  • Full suite: 742 passed, 7 skipped.

Note: main doesn't build at the moment (#82: KTSU0006 in the Site). #85 fixes that, and this PR's CI will fail at build until #85 merges. I ran the tests above with #85's two-line package change applied locally. That change is not part of this PR.


Generated by Claude Code

The compare page summed hits and shots over every weapon, but only guns
record shots: a knife or Zeus hit added to the numerator with nothing in
the denominator, so 20 AK hits from 100 shots plus 30 knife hits showed
50%. Hits and shots are now summed over guns only, matching LifeTracker.

Fixes #93

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5PUccwNk8Pndsg92E

Copy link
Copy Markdown
Contributor Author

CI is red on both test legs, but the cause is already on main, not this PR. The build stops before any tests run, with two KTSU0006 errors:

  • CounterStrikeProgression.Site/MetricsEndpoints.cs(22,38): transitive Microsoft.Extensions.DependencyInjection.Abstractions used directly
  • CounterStrikeProgression.Site/Live/LiveState.cs(28,97): transitive Microsoft.Extensions.Logging.Abstractions used directly

This PR doesn't touch either file. #82 tracks the failure and #85 fixes it. With #85's package change applied locally, this branch's full suite passes (742 passed, 7 skipped). Once #85 merges, this PR's CI should go green on the next run.


Generated by Claude Code

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.

Compare page's overall Accuracy counts knife and Zeus hits but none of their shots: 20 AK hits from 100 shots plus 30 knife hits shows 50%

2 participants