DawnC commited on
Commit
6f25d52
1 Parent(s): 23894e6

Update scoring_calculation_system.py

Browse files
Files changed (1) hide show
  1. scoring_calculation_system.py +10 -0
scoring_calculation_system.py CHANGED
@@ -1276,6 +1276,16 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
1276
  # 計算環境適應性加成
1277
  adaptability_bonus = calculate_environmental_fit(breed_info, user_prefs)
1278
 
 
 
 
 
 
 
 
 
 
 
1279
  # 整合最終分數和加成
1280
  combined_score = (final_score * 0.9) + (adaptability_bonus * 0.1)
1281
 
 
1276
  # 計算環境適應性加成
1277
  adaptability_bonus = calculate_environmental_fit(breed_info, user_prefs)
1278
 
1279
+
1280
+ # 處理極端情況(新增)
1281
+ if user_prefs.living_space == "apartment" and breed_info['Size'] in ["Giant", "Large"]:
1282
+ final_score *= 0.7 # 大型犬在公寓環境下的顯著懲罰
1283
+
1284
+ if (breed_info.get('Exercise Needs') == "Very High" and
1285
+ user_prefs.living_space == "apartment" and
1286
+ user_prefs.exercise_time < 90):
1287
+ final_score *= 0.75 # 高運動需求但條件不足的懲罰
1288
+
1289
  # 整合最終分數和加成
1290
  combined_score = (final_score * 0.9) + (adaptability_bonus * 0.1)
1291