adjust map score tolerance

This commit is contained in:
juhn
2025-10-24 13:09:43 +02:00
parent 07b9ddf745
commit 657b81cd46

View File

@@ -194,7 +194,7 @@ class GameConsumer(AsyncWebsocketConsumer):
@database_sync_to_async @database_sync_to_async
def save_answer_map(self, participant_id, answer_location, time_remaining): def save_answer_map(self, participant_id, answer_location, time_remaining):
answer_index = -1 answer_index = 0
try: try:
# Get all necessary data first # Get all necessary data first
participant = QuizGameParticipant.objects.get( participant = QuizGameParticipant.objects.get(
@@ -207,9 +207,6 @@ class GameConsumer(AsyncWebsocketConsumer):
target_location = question_data['target_location'] target_location = question_data['target_location']
tolerance_radius = question_data.get('tolerance_radius', 1000) # Default 1km if not set tolerance_radius = question_data.get('tolerance_radius', 1000) # Default 1km if not set
print(f"Raw target_location: {target_location}")
print(f"Raw answer_location: {answer_location}")
print(f"tolerance_radius: {tolerance_radius}")
# Parse coordinates if they are strings # Parse coordinates if they are strings
def parse_coords(coord): def parse_coords(coord):
@@ -242,11 +239,9 @@ class GameConsumer(AsyncWebsocketConsumer):
is_correct = False is_correct = False
score = 0 score = 0
else: else:
print(f"Parsed target_location: {target_location}")
print(f"Parsed answer_location: {answer_location}")
# Configuration - Make these easily adjustable # Configuration - Make these easily adjustable
MAX_DISTANCE_KM = 1000 # Maximum distance for scoring (in km) MAX_DISTANCE_KM = 200 # Maximum distance for scoring (in km)
DIRECT_HIT_BONUS = 200 # Extra points for direct hit within tolerance DIRECT_HIT_BONUS = 200 # Extra points for direct hit within tolerance
try: try: