Skip to content

Commit 66c8d34

Browse files
committed
fix(app): allow fractional charging wattage on smartphones
Pydantic rejects records like Apple iPhone XS Max (7.5 W wireless) and LG G2 (4.5 W wireless) because the schema/model declared `charging_wired_w` and `charging_wireless_w` as `int`. Industry specs routinely use fractional watts (5 / 7.5 / 10 / 15 W Qi, 4.5 W early LG), so widen both fields to `float | None`. Fixes the `int_from_float` failure that took down test, deploy-pages, and refresh-data on f510014. Refs #1
1 parent f510014 commit 66c8d34

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

app/models/smartphone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class Smartphone(SQLModel, table=True):
3939

4040
# Battery
4141
battery_mah: int
42-
charging_wired_w: int | None = None
43-
charging_wireless_w: int | None = None
42+
charging_wired_w: float | None = None
43+
charging_wireless_w: float | None = None
4444

4545
# Physical
4646
weight_g: float

app/schemas/smartphone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class SmartphoneRead(BaseModel):
3838
display: dict[str, Any]
3939
cameras: list[dict[str, Any]]
4040
battery_mah: int
41-
charging_wired_w: int | None = None
42-
charging_wireless_w: int | None = None
41+
charging_wired_w: float | None = None
42+
charging_wireless_w: float | None = None
4343
weight_g: float
4444
dimensions: dict[str, Any]
4545
ip_rating: str | None = None

0 commit comments

Comments
 (0)