[feat] negodata: 낙찰 방식 구분(자동/직접) + 계약가·사유 저장 위치 재정리
직접 낙찰(담당자 오프라인 계약가)을 AI 자동 낙찰과 통계·화면에서 구분하기 위해
낙찰 방식을 전용 컬럼으로 박고, 계약가·사유를 성격대로 배치했다. 처음엔 계약가·사유를
sessions.custom.offline_award(JSONB) 한 뭉치에 넣었으나 성격이 갈려 정리한다.
DB (postgres-init: init.sql 정본 + alters/2026-08-11-award-type.sql 보정, 멱등)
- quotations.award_type SMALLINT — 낙찰 방식(1=자동/2=직접). 통계 조회·집계 축이라 컬럼
- quotations.custom JSONB — 직접 낙찰 사유·처리자·시각(award={reason,by,at}). 표시·감사용
- sessions.contract_price BIGINT — 직접 낙찰 계약가. bid_price/reject_price 와 같은 협력사
가격 축이라 세션에. 자동 낙찰은 NULL(투찰가가 곧 계약가)
- 기존 offline_award(JSONB) 데이터를 컬럼·견적 custom 으로 이관 후 키 제거
backend
- 자동 낙찰(close_and_decide)=AUTO, 직접 낙찰(claim_for_award)=MANUAL 로 award_type 기록
- 직접 낙찰: 계약가→세션 contract_price, 사유·처리자·시각→견적 custom.award (한 트랜잭션)
- 통계 계약가 = coalesce(contract_price, bid_price) — JSONB 캐스팅 제거(컬럼끼리, 인덱스·타입 안전)
- QuotationData 에 award_type·custom, SessionData 에 contract_price 노출
- 안 쓰게 된 merge_session_custom 제거
front
- 견적 상세 결과 밴드에 '직접 낙찰' 배지 + 낙찰 사유 표시(견적 custom.award.reason).
거부·미참여 낙찰은 이미 직접 낙찰을 함의하므로 '— 낙찰' 꼬리를 떼 중복 표기 제거
- 목록 결과 배지에 '낙찰(직접)' 표기 — AI 자동낙찰과 한눈에 구분
- offlineAward()→directAwardPrice()/awardMeta() 로 교체(세션 컬럼·견적 custom 에서 읽음)
- 협상현황 표: 부가정보(회사 필드)와 의견(custom.opinion)을 별도 컬럼으로 분리
- 미응찰 건 레일 4번 칸 라벨 '최저 투찰가'→'결과'(투찰 없을 때)
테스트: negodata 110건 통과. 프론트 tsc+eslint 통과. dev DB 적용·화면 확인.
This commit is contained in:
1 parent
6eb4dc26f8
commit
0e4ddf0f43
22 files changed
+292
-63
No files matched your search
@@ -309,12 +309,14 @@ class quotations(MainTableMixin, MAIN_BASE):
|
||||
equal_bid_yn = Column(Boolean, nullable=True)
|
||||
equal_bid_data = Column(JSONB, nullable=True)
|
||||
close_reason = Column(SmallInteger, nullable=True) # CloseReason 코드. 마감 시 사유 기록(재생성 한도 카운팅·유찰 사유 구분). 미마감이면 NULL
|
||||
award_type = Column(SmallInteger, nullable=True) # AwardType 코드(1=자동/2=직접). 낙찰 방식 — 통계에서 AI 자동낙찰과 담당자 직접낙찰 구분. 미낙찰이면 NULL
|
||||
|
||||
# 낙찰 기준(가격게이트) — 견적 단위. 마감 판정(close_and_decide)이 이 행값을 읽는다. 기준 미달이면 개찰(낙찰자 미정 마감).
|
||||
# 1:1 협상: over 는 항상 OPEN(목표 초과=개찰), mid 만 앵커/목표 택1. 1:N 경매: mid=over=AWARD 강제(무조건 최저가 낙찰).
|
||||
mid_action = Column(SmallInteger, nullable=False, server_default=text("1"), default=1) # PriceGateAction: 앵커링가<투찰가≤목표가 처리(1=낙찰/2=개찰)
|
||||
over_action = Column(SmallInteger, nullable=False, server_default=text("1"), default=1) # PriceGateAction: 목표가<투찰가 처리(1=낙찰/2=개찰)
|
||||
done_ceiling_rate = Column(SmallInteger, nullable=True) # 협상 완료 상한율(‰) 견적별 override. NULL 이면 quotation_settings 값
|
||||
custom = Column(JSONB, nullable=True) # 견적 단위 부가정보. 직접 낙찰 시 award={reason,by,at}(사유·처리자·시각). 표시·감사용(집계 안 함)
|
||||
|
||||
|
||||
class sessions(MainTableMixin, MAIN_BASE):
|
||||
@@ -340,6 +342,7 @@ class sessions(MainTableMixin, MAIN_BASE):
|
||||
reject_reason = Column(String(255), nullable=True)
|
||||
reject_price = Column(BigInteger, nullable=True)
|
||||
reject_delivery_type = Column(SmallInteger, nullable=True) # DeliveryType 코드
|
||||
contract_price = Column(BigInteger, nullable=True) # 직접 낙찰 계약가(원). 자동낙찰은 NULL(bid_price 가 계약가). 통계는 coalesce(contract_price, bid_price)
|
||||
email_sent_at = Column(DateTime(timezone=True), nullable=True) # 협상 초청 메일 발송 시각(NULL=미발송)
|
||||
custom = Column(JSONB, nullable=True) # 협상완료 부가정보 값 {key: value} (정의는 companies.settings.session_fields)
|
||||
|
||||
|
||||
@@ -213,6 +213,15 @@ class CloseReason(CodeEnum):
|
||||
OPEN_REJECT = 8 # 개찰: 협상거부 존재
|
||||
|
||||
|
||||
class AwardType(CodeEnum):
|
||||
"""quotations.award_type 코드값(SMALLINT). 낙찰이 어떻게 확정됐는지 — 통계에서 AI 협상 성과와
|
||||
담당자 오프라인 낙찰을 나눈다. 미마감·미낙찰(개찰)이면 NULL.
|
||||
AUTO=시스템이 투찰가로 자동 낙찰 / MANUAL=담당자가 개찰 건을 오프라인 협상해 계약가로 직접 낙찰."""
|
||||
|
||||
AUTO = 1 # 자동 낙찰(close_and_decide, 투찰가 기준)
|
||||
MANUAL = 2 # 직접 낙찰(담당자 계약가 입력 — sessions.custom.offline_award 와 짝)
|
||||
|
||||
|
||||
class PriceGateAction(CodeEnum):
|
||||
"""낙찰 기준(견적 단위) 가격게이트 판정값. '앵커링가<투찰가≤목표가'(mid) / '목표가<투찰가'(over) 구간에 적용.
|
||||
(투찰가≤앵커링가 는 항상 낙찰.) 기준 미달이면 개찰(낙찰자 미정 마감) — 재협상·결렬 없음.
|
||||
|
||||
@@ -11,7 +11,7 @@ from common.database.model.models import (
|
||||
quotations, sessions, chats, nego_cards, wild_cards, items, suppliers, quotation_settings,
|
||||
version_nego_cards, version_wild_cards, users, supplier_items, companies,
|
||||
)
|
||||
from common.enums import CloseReason, ErrorType, QuotationStatus, SessionStatus
|
||||
from common.enums import AwardType, CloseReason, ErrorType, QuotationStatus, SessionStatus
|
||||
from common.logger import LOG
|
||||
from common.utils.gtime import GTime
|
||||
|
||||
@@ -81,7 +81,11 @@ class IQuotationCRUD(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def merge_session_custom(self, cdb: AsyncSession, session_id, patch: dict) -> ErrorType:
|
||||
async def merge_quotation_custom(self, cdb: AsyncSession, qt_id, patch: dict) -> ErrorType:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def set_contract_price(self, cdb: AsyncSession, session_id, price: int) -> ErrorType:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
@@ -547,6 +551,7 @@ class QuotationCRUD(IQuotationCRUD):
|
||||
)
|
||||
.values(
|
||||
close_reason=CloseReason.AWARDED.value,
|
||||
award_type=AwardType.MANUAL.value, # 담당자 직접 낙찰(오프라인 계약가)
|
||||
preferred_sp_yn=True,
|
||||
preferred_sp_id=supplier_id,
|
||||
preferred_sp_name=supplier_name,
|
||||
@@ -576,16 +581,29 @@ class QuotationCRUD(IQuotationCRUD):
|
||||
LOG.e_no_callstack(ex)
|
||||
return ErrorType.DB_RUN_FAILED
|
||||
|
||||
async def merge_session_custom(self, cdb: AsyncSession, session_id, patch: dict) -> ErrorType:
|
||||
# sessions.custom 부분 갱신(기존 키 보존). 부가정보·의견·재협상 요청이 같은 컬럼을 쓰므로 덮어쓰면 안 된다.
|
||||
async def merge_quotation_custom(self, cdb: AsyncSession, qt_id, patch: dict) -> ErrorType:
|
||||
# quotations.custom 부분 갱신(기존 키 보존). 직접 낙찰 사유(award) 등 견적 부가정보가 같은 컬럼을 쓴다.
|
||||
try:
|
||||
query = (
|
||||
update(quotations)
|
||||
.where(quotations.qt_id == qt_id)
|
||||
.values(
|
||||
custom=func.coalesce(quotations.custom, cast(text("'{}'"), JSONB)).op("||")(cast(patch, JSONB)),
|
||||
updated_at=GTime.UTC(),
|
||||
)
|
||||
)
|
||||
return await DB_SESSION_MNG.add(cdb, query)
|
||||
except Exception as ex:
|
||||
LOG.e_no_callstack(ex)
|
||||
return ErrorType.DB_RUN_FAILED
|
||||
|
||||
async def set_contract_price(self, cdb: AsyncSession, session_id, price: int) -> ErrorType:
|
||||
# 직접 낙찰 계약가를 낙찰 세션 컬럼에 박는다(자동낙찰 bid_price 와 같은 축).
|
||||
try:
|
||||
query = (
|
||||
update(sessions)
|
||||
.where(sessions.session_id == session_id)
|
||||
.values(
|
||||
custom=func.coalesce(sessions.custom, cast(text("'{}'"), JSONB)).op("||")(cast(patch, JSONB)),
|
||||
updated_at=GTime.UTC(),
|
||||
)
|
||||
.values(contract_price=price, updated_at=GTime.UTC())
|
||||
)
|
||||
return await DB_SESSION_MNG.add(cdb, query)
|
||||
except Exception as ex:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Tuple
|
||||
|
||||
from sqlalchemy import select, func, and_, or_, case, cast, BigInteger
|
||||
from sqlalchemy import select, func, and_, or_, case
|
||||
from sqlalchemy.orm import aliased
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import quotations, sessions, items, chats, users
|
||||
from common.enums import ErrorType, QuotationStatus, CloseReason, SessionStatus, CardType, ChatSender
|
||||
from common.enums import AwardType, ErrorType, QuotationStatus, CloseReason, SessionStatus, CardType, ChatSender
|
||||
from common.logger import LOG
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ class StatisticsCRUD(IStatisticsCRUD):
|
||||
# 결렬·미응찰 건을 오프라인으로 다시 협상하고 직접 낙찰하면 시스템 투찰가가 없거나 실제 계약가와
|
||||
# 다르기 때문. 컬럼 이름은 bid_price 로 유지해 statistics_service 는 그대로 쓴다.
|
||||
try:
|
||||
offline_price = cast(sessions.custom["offline_award"]["price"].astext, BigInteger)
|
||||
award_price = func.coalesce(offline_price, sessions.bid_price).label("bid_price")
|
||||
# 계약가 = 직접 낙찰 계약가(있으면) 우선, 없으면 투찰가. 둘 다 세션 컬럼이라 인덱스·타입 안전.
|
||||
award_price = func.coalesce(sessions.contract_price, sessions.bid_price).label("bid_price")
|
||||
stmt = (
|
||||
select(
|
||||
quotations.updated_at,
|
||||
@@ -90,7 +90,8 @@ class StatisticsCRUD(IStatisticsCRUD):
|
||||
sessions.target_price,
|
||||
award_price,
|
||||
sessions.anchoring_price,
|
||||
offline_price.isnot(None).label("is_offline"), # 오프라인 협상 반영 건수 표기용
|
||||
# 직접 낙찰 여부는 quotations.award_type(전용 컬럼) 기준. 옛 데이터(백필 전)만 offline_award 폴백.
|
||||
(func.coalesce(quotations.award_type, 0) == AwardType.MANUAL.value).label("is_offline"),
|
||||
)
|
||||
.select_from(quotations)
|
||||
.join(
|
||||
@@ -98,7 +99,7 @@ class StatisticsCRUD(IStatisticsCRUD):
|
||||
and_(
|
||||
sessions.quotation_id == quotations.qt_id,
|
||||
sessions.supplier_id == quotations.preferred_sp_id,
|
||||
or_(sessions.bid_price.isnot(None), offline_price.isnot(None)),
|
||||
or_(sessions.bid_price.isnot(None), sessions.contract_price.isnot(None)),
|
||||
sessions.deleted == False, # noqa: E712
|
||||
),
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any, Optional
|
||||
|
||||
from pydantic import ConfigDict
|
||||
|
||||
from common.enums import CardType, ChatSender, CloseReason, DeliveryType, PriceGateAction, QuotationStatus, QuotationType, SessionStatus
|
||||
from common.enums import AwardType, CardType, ChatSender, CloseReason, DeliveryType, PriceGateAction, QuotationStatus, QuotationType, SessionStatus
|
||||
from common.models.gmodel import Res_PageProtocol, Res_WebPacketProtocol, WebPacketProtocol
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ class QuotationData(WebPacketProtocol):
|
||||
equal_bid_yn: Optional[bool] = None
|
||||
equal_bid_data: Optional[Any] = None
|
||||
close_reason: Optional[CloseReason] = None # 마감 사유(CloseReason). 미마감이면 None
|
||||
award_type: Optional[AwardType] = None # 낙찰 방식(AwardType 1=자동/2=직접). 미낙찰이면 None
|
||||
custom: Optional[dict] = None # 견적 부가정보. 직접 낙찰 시 award={reason,by,at}(사유·처리자·시각)
|
||||
mid_action: Optional[int] = None # 낙찰 기준(견적 단위). 상세 드로어 낙찰기준 표시용
|
||||
over_action: Optional[int] = None
|
||||
done_ceiling_rate: Optional[int] = None # 타결 상한율(‰) 견적 override. None 이면 견적 세팅값을 따름
|
||||
@@ -120,6 +122,7 @@ class SessionData(WebPacketProtocol):
|
||||
reject_reason: Optional[str] = None
|
||||
reject_price: Optional[int] = None
|
||||
reject_delivery_type: Optional[DeliveryType] = None
|
||||
contract_price: Optional[int] = None # 직접 낙찰 계약가(원). 자동낙찰은 None(bid_price 가 계약가)
|
||||
email_sent_at: Optional[datetime] = None # 협상 초청 메일 발송 시각(None=미발송). 프론트 발송배지/재발송 판단
|
||||
custom: Optional[dict] = None # 협상완료 부가정보 값 {key: value} (공급사가 타결 후 입력, 정의는 companies.settings.session_fields)
|
||||
url: str = "" # 세션 chat 실행 URL(공급사 협상 프론트). DB 미저장 — session_id 로 구성
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Optional
|
||||
from common.authz import is_owner_or_admin
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import quotations, sessions
|
||||
from common.enums import CloseOutcome, CloseReason, DBWRType, ErrorType, NotificationType, PriceGateAction, QuotationStatus, SessionStatus
|
||||
from common.enums import AwardType, CloseOutcome, CloseReason, DBWRType, ErrorType, NotificationType, PriceGateAction, QuotationStatus, SessionStatus
|
||||
from common.logger import LOG
|
||||
from common.utils.gtime import GTime
|
||||
from router.v1.quotation.protocol import Res_Quotation
|
||||
@@ -116,6 +116,7 @@ class ClosingMixin:
|
||||
await self._close(qt_uuid, CloseReason.AWARDED.value, {
|
||||
"preferred_sp_yn": True, "preferred_sp_id": winner["supplier_id"],
|
||||
"preferred_sp_name": (winner["name"] or "")[:20], "equal_bid_yn": False,
|
||||
"award_type": AwardType.AUTO.value, # 시스템 자동 낙찰(투찰가 기준)
|
||||
})
|
||||
await create_notification(
|
||||
original.user_id, NotificationType.SUCCESS,
|
||||
@@ -225,21 +226,23 @@ class ClosingMixin:
|
||||
res.msg = "이미 낙찰 처리된 견적입니다."
|
||||
return res
|
||||
|
||||
# 계약가를 낙찰 세션에 남긴다 — 통계가 이 값을 계약가로 읽고(투찰가보다 우선), 누가 언제 어떤
|
||||
# 근거로 확정했는지 추적한다. custom 은 부가정보·의견과 같은 컬럼이라 병합(덮어쓰기 금지).
|
||||
offline_award = {
|
||||
"price": winner_price,
|
||||
"note": (contract_note or "").strip()[:255],
|
||||
# 계약가는 낙찰 세션의 contract_price 컬럼에(협력사 가격 — bid_price/reject_price 와 같은 축, 통계 집계 대상).
|
||||
# 사유·처리자·시각은 견적의 custom.award 에(견적 단위 결정 — 표시·감사용, 집계 안 함). 둘 다 한 트랜잭션.
|
||||
award_meta = {
|
||||
"reason": (contract_note or "").strip()[:255],
|
||||
"by": str(user_id) if user_id else "",
|
||||
"at": GTime.UTC().isoformat(timespec="seconds"),
|
||||
}
|
||||
award_err = await DB_SESSION_MNG.execute_lambda_run(
|
||||
[sessions.DBType()],
|
||||
[lambda s: self.quotation_crud.merge_session_custom(s, winner.session_id, {"offline_award": offline_award})],
|
||||
[
|
||||
lambda s: self.quotation_crud.set_contract_price(s, winner.session_id, winner_price),
|
||||
lambda s: self.quotation_crud.merge_quotation_custom(s, qt_uuid, {"award": award_meta}),
|
||||
],
|
||||
)
|
||||
if award_err != ErrorType.SUCCESS:
|
||||
# 낙찰(견적)은 이미 선점 전이됐다 — 계약가만 못 남긴 상태라 되돌리지 않고 경고로 남긴다.
|
||||
LOG.w(f"[award] 계약가 기록 실패 qt_id={qt_id} session_id={winner.session_id} price={winner_price}")
|
||||
# 낙찰(견적)은 이미 선점 전이됐다 — 계약가·사유만 못 남긴 상태라 되돌리지 않고 경고로 남긴다.
|
||||
LOG.w(f"[award] 계약가/사유 기록 실패 qt_id={qt_id} session_id={winner.session_id} price={winner_price}")
|
||||
|
||||
# 작성자 알림 — 자동낙찰과 같은 SUCCESS 코드, manual 플래그로 '직접 낙찰' 구분.
|
||||
await create_notification(
|
||||
|
||||
@@ -15,7 +15,7 @@ from datetime import datetime
|
||||
import pytest_asyncio
|
||||
from sqlalchemy import text
|
||||
|
||||
from common.enums import CloseReason, ErrorType, QuotationStatus, QuotationType, SessionStatus, UserRole
|
||||
from common.enums import AwardType, CloseReason, ErrorType, QuotationStatus, QuotationType, SessionStatus, UserRole
|
||||
from crud.quotation_crud import QuotationCRUD
|
||||
from services.quotation import QuotationService
|
||||
|
||||
@@ -44,6 +44,7 @@ async def test_award_opened_sets_winner_and_notifies(clean):
|
||||
assert res.result.success is True
|
||||
row = await _quotation(engine, qt)
|
||||
assert row.close_reason == CloseReason.AWARDED.value
|
||||
assert row.award_type == AwardType.MANUAL.value # 직접 낙찰 — 통계에서 자동낙찰과 구분
|
||||
assert row.preferred_sp_yn is True
|
||||
assert str(row.preferred_sp_id) == str(supplier_a)
|
||||
assert row.equal_bid_yn is False
|
||||
@@ -141,9 +142,9 @@ async def test_award_allows_owner_role(clean):
|
||||
assert len(await _notifications(engine, admin)) == 0
|
||||
|
||||
|
||||
async def test_award_records_contract_price_on_session(clean):
|
||||
async def test_award_records_contract_price_and_reason(clean):
|
||||
"""검증: 협력사 제출가(100)와 다른 계약가(88)로 직접 낙찰 — 오프라인 재협상 결과 반영.
|
||||
기대결과: 낙찰 세션 custom.offline_award 에 계약가·메모가 남고, 알림 winner_price 도 계약가."""
|
||||
기대결과: 계약가는 낙찰 세션 contract_price 컬럼에, 사유·처리자는 견적 custom.award 에 남고, 알림 winner_price 도 계약가."""
|
||||
engine = clean
|
||||
user_id, supplier_a = uuid.uuid4(), uuid.uuid4()
|
||||
qt = await _seed_opened(engine, user_id=user_id, number="A-OFFLINE", close_reason=CloseReason.OPEN_PRICE.value)
|
||||
@@ -155,13 +156,18 @@ async def test_award_records_contract_price_on_session(clean):
|
||||
|
||||
assert res.result.success is True
|
||||
async with engine.begin() as conn:
|
||||
row = (await conn.execute(
|
||||
text("SELECT custom FROM sessions WHERE quotation_id = :qt AND supplier_id = :sp"),
|
||||
# 계약가 = 세션 컬럼(협력사 가격 — bid_price/reject_price 와 같은 축)
|
||||
sess_price = (await conn.execute(
|
||||
text("SELECT contract_price FROM sessions WHERE quotation_id = :qt AND supplier_id = :sp"),
|
||||
{"qt": qt, "sp": supplier_a},
|
||||
)).first()
|
||||
award = row.custom["offline_award"]
|
||||
assert award["price"] == 88
|
||||
assert award["note"] == "오프라인 협상, 8/12 통화 합의"
|
||||
)).scalar()
|
||||
# 사유·처리자 = 견적 custom.award(견적 단위 결정)
|
||||
qt_custom = (await conn.execute(
|
||||
text("SELECT custom FROM quotations WHERE qt_id = :qt"), {"qt": qt},
|
||||
)).scalar()
|
||||
assert sess_price == 88
|
||||
award = qt_custom["award"]
|
||||
assert award["reason"] == "오프라인 협상, 8/12 통화 합의"
|
||||
assert award["by"] == str(user_id)
|
||||
notis = await _notifications(engine, user_id)
|
||||
assert notis[0][1]["winner_price"] == 88
|
||||
@@ -245,7 +251,7 @@ async def _quotation(engine, qt_id):
|
||||
"""견적 1행(마감 결과 컬럼 확인용)."""
|
||||
async with engine.begin() as conn:
|
||||
return (await conn.execute(
|
||||
text("SELECT close_reason, preferred_sp_yn, preferred_sp_id, equal_bid_yn "
|
||||
text("SELECT close_reason, award_type, preferred_sp_yn, preferred_sp_id, equal_bid_yn "
|
||||
"FROM quotations WHERE qt_id = :qt_id"),
|
||||
{"qt_id": qt_id},
|
||||
)).one()
|
||||
|
||||
@@ -20,7 +20,7 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from apscheduler.triggers.interval import IntervalTrigger
|
||||
from sqlalchemy import text
|
||||
|
||||
from common.enums import QuotationStatus, QuotationType, SessionStatus
|
||||
from common.enums import AwardType, QuotationStatus, QuotationType, SessionStatus
|
||||
from scheduler import jobs
|
||||
|
||||
PAST = datetime(2020, 1, 1) # 마감시각이 이미 지난 시점(잡①의 마감 대상)
|
||||
@@ -95,6 +95,7 @@ async def test_award_single_lowest(clean):
|
||||
assert row.status == QuotationStatus.CLOSED.value
|
||||
assert row.preferred_sp_yn is True # 낙찰자 있음
|
||||
assert str(row.preferred_sp_id) == str(winner) # 최저가가 단독이라 그 공급사로 확정
|
||||
assert row.award_type == AwardType.AUTO.value # 자동 낙찰(투찰가 기준)
|
||||
|
||||
|
||||
async def test_rejected_just_closes(clean):
|
||||
@@ -205,6 +206,6 @@ async def _quotation_row(engine, qt_id):
|
||||
"""견적 1건을 다시 읽어온다(마감 후 status·낙찰자 확인용)."""
|
||||
async with engine.begin() as conn:
|
||||
return (await conn.execute(
|
||||
text("SELECT status, preferred_sp_yn, preferred_sp_id FROM quotations WHERE qt_id = :id"),
|
||||
text("SELECT status, preferred_sp_yn, preferred_sp_id, award_type FROM quotations WHERE qt_id = :id"),
|
||||
{"id": qt_id},
|
||||
)).first()
|
||||
Reference in new issue
Block a user