Skip to content

Daily entry: require grading to reconcile sellable eggs before submit #394

Description

@mforce

Problem

A Daily Entry can be submitted when its grade lines total less than its sellable eggs, including no grade lines at all. For example, a 200-egg entry with no losses and no grading can be submitted successfully.

Impact

Submission freezes the entry and creates egg lots only from grade lines. An ungraded 200-egg submission therefore creates zero stock, leaving recorded production that cannot be sold or reconciled through the intended Phase 1 grades-at-collection flow.

Agreed behaviour

  • Draft Daily Entries may be incomplete or ungraded.
  • Save & submit requires grades to equal sellable eggs: totalEggs - crackedEggs - dirtyEggs - discardedEggs.
  • Zero sellable eggs validly reconcile to zero grade lines.
  • Adjustments have no draft state, so saving an adjustment requires the same exact reconciliation.
  • UI and domain/API must enforce the invariant.

Adjust screen

Reshape the adjustment dialog to mirror Daily Entry: adjacent Egg counts and Grading panes, sellable calculation, remaining/day-adds-up status, and the same numeric controls. Retain the prior-adjustment context and required reason.

Acceptance criteria

  • The Daily Entry submit control is disabled until grading exactly reconciles.
  • Direct API callers cannot submit an ungraded or partially graded non-zero-sellable entry.
  • Adjustment save is disabled until grading exactly reconciles, and direct API callers cannot bypass it.
  • The adjustment dialog uses Daily Entry’s counts/grading visual hierarchy and feedback.
  • Regression tests cover no grades, partial grades, exact reconciliation, and a zero-sellable day.
  • Update the Help page and specs/product/GLOSSARY.md in the same change, per AGENTS.md docs-sync rule.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions