Skip to content

Back cdr : Endpoint to get total of validated payments - #1028

Open
Bombefire wants to merge 14 commits into
mainfrom
total-purchase
Open

Back cdr : Endpoint to get total of validated payments#1028
Bombefire wants to merge 14 commits into
mainfrom
total-purchase

Conversation

@Bombefire

Copy link
Copy Markdown
Contributor

Description

Summary

Adding the endpoint for Enceladus to have the total payment done in the CDR and have the total of purchase that have been validated by the sellers.

...

Issues/PR dependencies

A futur PR in Enceladus will come to make use of this endepoint

Issues to be resolved

Required PRs

Changes Made

  • ...
  • ...

Additional Notes

Classification

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🔨 Refactor (non-breaking change that neither fixes a bug nor adds a feature)
  • 🔧 Infra CI/CD (changes to configs of workflows)
  • 💥 BREAKING CHANGE (fix or feature that require a new minimal version of the front-end)
  • 😶‍🌫️ No impact for the end-users

Impact & Scope

  • Core functionality changes
  • Single module changes
  • Multiple modules changes
  • Database migrations required
  • Other: ...

Testing

  • 1. Tested this locally
  • 2. Added/modified tests that pass the CI (or tested in a downstream fork)
  • 3. Tested in a deployed pre-prod
  • 0. Untestable (exceptionally), will be tested in prod directly

Documentation

  • Updated the docs accordingly :
  • " Docstrings
  • # Inline comments
  • No documentation needed

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.38095% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.36%. Comparing base (e9b5f53) to head (b62c558).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
app/modules/cdr/cruds_cdr.py 36.36% 7 Missing ⚠️
app/modules/cdr/endpoints_cdr.py 66.66% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1028       +/-   ##
===========================================
- Coverage   84.99%   51.36%   -33.63%     
===========================================
  Files         220      220               
  Lines       16273    16291       +18     
===========================================
- Hits        13831     8368     -5463     
- Misses       2442     7923     +5481     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread app/modules/cdr/cruds_cdr.py
Comment thread app/modules/cdr/cruds_cdr.py Outdated
Comment thread app/modules/cdr/cruds_cdr.py Outdated
Comment thread app/modules/cdr/cruds_cdr.py Outdated
Comment thread app/modules/cdr/cruds_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated
)
total = result.scalar()

return total // 100 if total is not None else 0

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.

In cents?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The total is stocked in cents in the db, if this is what you meant

Comment thread app/modules/cdr/endpoints_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated
Comment thread app/modules/cdr/endpoints_cdr.py Outdated

@armanddidierjean armanddidierjean 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.

Please add tests

async def get_payment_total_by_type(
db: AsyncSession,
cdr_year: int,
) -> list[schemas_cdr.PaymentBase]:

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.

A dedicated schema would be great

Bombefire and others added 3 commits August 28, 2026 03:17
Co-authored-by: Armand Didierjean <95971503+armanddidierjean@users.noreply.github.com>
Co-authored-by: Armand Didierjean <95971503+armanddidierjean@users.noreply.github.com>
Co-authored-by: Armand Didierjean <95971503+armanddidierjean@users.noreply.github.com>
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.

3 participants