Skip to content

Feature/30 donation value calculation - #89

Merged
anis022 merged 4 commits into
developfrom
feature/30-donation-value-calculation
Nov 21, 2026
Merged

anis022 merged 4 commits into
developfrom
feature/30-donation-value-calculation

Conversation

@maayjayy

Copy link
Copy Markdown
Collaborator

Closes #30

Overview

  • Goal: calculate a donation line's value = quantity × price × quality percentage, using the price in effect on the donation date
  • 2 pieces:
  • Rounding: follows the existing rule in docs/database/receipts.md (each line to the cent, half away from zero, total = sum of rounded lines)
  • Quality class: uses the donation's class, not the catalog's (as catalog.md says)
  • Never guessed: clear error if no catalog item, no price on the date, different units (kg = KG accepted), or a percentage outside the class range
  • Result: the full detail (quantity, unit, price, price date, class, %, value), for the "détail du calcul" and for receipts
  • Docs: new "Code" section in docs/database/receipts.md

Testing

  • Docker must be running. All 437 tests pass (dotnet test)
  • DonationValueTests (no Docker): receipts.md examples ($37.50, $7.47, total $44.97), half rounded up ($0.225 → $0.23), class C = $0, invalid values refused, class ranges
  • DonationValueServiceTests (Docker): price on the donation date (Nov 15 → $4.00, Dec 1 → $4.25), default and chosen %, units, refusals
  • Each expected value has its calculation by hand in a comment (useful for [Issue]: Verify the finance calculations by hand #33)

Screenshots / Screencasts

No UI change.

Checklist

  • Code is neat, readable, and works
  • Code is commented where appropriate and well-documented
  • Commit messages follow our guidelines
  • Issue number is linked
  • Branch is linked
  • Reviewers are assigned (one of your tech leads)

Notes

@maayjayy maayjayy added this to the Sprint - 2 milestone Nov 19, 2026
@maayjayy maayjayy self-assigned this Nov 19, 2026

@anis022 anis022 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@anis022
anis022 removed the request for review from lauriechammah November 21, 2026 20:30
@anis022
anis022 merged commit 816d6e7 into develop Nov 21, 2026
4 checks passed
@anis022
anis022 deleted the feature/30-donation-value-calculation branch November 21, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants