Skip to content

Commit 816ca8b

Browse files
committed
update code to match new django version
1 parent 00354dc commit 816ca8b

9 files changed

Lines changed: 113 additions & 79 deletions

File tree

intbot/core/analysis/products.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,15 @@ def flat_product_data(products: list[Product]) -> pl.DataFrame:
106106
)
107107
)
108108

109-
return pl.DataFrame(rows)
109+
schema = {
110+
"product_id": pl.Int64,
111+
"variation_id": pl.Int64,
112+
"product_name": pl.String,
113+
"type": pl.String,
114+
"variant": pl.String,
115+
"price": pl.Decimal(precision=10, scale=2),
116+
}
117+
return pl.DataFrame(rows, schema=schema)
110118

111119

112120
def latest_flat_product_data() -> pl.DataFrame:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from core.integrations.pretix.api import (
2+
PRETIX_EVENTS,
3+
download_latest_orders,
4+
download_latest_products,
5+
download_latest_vouchers,
6+
fetch_pretix_data,
7+
get_event_url,
8+
)
9+
10+
__all__ = [
11+
"PRETIX_EVENTS",
12+
"download_latest_orders",
13+
"download_latest_products",
14+
"download_latest_vouchers",
15+
"fetch_pretix_data",
16+
"get_event_url",
17+
]

intbot/core/integrations/pretix/fetch.py

Whitespace-only changes.

intbot/core/integrations/pretix/models.py

Whitespace-only changes.

intbot/tests/test_analysis/test_products.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_flat_product_data():
4747
"product_name": pl.String,
4848
"type": pl.String,
4949
"variant": pl.String,
50-
"price": pl.Decimal(precision=None, scale=0),
50+
"price": pl.Decimal(precision=10, scale=2),
5151
}
5252
)
5353

@@ -185,6 +185,14 @@ def test_latest_flat_product_data():
185185
},
186186
],
187187
)
188+
expected_schema = {
189+
"product_id": pl.Int64,
190+
"variation_id": pl.Int64,
191+
"product_name": pl.String,
192+
"type": pl.String,
193+
"variant": pl.String,
194+
"price": pl.Decimal(precision=10, scale=2),
195+
}
188196
expected = pl.DataFrame(
189197
[
190198
FlatProductDescription(
@@ -267,7 +275,8 @@ def test_latest_flat_product_data():
267275
type="Late",
268276
price=Decimal("675.00"),
269277
),
270-
]
278+
],
279+
schema=expected_schema,
271280
)
272281

273282
df = latest_flat_product_data()

intbot/tests/test_tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
process_zammad_webhook,
1313
)
1414
from django.utils import timezone
15-
from django_tasks.task import ResultStatus
15+
from django_tasks import TaskResultStatus
1616
from httpx import Response
1717

1818

@@ -56,8 +56,8 @@ def test_process_webhook_fails_if_unsupported_source():
5656
# Instead we have to check the result
5757
result = process_webhook.enqueue(str(wh.uuid))
5858

59-
assert result.status == ResultStatus.FAILED
60-
assert result.traceback.endswith("ValueError: Unsupported source asdf\n")
59+
assert result.status == TaskResultStatus.FAILED
60+
assert any("Unsupported source asdf" in str(e) for e in result.errors)
6161

6262

6363
@pytest.mark.django_db

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
requires-python = ">=3.12,<3.13"
77
dependencies = [
88
"discord-py>=2.4.0",
9-
"django>=5.1.4",
9+
"django>=6.0",
1010
"django-tasks>=0.6.1",
1111
"psycopg>=3.2.3",
1212
"ruff>=0.8.6",

uv.lock

Lines changed: 72 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)