Skip to content

Count andel-category sales as Andelsbiodling on the customers page - #34

Merged
valyo merged 1 commit into
mainfrom
customer-counts
Oct 31, 2026
Merged

valyo merged 1 commit into
mainfrom
customer-counts

Conversation

@valyo

@valyo valyo commented Oct 31, 2026

Copy link
Copy Markdown
Owner

The Bookings and Sales columns were taken from the customer's bookings and from all linked sales, so a customer whose earlier shares were imported as sales (category "andel") showed one booking and a pile of sales instead of their Andelsbiodling history.

  • Bookings > Andelsbiodling now counts every sale in the "andel" category, imported or created from a paid invoice, plus any Andelsbiodling booking that has no sale yet. A booking whose invoice already produced a sale is counted once, through that sale.
  • Sales now counts only sales in other categories.
  • Lammandel is unchanged.
  • Counts are computed in a few grouped queries (_activity_counts) instead of loading each customer's bookings and sales in the template.
  • Tests cover imported andel sales, paid and unpaid bookings, other categories, Lammandel, sales without a customer and the rendered table.

The Bookings and Sales columns were taken from the customer's bookings
and from all linked sales, so a customer whose earlier shares were
imported as sales (category "andel") showed one booking and a pile of
sales instead of their Andelsbiodling history.

- Bookings > Andelsbiodling now counts every sale in the "andel"
  category, imported or created from a paid invoice, plus any
  Andelsbiodling booking that has no sale yet. A booking whose invoice
  already produced a sale is counted once, through that sale.
- Sales now counts only sales in other categories.
- Lammandel is unchanged.
- Counts are computed in a few grouped queries (_activity_counts)
  instead of loading each customer's bookings and sales in the template.
- Tests cover imported andel sales, paid and unpaid bookings, other
  categories, Lammandel, sales without a customer and the rendered table.
@valyo
valyo merged commit baa0a62 into main Oct 31, 2026
3 checks passed
@valyo
valyo deleted the customer-counts branch October 31, 2026 09:20
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.

1 participant