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 GQL update process fails on slots tables #1040

Merged
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
3 changes: 2 additions & 1 deletion pdr_backend/subgraph/subgraph_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from enforce_typing import enforce_types

from pdr_backend.subgraph.core_subgraph import query_subgraph
from pdr_backend.lake.slot import Slot
from pdr_backend.util.networkutil import get_subgraph_url
from pdr_backend.util.time_types import UnixTimeS

Expand Down Expand Up @@ -122,7 +123,7 @@ def get_slots(
# by passing the dict as keyword arguments
# convert roundSumStakesUp and roundSumStakes to float
new_slots = [
PredictSlot(
Slot(
**{
"ID": slot["id"],
"timestamp": slot["slot"],
Expand Down
8 changes: 4 additions & 4 deletions pdr_backend/subgraph/test/test_subgraph_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from enforce_typing import enforce_types

from pdr_backend.subgraph.subgraph_slot import (
PredictSlot,
fetch_slots,
get_predict_slots_query,
get_slots,
)
from pdr_backend.lake.slot import Slot
from pdr_backend.util.time_types import UnixTimeS


Expand All @@ -31,7 +31,7 @@ def test_get_predict_slots_query():
# Sample data for tests
SAMPLE_PREDICT_QUERY_RESULT_ITEM = {
"id": "0xAsset-12345",
"slot": "12345",
"slot": 12345,
"trueValues": [{"ID": "1", "trueValue": True}],
"roundSumStakesUp": 150.0,
"roundSumStakes": 100.0,
Expand Down Expand Up @@ -78,8 +78,8 @@ def test_get_slots(mock_query_subgraph):
assert mock_query_subgraph.call_count == 1
# Verify that the result contains the expected number of slots
assert len(result_slots) == 1000
# Verify that the slots contain instances of PredictSlot
assert isinstance(result_slots[0], PredictSlot)
# Verify that the slots contain instances of Slot
assert isinstance(result_slots[0], Slot)
# Verify the first slot's data matches the sample
assert result_slots[0].ID == "0xAsset-12345"

Expand Down
Loading