Skip to content

Commit 8a6ec0e

Browse files
committed
allocate fn, domain service [domain_service]
1 parent d1dda70 commit 8a6ec0e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
from __future__ import annotations
22
from dataclasses import dataclass
33
from datetime import date
4-
from typing import Optional, Set
4+
from typing import Optional, List, Set
5+
6+
7+
def allocate(line: OrderLine, batches: List[Batch]) -> str:
8+
batch = next(b for b in sorted(batches) if b.can_allocate(line))
9+
batch.allocate(line)
10+
return batch.reference
511

612

713
@dataclass(frozen=True)

0 commit comments

Comments
 (0)