CI demo: metrics + Gitea Actions

This commit is contained in:
2026-11-12 13:55:02 +08:00
commit 6637fb8ff4
17 changed files with 564 additions and 0 deletions

21
app/service.py Normal file
View File

@@ -0,0 +1,21 @@
"""Сервис заказов демо-проекта ci-demo (СТРПО, неделя 9, Gitea edition)."""
from dataclasses import dataclass
from .discounts import Discount
@dataclass
class Order:
items: dict[str, float]
@property
def total(self) -> float:
return sum(self.items.values())
class OrderService:
def __init__(self, discount: Discount) -> None:
self.discount = discount
def total(self, order: Order) -> float:
return round(self.discount.apply(order.total), 2)