Skip to content
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

Fix: cost_view #472

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def upgrade() -> None:
JOIN files f ON file_pins.file_hash::text = f.hash::text
WHERE file_pins.owner IS NOT NULL
GROUP BY file_pins.owner) storage ON vm_prices.owner::text = storage.owner::text,
LATERAL ( SELECT 3::numeric * storage.storage_size / 1048576::numeric AS total_storage_cost) sc,
LATERAL ( SELECT storage.storage_size / (3 * 1024 * 1024) AS total_storage_cost) sc,
LATERAL ( SELECT COALESCE(vm_prices.total_vm_cost, 0::double precision) +
COALESCE(sc.total_storage_cost, 0::numeric)::double precision AS total_cost) tc
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ async def test_get_balance(
assert response.status == 200, await response.text()
data = await response.json()
assert data["balance"] == user_balance.balance
assert data["locked_amount"] == 2726
assert data["locked_amount"] == 2720.6666666666665
2 changes: 1 addition & 1 deletion tests/db/test_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ def test_get_total_cost_for_address(
total_cost: Decimal = get_total_cost_for_address(
session=session, address=fixture_instance_message.sender
)
assert total_cost == Decimal(6)
assert total_cost == Decimal(0.66666666666666662965923251249478198587894439697265625)
Loading