Coverage for src / land.py: 0%
28 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-01 10:28 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-01 10:28 +0000
1from datetime import datetime
3import pandas as pd
5from src.api import spl
6from src.configuration import store
7from src.utils import store_util, land_util, progress_util
9START_LAND_DATE = datetime(2023, 11, 25)
12def has_land(account):
13 if len(spl.get_deeds_collection(account)) > 0:
14 return True
15 else:
16 return False
19def get_last_process_date(account):
20 from_date = START_LAND_DATE
21 df = store.land.copy()
22 if not df.empty and not df.loc[(df.player == account)].empty:
23 # determine last process date
24 df = df.loc[(df.player == account)]
25 df.timestamp = pd.to_datetime(df.timestamp)
26 from_date = df.timestamp.max()
27 return from_date
30def update_land_data():
31 progress_util.update_daily_msg("Start update land")
33 for account in store_util.get_account_names():
34 progress_util.update_daily_msg("...update land for: " + str(account))
35 if has_land(account):
36 from_date = get_last_process_date(account)
37 df = land_util.get_land_operations(account, from_date)
38 if not df.empty:
39 store.land = pd.concat([store.land, df], ignore_index=True)
40 store_util.save_stores()