feat(performance): 앞날 입력·계산식 칸·기간 합계 맨 위
- 매출 수동 입력·광고비 날짜 칸과 엑셀·광고 보고서 업로드에서 오늘 이후 날짜 허용 - 이번달 등 일자별 표의 기간 합계 행을 제목 행 바로 아래로 - 날짜 칸에 = 없이 1000+2000 계산식 입력(formula.parse_amount), 식은 마이그레이션 008 formula 열에 저장해 파랑 굵은 숫자·다시 누르면 식 - 광고비 탭 직접 입력값은 굵게 해제(굵게는 계산식만) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -187,7 +187,8 @@ def test_main_table_month_and_year():
|
||||
cells = _cells_for(list(calc.daterange(p.start, p.end)), ["a"])
|
||||
rows = calc.main_table(p, ["a"], cells, today=date(2026, 9, 30))
|
||||
weeks = [r for r in rows if r["kind"] == "week"]
|
||||
assert rows[-1]["kind"] == "total" and rows[-1]["total"]["gross"] == 300_000
|
||||
assert rows[0]["kind"] == "total" and rows[0]["total"]["gross"] == 300_000 # 기간 합계 = 맨 위(2026-10-21)
|
||||
assert rows[1]["kind"] == "day" and rows[-1]["kind"] == "week"
|
||||
assert sum(w["total"]["gross"] for w in weeks) == 300_000
|
||||
assert weeks[0]["from"] == "2026-09-01" and weeks[0]["to"] == "2026-09-06" # 첫 주는 월 시작부터
|
||||
y = calc.resolve_period("year", date(2026, 9, 10))
|
||||
@@ -2095,7 +2096,7 @@ def test_manual_input_marketplaces_skip_sync_even_with_api():
|
||||
|
||||
|
||||
def test_manual_sale_api_rules():
|
||||
"""수동 입력 API — 그 쇼핑몰 수동 입력이 켜져 있을 때만, 오늘까지, 숫자(쉼표 허용), 비우면 지움, 002 미적용이면 503.
|
||||
"""수동 입력 API — 그 쇼핑몰 수동 입력이 켜져 있을 때만, 앞날도 됨, 숫자(쉼표 허용)·계산식, 비우면 지움, 002 미적용이면 503.
|
||||
켜고 끄기(PUT marketplaces)는 관리자 전용 그대로, manual_input 도 받는다."""
|
||||
from fastapi import HTTPException
|
||||
|
||||
@@ -2113,10 +2114,11 @@ def test_manual_sale_api_rules():
|
||||
def list_marketplaces(self):
|
||||
return [{"code": "coupang", "manual_input": True}, {"code": "naver", "manual_input": False}]
|
||||
|
||||
def set_manual_sale(self, code, day, amount, *, user=""):
|
||||
def set_manual_sale(self, code, day, amount, *, user="", formula=None):
|
||||
if self.missing:
|
||||
raise ManualMigrationNeeded()
|
||||
self.saved.append((code, day, amount, user))
|
||||
self.formula = formula
|
||||
|
||||
def api_amount(self, code, day):
|
||||
return 50000
|
||||
@@ -2150,7 +2152,11 @@ def test_manual_sale_api_rules():
|
||||
assert body["manual"] == 87000 and body["amount"] == 87000 and body["api_amount"] == 50000
|
||||
body = __import__("json").loads(router.api_manual_sale(None, "coupang", "2026-10-11", {"amount": ""}).body)
|
||||
assert st.saved[-1][2] is None and body["manual"] is None and body["amount"] == 50000 # 지움 → API 값
|
||||
assert status_of(lambda: router.api_manual_sale(None, "coupang", "2026-10-13", {"amount": 1}))[0] == 400 # 앞날
|
||||
assert status_of(lambda: router.api_manual_sale(None, "coupang", "2026-10-13", {"amount": 1}))[0] == 200 # 앞날도 됨
|
||||
assert st.formula is None
|
||||
body = __import__("json").loads(router.api_manual_sale(None, "coupang", "2026-10-12", {"amount": "1,000+2000*2"}).body)
|
||||
assert st.saved[-1][2] == 5000 and st.formula == "1000+2000*2" and body["formula"] == "1000+2000*2"
|
||||
assert status_of(lambda: router.api_manual_sale(None, "coupang", "2026-10-12", {"amount": "1/0"}))[0] == 400
|
||||
code, msg = status_of(lambda: router.api_manual_sale(None, "naver", "2026-10-12", {"amount": 1}))
|
||||
assert code == 400 and "수동 입력" in msg # 꺼진 쇼핑몰
|
||||
assert status_of(lambda: router.api_manual_sale(None, "coupang", "2026-10-12", {"amount": "abc"}))[0] == 400
|
||||
|
||||
Reference in New Issue
Block a user