Hash updates for marketplace transactions
This commit is contained in:
parent
4b7f3e5d13
commit
a5e6788289
112
db_engine.py
112
db_engine.py
@ -226,9 +226,9 @@ class Team(BaseModel):
|
|||||||
return Team.get_or_none(Team.season == season, Team.abbrev == abbrev.upper())
|
return Team.get_or_none(Team.season == season, Team.abbrev == abbrev.upper())
|
||||||
|
|
||||||
def team_hash(self):
|
def team_hash(self):
|
||||||
hash_string = f'{self.abbrev}{self.gmid / 123:.0f}'
|
hash_string = f'{self.sname[-1]}{self.gmid / 6950123:.0f}{self.sname[-2]}{self.gmid / 42069123:.0f}'
|
||||||
logging.info(f'string: {hash_string}')
|
logging.info(f'string: {hash_string}')
|
||||||
return hash(hash_string)
|
return hash_string
|
||||||
|
|
||||||
|
|
||||||
db.create_tables([Team])
|
db.create_tables([Team])
|
||||||
@ -480,6 +480,112 @@ db.create_tables([
|
|||||||
Roster, BattingStat, PitchingStat, Result, Award, Paperdex, Reward, GameRewards, Notification, GauntletReward,
|
Roster, BattingStat, PitchingStat, Result, Award, Paperdex, Reward, GameRewards, Notification, GauntletReward,
|
||||||
GauntletRun
|
GauntletRun
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
class BattingCard(BaseModel):
|
||||||
|
player = ForeignKeyField(Player)
|
||||||
|
steal_low = IntegerField()
|
||||||
|
steal_high = IntegerField()
|
||||||
|
steal_auto = BooleanField()
|
||||||
|
steal_jump = FloatField()
|
||||||
|
bunting = CharField()
|
||||||
|
hit_and_run = CharField()
|
||||||
|
running = IntegerField()
|
||||||
|
offense_col = IntegerField()
|
||||||
|
hand = CharField(default='R')
|
||||||
|
|
||||||
|
|
||||||
|
class BattingCardRatings(BaseModel):
|
||||||
|
battingcard = ForeignKeyField(BattingCard)
|
||||||
|
vs_hand = FloatField()
|
||||||
|
homerun = FloatField()
|
||||||
|
bp_homerun = FloatField()
|
||||||
|
triple = FloatField()
|
||||||
|
double_three = FloatField()
|
||||||
|
double_two = FloatField()
|
||||||
|
double_pull = FloatField()
|
||||||
|
single_two = FloatField()
|
||||||
|
single_one = FloatField()
|
||||||
|
single_center = FloatField()
|
||||||
|
bp_single = FloatField()
|
||||||
|
hbp = FloatField()
|
||||||
|
walk = FloatField()
|
||||||
|
strikeout = FloatField()
|
||||||
|
lineout = FloatField()
|
||||||
|
popout = FloatField()
|
||||||
|
flyout_a = FloatField()
|
||||||
|
flyout_bq = FloatField()
|
||||||
|
flyout_lf_b = FloatField()
|
||||||
|
flyout_rf_b = FloatField()
|
||||||
|
groundout_a = FloatField()
|
||||||
|
groundout_b = FloatField()
|
||||||
|
groundout_c = FloatField()
|
||||||
|
avg = FloatField(null=True)
|
||||||
|
obp = FloatField(null=True)
|
||||||
|
slg = FloatField(null=True)
|
||||||
|
|
||||||
|
|
||||||
|
class PitchingCard(BaseModel):
|
||||||
|
player = ForeignKeyField(Player)
|
||||||
|
balk = IntegerField()
|
||||||
|
wild_pitch = IntegerField(null=True)
|
||||||
|
hold = CharField()
|
||||||
|
starter_rating = IntegerField()
|
||||||
|
relief_rating = IntegerField()
|
||||||
|
closer_rating = IntegerField(null=True)
|
||||||
|
batting = CharField(null=True)
|
||||||
|
|
||||||
|
|
||||||
|
class PitchingCardRatings(BaseModel):
|
||||||
|
pitchingcard = ForeignKeyField(PitchingCard)
|
||||||
|
vs_hand = CharField()
|
||||||
|
homerun = FloatField()
|
||||||
|
bp_homerun = FloatField()
|
||||||
|
triple = FloatField()
|
||||||
|
double_three = FloatField()
|
||||||
|
double_two = FloatField()
|
||||||
|
double_cf = FloatField()
|
||||||
|
single_two = FloatField()
|
||||||
|
single_one = FloatField()
|
||||||
|
single_center = FloatField()
|
||||||
|
bp_single = FloatField()
|
||||||
|
hbp = FloatField()
|
||||||
|
walk = FloatField()
|
||||||
|
strikeout = FloatField()
|
||||||
|
fo_slap = FloatField()
|
||||||
|
fo_center = FloatField()
|
||||||
|
groundout_a = FloatField()
|
||||||
|
groundout_b = FloatField()
|
||||||
|
xcheck_p = FloatField()
|
||||||
|
xcheck_c = FloatField()
|
||||||
|
xcheck_1b = FloatField()
|
||||||
|
xcheck_2b = FloatField()
|
||||||
|
xcheck_3b = FloatField()
|
||||||
|
xcheck_ss = FloatField()
|
||||||
|
xcheck_lf = FloatField()
|
||||||
|
xcheck_cf = FloatField()
|
||||||
|
xcheck_rf = FloatField()
|
||||||
|
avg = FloatField(null=True)
|
||||||
|
obp = FloatField(null=True)
|
||||||
|
slg = FloatField(null=True)
|
||||||
|
|
||||||
|
|
||||||
|
class CardPosition(BaseModel):
|
||||||
|
player = ForeignKeyField(Player)
|
||||||
|
batting = ForeignKeyField(BattingCard, null=True)
|
||||||
|
pitching = ForeignKeyField(PitchingCard, null=True)
|
||||||
|
position = CharField()
|
||||||
|
innings = IntegerField()
|
||||||
|
range = IntegerField()
|
||||||
|
error = IntegerField()
|
||||||
|
arm = IntegerField(null=True)
|
||||||
|
pb = IntegerField(null=True)
|
||||||
|
overthrow = IntegerField(null=True)
|
||||||
|
|
||||||
|
|
||||||
|
db.create_tables([BattingCard, BattingCardRatings, PitchingCard, PitchingCardRatings, CardPosition])
|
||||||
|
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
scout_db = SqliteDatabase(
|
scout_db = SqliteDatabase(
|
||||||
@ -584,7 +690,7 @@ class PitcherRatings(BaseModelScout):
|
|||||||
slg = FloatField(null=True)
|
slg = FloatField(null=True)
|
||||||
|
|
||||||
|
|
||||||
scout_db.create_tables([BatterRatings, PitcherRatings])
|
# scout_db.create_tables([BatterRatings, PitcherRatings])
|
||||||
|
|
||||||
|
|
||||||
class CardColumns(BaseModelScout):
|
class CardColumns(BaseModelScout):
|
||||||
|
|||||||
6
main.py
6
main.py
@ -356,7 +356,7 @@ async def v1_teams_get_one(team_id, csv: Optional[bool] = False):
|
|||||||
|
|
||||||
|
|
||||||
@app.get('/api/v1/teams/{team_id}/buy/players')
|
@app.get('/api/v1/teams/{team_id}/buy/players')
|
||||||
async def v1_team_cards_buy(team_id: int, ids: str, ts: int):
|
async def v1_team_cards_buy(team_id: int, ids: str, ts: str):
|
||||||
try:
|
try:
|
||||||
this_team = Team.get_by_id(team_id)
|
this_team = Team.get_by_id(team_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -437,7 +437,7 @@ async def v1_team_cards_buy(team_id: int, ids: str, ts: int):
|
|||||||
|
|
||||||
|
|
||||||
@app.get('/api/v1/teams/{team_id}/buy/pack/{packtype_id}')
|
@app.get('/api/v1/teams/{team_id}/buy/pack/{packtype_id}')
|
||||||
async def v1_team_pack_buy(team_id: int, packtype_id: int, ts: int, quantity: Optional[int] = 1):
|
async def v1_team_pack_buy(team_id: int, packtype_id: int, ts: str, quantity: Optional[int] = 1):
|
||||||
try:
|
try:
|
||||||
this_packtype = PackType.get_by_id(packtype_id)
|
this_packtype = PackType.get_by_id(packtype_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -492,7 +492,7 @@ async def v1_team_pack_buy(team_id: int, packtype_id: int, ts: int, quantity: Op
|
|||||||
|
|
||||||
|
|
||||||
@app.get('/api/v1/teams/{team_id}/sell/cards')
|
@app.get('/api/v1/teams/{team_id}/sell/cards')
|
||||||
async def v1_team_cards_sell(team_id: int, ids: str, ts: int):
|
async def v1_team_cards_sell(team_id: int, ids: str, ts: str):
|
||||||
try:
|
try:
|
||||||
this_team = Team.get_by_id(team_id)
|
this_team = Team.get_by_id(team_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user