Skip to content

Commit

Permalink
Remove planet_id from Mileage model
Browse files Browse the repository at this point in the history
  • Loading branch information
U-lis committed Dec 13, 2024
1 parent 1ad1c84 commit b567683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b567683

Please sign in to comment.