Spaces:
Running
on
Zero
Running
on
Zero
Update scoring_calculation_system.py
Browse files
scoring_calculation_system.py
CHANGED
@@ -208,6 +208,14 @@ def calculate_additional_factors(breed_info: dict, user_prefs: 'UserPreferences'
|
|
208 |
def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences) -> dict:
|
209 |
"""計算品種與使用者條件的相容性分數的優化版本"""
|
210 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
def calculate_space_score(size: str, living_space: str, has_yard: bool, exercise_needs: str) -> float:
|
212 |
"""空間分數計算"""
|
213 |
# 基礎空間需求矩陣
|
@@ -502,5 +510,7 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
502 |
return scores
|
503 |
|
504 |
except Exception as e:
|
505 |
-
print(f"Error
|
|
|
|
|
506 |
return {k: 0.5 for k in ['space', 'exercise', 'grooming', 'experience', 'health', 'noise', 'overall']}
|
|
|
208 |
def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences) -> dict:
|
209 |
"""計算品種與使用者條件的相容性分數的優化版本"""
|
210 |
try:
|
211 |
+
print(f"Processing breed: {breed_info.get('Breed', 'Unknown')}")
|
212 |
+
print(f"Breed info keys: {breed_info.keys()}")
|
213 |
+
|
214 |
+
# 在計算每個分數之前添加檢查
|
215 |
+
if 'Size' not in breed_info:
|
216 |
+
print("Missing Size information")
|
217 |
+
raise KeyError("Size information missing")
|
218 |
+
|
219 |
def calculate_space_score(size: str, living_space: str, has_yard: bool, exercise_needs: str) -> float:
|
220 |
"""空間分數計算"""
|
221 |
# 基礎空間需求矩陣
|
|
|
510 |
return scores
|
511 |
|
512 |
except Exception as e:
|
513 |
+
print(f"Error details: {str(e)}")
|
514 |
+
print(f"breed_info: {breed_info}")
|
515 |
+
# print(f"Error in calculate_compatibility_score: {str(e)}")
|
516 |
return {k: 0.5 for k in ['space', 'exercise', 'grooming', 'experience', 'health', 'noise', 'overall']}
|