fix: a cart item takes up to 200 files (Sentry DTF-WEB-1, Dropstar's 66-sheet test)
One item was capped at 20 files, so a real 66-sheet ready-sheet cart was refused with the generic 'Confira os dados'. The cap is now 200 files per item; above it the Site and the server say 'Este item tem mais de 200 arquivos. Divida em dois itens.' Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -129,7 +129,7 @@ class ProductionSource(StrictModel):
|
||||
measurement: Literal['file', 'customer']
|
||||
|
||||
class ProductionPlacement(StrictModel):
|
||||
source_index: int = Field(ge=0, le=19, strict=True)
|
||||
source_index: int = Field(ge=0, le=199, strict=True)
|
||||
copy_index: int = Field(ge=0, le=199, strict=True)
|
||||
x_cm: Decimal = Field(ge=0, le=57)
|
||||
y_cm: Decimal = Field(ge=0, le=1200000)
|
||||
@@ -148,7 +148,7 @@ class ProductionSpec(StrictModel):
|
||||
version: Literal[2, 3]
|
||||
film_width_cm: Decimal
|
||||
height_cm: Decimal = Field(gt=0, le=1200000)
|
||||
sources: list[ProductionSource] = Field(min_length=1, max_length=20)
|
||||
sources: list[ProductionSource] = Field(min_length=1, max_length=200)
|
||||
placements: list[ProductionPlacement] = Field(min_length=1, max_length=4000)
|
||||
|
||||
class Split(StrictModel):
|
||||
@@ -177,7 +177,7 @@ class Item(StrictModel):
|
||||
mode: Literal['file','avulsa','uvfile','uv','premium']
|
||||
metres: Decimal = Field(gt=0, le=12000)
|
||||
grade: int = Field(ge=0, le=100, strict=True)
|
||||
uploads: list[UUID] = Field(min_length=1, max_length=20)
|
||||
uploads: list[UUID] = Field(min_length=1, max_length=200)
|
||||
production: ProductionSpec
|
||||
quality_status: Literal['ok', 'warning', 'unverified']
|
||||
quality_acknowledged: bool
|
||||
@@ -199,6 +199,15 @@ class Item(StrictModel):
|
||||
source_dpi: int | None = Field(default=None, ge=0, le=1000000)
|
||||
split: Split | None = None
|
||||
|
||||
@field_validator('uploads', mode='before')
|
||||
@classmethod
|
||||
def uploads_cap(cls, value):
|
||||
# The Site shows a "Value error, ..." message as it is (web/checkout.js
|
||||
# problem()); the Field cap alone would give the generic sentence.
|
||||
if isinstance(value, list) and len(value) > 200:
|
||||
raise ValueError('Este item tem mais de 200 arquivos. Divida em dois itens.')
|
||||
return value
|
||||
|
||||
@model_validator(mode='after')
|
||||
def production_matches_uploads(self):
|
||||
if self.split and (self.mode not in ('avulsa', 'uv') or self.split.part > self.split.of):
|
||||
|
||||
Reference in New Issue
Block a user