Coverage for src/land.py: 0%

28 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-03 19:06 +0000

1from datetime import datetime 

2 

3import pandas as pd 

4 

5from src.api import spl 

6from src.configuration import store 

7from src.utils import store_util, land_util, progress_util 

8 

9START_LAND_DATE = datetime(2023, 11, 25) 

10 

11 

12def has_land(account): 

13 if len(spl.get_deeds_collection(account)) > 0: 

14 return True 

15 else: 

16 return False 

17 

18 

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 

28 

29 

30def update_land_data(): 

31 progress_util.update_daily_msg("Start update land") 

32 

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()