fix farm
This commit is contained in:
@@ -117,14 +117,14 @@ def get_farm_data():
|
||||
for row in rows:
|
||||
d = json.loads(row['data'])
|
||||
farm_data = d.get('farms', [])
|
||||
ready = [f for f in farm_data if f.get('lootable_at', 0) <= now_ts]
|
||||
ready = [f for f in farm_data if f.get('lootable_at', 0) <= now_ts and f.get('relation_status', 0) == 1]
|
||||
if farm_data:
|
||||
farms_summary.append({
|
||||
'town_id': row['town_id'],
|
||||
'town_name': row['town_name'],
|
||||
'total_farms': len(farm_data),
|
||||
'ready_farms': len(ready),
|
||||
'next_ready_at': min((f['lootable_at'] for f in farm_data if f.get('lootable_at', 0) > now_ts), default=None)
|
||||
'next_ready_at': min((f['lootable_at'] for f in farm_data if f.get('lootable_at', 0) > now_ts and f.get('relation_status', 0) == 1), default=None)
|
||||
})
|
||||
return jsonify(farms_summary)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user