Spaces:
Sleeping
Sleeping
ChenyuRabbitLove
commited on
Commit
·
cabe12b
1
Parent(s):
92c59ee
feat: make fetch player final data automatically
Browse files- utils/utils.py +3 -8
utils/utils.py
CHANGED
@@ -164,8 +164,8 @@ def query_bq_table(client, sql):
|
|
164 |
raise
|
165 |
|
166 |
|
167 |
-
def load_player_statuses(client
|
168 |
-
table_name = f"
|
169 |
sql = f"SELECT * FROM `data_mart.{table_name}`"
|
170 |
return {
|
171 |
row["player_backend_user_id"]: Player.from_dict(row)
|
@@ -173,13 +173,8 @@ def load_player_statuses(client, date_str):
|
|
173 |
}
|
174 |
|
175 |
|
176 |
-
def get_date_strs(delta_days=0):
|
177 |
-
target_date = datetime.now().date() - timedelta(days=delta_days)
|
178 |
-
return target_date.strftime("%Y%m%d")
|
179 |
-
|
180 |
-
|
181 |
def save_latest_player_data():
|
182 |
-
latest_player_data = load_player_statuses(client
|
183 |
latest_player_data_as_dict = {
|
184 |
key: asdict(value) for key, value in latest_player_data.items()
|
185 |
}
|
|
|
164 |
raise
|
165 |
|
166 |
|
167 |
+
def load_player_statuses(client):
|
168 |
+
table_name = f"mes_report_20231229"
|
169 |
sql = f"SELECT * FROM `data_mart.{table_name}`"
|
170 |
return {
|
171 |
row["player_backend_user_id"]: Player.from_dict(row)
|
|
|
173 |
}
|
174 |
|
175 |
|
|
|
|
|
|
|
|
|
|
|
176 |
def save_latest_player_data():
|
177 |
+
latest_player_data = load_player_statuses(client)
|
178 |
latest_player_data_as_dict = {
|
179 |
key: asdict(value) for key, value in latest_player_data.items()
|
180 |
}
|