This commit is contained in:
2026-04-24 20:18:14 +03:00
parent 102cdfdcce
commit f6f4df05bf

View File

@@ -117,14 +117,14 @@ def get_farm_data():
for row in rows: for row in rows:
d = json.loads(row['data']) d = json.loads(row['data'])
farm_data = d.get('farms', []) 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: if farm_data:
farms_summary.append({ farms_summary.append({
'town_id': row['town_id'], 'town_id': row['town_id'],
'town_name': row['town_name'], 'town_name': row['town_name'],
'total_farms': len(farm_data), 'total_farms': len(farm_data),
'ready_farms': len(ready), '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) return jsonify(farms_summary)