From b567683c4c0920f558fe91128af4be970498ef51 Mon Sep 17 00:00:00 2001 From: hyeon Date: Fri, 13 Dec 2024 17:28:01 +0900 Subject: [PATCH] Remove planet_id from Mileage model --- iap/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iap/utils.py b/iap/utils.py index 5aa2eef..9195503 100644 --- a/iap/utils.py +++ b/iap/utils.py @@ -113,9 +113,9 @@ def get_mileage(sess, agent_addr: str) -> Mileage: agent_addr = format_addr(agent_addr) # UPDATE: mileage has been merge across planets. Use one without planet_id. # Merged mileage has planet_id as None. Others are historical data. - mileage = sess.scalar(select(Mileage).where(Mileage.planet_id.is_(None), Mileage.agent_addr == agent_addr)) + mileage = sess.scalar(select(Mileage).where(Mileage.agent_addr == agent_addr)) if not mileage: - mileage = Mileage(planet_id=None, agent_addr=agent_addr, mileage=0) + mileage = Mileage(agent_addr=agent_addr, mileage=0) sess.add(mileage) sess.commit() sess.refresh(mileage)