Closed jiyolla closed 3 years ago
It's a bad idea to update the skin table whenever a call is made. The best timing for the update might be when the new price_history record is added.(i.e is when the udpate_price_history.py works). But putting this logic in update_price_history or the instance where the league client is running seems inappropriate since this function itself is unreliable yet.
The best one seems to use TRIGGER sql statement supported by PostgreSQL, which is unfortunately unsupported by SQLAlchemy's orm but available in through custom DDL.
Implemented in dev.
It's originally implemented in bcd1a5b5cf2db8e86311d0c7fc513d1b84cf2714 But later reverted. Now there's a new field called 'last_price_history' which has an entire price history that is the most up to date. Or it's null if there's none.
Currently, all skins have price and sale_price set to 0. When updating price_history, corresponding skin's price and sale_price also have to be updated.