Repository navigation
customers page: count andel sales as Andelsbiodling, flag unpaid shar… - #35
Merged
Merged
Conversation
…es, sticky header Counts - Every sale in the "andel" category counts as one Andelsbiodling share on the Customers table, whether it was imported or created from a paid invoice. - A booking is only added on top when its share is not already one of those sales: its invoice produced a sale, or the customer has an andel sale for the same harvest year (older shares were imported as sales while the booking was entered separately). This fixes double counting, e.g. Sarah Lindström showing 9 instead of 7 and Shane Saunders 5 instead of 3. - Lammandel is still counted from its bookings. Customer card - "Shares by season" uses the same rule as the table, one entry per share (/api/customer/<id> -> `seasons`), instead of listing raw bookings. The `bookings` field still lists real bookings only, so the delete guard is unchanged. Unpaid shares - A share that exists only as a booking has not been paid (paying the invoice creates the sale), so it is flagged: the table's Andelsbiodling badge turns red with a "N not paid" tooltip, and the card shows "2026: Andelsbiodling - not paid" in red. Layout - The title, "New customer" button and table header stay fixed; only the rows scroll, and the table height follows the window. Tests cover the counting rules (including the Sarah case), the card, the red badge and the sticky header.
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.
…es, sticky header
Counts
Customer card
seasons), instead of listing raw bookings. Thebookingsfield still lists real bookings only, so the delete guard is unchanged.Unpaid shares
Layout
Tests cover the counting rules (including the Sarah case), the card, the red badge and the sticky header.