Repository navigation
Conversation
Seed time is only kept while a Seeding reward rule is on, so on a server without one every hour spent seeding counted as played. The worker now tallies idle time per match line (time on before any side has scored), 0051 rolls it into the totals and day rows, and kills per hour leaves out the larger of seed and idle time. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011q1rvh2JotX9onGUYQH78V
The same rule as kills per hour: the larger of seed and idle time comes off the time the cash was made in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011q1rvh2JotX9onGUYQH78V
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.
The problem
Kills per hour leaves out seed time, but seed time is only kept while a Seeding reward rule is on. A server that rewards seeding some other way (ours does it from a Discord bot) has no seed time at all, so every hour a player spends on the server waiting for the match to start counts as played.
On our server (
MinimumRequiredPlayers=20) a match on 2026-10-17 sat at a score of 0 for about six hours with 1 to 7 players on before it went live. A player who seeded it and then played the match had 434 minutes on and 43 kills that day, and their K/h divided by all six hours of the wait. They asked for K/h to count only the time a match is actually being played.The change
tallyLook,match-players.ts): the gaps a player was on while no side had scored yet, the same test AFK protection uses for "the server is seeding". It is written with the line asmatch_players.idle_seconds.match_players,player_totalsandplayer_days, and restates the six functions that list the line columns: 0038'splayer_totals_recountand 0039'splayer_days_recount,player_lines_cleared,player_totals_match_ended,player_days_rebuildandplayer_totals_rebuild. Each hasidle_secondsadded and nothing else changed (checked line by line against the originals). Every existing line has 0, so nothing needs rebuilding.rangeBase,seasonBaseandtotalsBasecarryidle_minutes, and kills per hour iskills / (minutes - GREATEST(seed_minutes, idle_minutes)): in SQL for the sort, and inperHourfor the table and the export. The larger of the two rather than their sum, because on a server with a Seeding reward both count mostly the same minutes.cash / (cash_minutes - GREATEST(seed_minutes, idle_minutes)), in SQL and inperMinute. Its time is whole sessions while idle time goes by when a match ended, so on a 7, 30 or 90-day board the two can differ a little at the range's first day; all time they agree. Seed time has the same kind of edge.Things worth your view
MatchState.PreMatch.WaitingForPlayers, which says it exactly, but only where the feed reaches Warcon. Scores work on every server, so I used them. Preferring the state when there is one would be a small follow-up.Tests
tallyLooktallies idle time only while no side has scored, and none when the scores are unknown;writeMatchPlayersstores it;perHourandperMinuteleave out the larger of seed and idle time.totals-oracle.tscarriesidle_minutes, so the exactness tests compare it. The 120-step test writes lines with idle time (fixed values: a random draw would change the seeded history after it), anddayTablecompares the column.insertEarlyLines(src/test/db.ts): a raw insert of just the columns given, because Drizzle's insert names every column in the schema,idle_secondsincluded, which those databases do not have yet. Any later column onmatch_playerswould have hit the same thing.Checks
prettier --check .: clean.bun run check: 0 errors, 0 warnings.bun testwithTEST_DATABASE_URLon Linux, againsttimescale/timescaledb:2.30.0-pg18: 1669 pass, 1 skip, 0 fail across 169 files.🤖 Generated with Claude Code
https://claude.ai/code/session_011q1rvh2JotX9onGUYQH78V