feat(실적): 틱톡 탭 삭제 + [말레이시아 실적] 모듈 추가

- 실적 틱톡 탭·tiktok_ads 광고 API·테스트 삭제, 틱톡 데이터 삭제 SQL(performance_db 012)
- 말레이시아 실적: 실적 라우터·화면을 /malaysia/performance 에 한 번 더 마운트,
  차이는 performance/variant.py(KR·MY) 한 곳 — 저장소·권한키·주소·광고 채널·통화
- 틱톡·쇼피·라자다 그룹(쇼핑몰 + 라이브커머스 하위, 그룹 열 = 합계), 광고비 채널 3개
- 금액 RM 소수 2자리 = 센 정수 저장(입력·엑셀 scale, 화면 num/money, JS money)
- malaysia_performance_db = performance_db 구조 복사 + seed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 16:03:18 +09:00
parent e9f57b6ff6
commit 62cc5e2778
34 changed files with 790 additions and 892 deletions
+6 -6
View File
@@ -77,8 +77,8 @@ def parse_date(value: Any) -> date | None:
return date(int(m.group(1)), int(m.group(2)), int(m.group(3)))
def parse_amount(value: Any) -> int | None:
"""금액 칸 → 원 단위 정수. 빈 칸이면 None, 숫자가 아니면 ValueError."""
def parse_amount(value: Any, scale: int = 1) -> int | None:
"""금액 칸 → 저장 단위 정수(원, scale=100 이면 센 — 말레이시아 실적 RM 소수 2자리). 빈 칸이면 None, 숫자가 아니면 ValueError."""
if value is None or isinstance(value, bool):
if value is None:
return None
@@ -86,7 +86,7 @@ def parse_amount(value: Any) -> int | None:
if isinstance(value, (int, float, Decimal)):
num = Decimal(str(value))
else:
text = re.sub(r"[,\s원₩]", "", str(value))
text = re.sub(r"[,\s원₩]|RM", "", str(value), flags=re.IGNORECASE)
if text == "":
return None
try:
@@ -95,7 +95,7 @@ def parse_amount(value: Any) -> int | None:
raise ValueError from None
if not num.is_finite():
raise ValueError
return int(num.quantize(Decimal("1"), rounding=ROUND_HALF_UP))
return int((num * scale).quantize(Decimal("1"), rounding=ROUND_HALF_UP))
def header_aliases(markets: Iterable[Mapping[str, Any]], extra_names: Mapping[str, Iterable[str]] | None = None) -> dict[str, str]:
@@ -111,7 +111,7 @@ def header_aliases(markets: Iterable[Mapping[str, Any]], extra_names: Mapping[st
def parse_workbook(content: bytes, *, markets: list[Mapping[str, Any]], today: date,
extra_names: Mapping[str, Iterable[str]] | None = None) -> ParseResult:
extra_names: Mapping[str, Iterable[str]] | None = None, scale: int = 1) -> ParseResult:
"""첫 시트를 읽어 (코드, 날짜, 금액) 목록을 만든다. markets: code·name·manual_input(설정 순서)."""
if not content:
raise UploadError("빈 파일입니다.")
@@ -160,7 +160,7 @@ def parse_workbook(content: bytes, *, markets: list[Mapping[str, Any]], today: d
amounts: dict[int, int] = {}
for i, raw in cells.items():
try:
amt = parse_amount(raw)
amt = parse_amount(raw, scale)
except ValueError:
res.errors.append(f"{_cell_ref(r, i + 1)}: 금액이 숫자가 아닙니다({raw}).")
continue