Skip to content

Dashboard: hen-day lay rate shows over 100% (108%) #943

Description

@mforce

Observed

On the Dashboard's Lay rate card, the hen-day figure reads 108.3% on main and 107.5% on PR #940's branch. Both come from the sim fixture's default farm (101 flocks, all days partial), in the #940 before/after captures (1280 dark, "orders and Lay rate" frame). A hen lays at most one egg a day, so a hen-day rate above 100% cannot be correct.

It was already present before #940, which only changed the window it is computed over.

Where to look

  • The rate comes from the production report (GET /reports/production, spec §19.3). See IReportQueries.cs: HenDayPct = RatedEggs / RecordedHenDays. Its comments describe numerator/denominator matching rules: "the eggs of exactly the flocks whose birds are in RecordedHenDays".
  • Candidates:
    • (a) the numerator and denominator cover different flocks or days (for example, partial days);
    • (b) bird counts in the fixture are lower than the eggs recorded;
    • (c) the Dashboard's window join over two report calls double-counts.

Done when

  • The cause is found and stated: a calculation defect, or unrealistic fixture data.
  • A calculation defect is fixed, with a test using literal values, including a partial-day case.
  • If the cause is the fixture, the simulation seed is corrected so the Dashboard shows a plausible rate, and the report either caps or flags an impossible rate instead of displaying it silently.

Activity

  1. mforce commented on Sep 26, 2026

    @mforce
    OwnerAuthor

    Cause, amended after Codex gpt-6-sol review round 1 of #959: the figures in this issue come from fixture data (Sim House B recorded 380+ eggs a day from at most 350 birds; demo House 1 430+ from 420), but there was also a calculation gap. The exposure walk applied every bird movement dated D after counting D's birds, so a same-day addition (a negative Adjustment correcting a miscount) was missing from D's hen-days: 10 birds plus 10 added on D laying 20 eggs rated 200%. Fixed in 7ac891c on #959: additions count toward the day they are dated, removals keep taking effect the next day, and the over-100 flag decides from the unrounded halves.

  2. mforce commented on Sep 26, 2026

    @mforce
    OwnerAuthor

    Cause, final after Codex gpt-6-sol review round 2 of #959: the figures in this issue come from fixture data (Sim House B recorded 380+ eggs a day from at most 350 birds; demo House 1 430+ from 420). The calculation itself keeps the #92 convention: every bird movement, addition or removal, takes effect from the next day. A same-day addition can therefore legitimately read above 100% for that day, and the over-100 flag on Reports and the Dashboard surfaces it instead of capping the figure. A split rule counting same-day additions on the day was tried in round 1 and reverted by owner decision after round 2 showed it inflated exposure on a day whose mortality was corrected and double-counted paired same-day transfers between flocks. Regression tests pin all four scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions