Skip to content

Fix: Store price calculations on small file #706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

1yam
Copy link
Member

@1yam 1yam commented Feb 18, 2025

For store message we used a SizedVolume who have size_mib: int.
for file of example 14 bytes when it will be converted to mib it's will be really small number and it's will be be round at 0

Self proofreading checklist

  • Is my code clear enough and well documented
  • Are my files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • Database migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Changes

This pull request focuses on improving the precision of volume size calculations by changing the type of size_mib from int to Decimal across various functions and classes in the aleph codebase. Additionally, it includes related updates to tests to ensure the new type is handled correctly.

Changes to improve precision:

  • src/aleph/services/cost.py: Updated multiple functions (_get_volumes_costs, _get_execution_volumes_costs, _calculate_storage_costs) to convert volume sizes to Decimal for more accurate calculations. [1] [2] [3] [4] [5]

Type change in class definition:

Updates to tests:

@1yam 1yam requested review from amalcaraz and nesitor February 18, 2025 14:35
Copy link
Collaborator

@Psycojoker Psycojoker left a comment

Choose a reason for hiding this comment

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

LGTM

@hoh hoh merged commit dc8a47e into main Mar 4, 2025
4 checks passed
@Psycojoker Psycojoker deleted the fix-storage-price-calculation branch March 4, 2025 15:42
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