Skip to content

Commit

Permalink
Merge pull request #359 from planetarium/bugfix/remove-planet-id
Browse files Browse the repository at this point in the history
Remove planet_id from Mileage model
  • Loading branch information
U-lis authored Dec 16, 2024
2 parents 6bd4c80 + b567683 commit f433915
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 f433915

Please sign in to comment.