James McCool commited on
Commit
4f1a07c
·
1 Parent(s): fe4cd6d

Refine reassess_dupes function in reassess_edge.py to enhance the threshold crossing logic for salary adjustments, ensuring accurate reduction of dupes when salaries transition from above to below the threshold, while maintaining clarity and readability.

Browse files
Files changed (1) hide show
  1. global_func/reassess_edge.py +10 -4
global_func/reassess_edge.py CHANGED
@@ -51,13 +51,19 @@ def reassess_dupes(row: pd.Series, salary_max: int) -> float:
51
  own_diff = float(row['own_diff'])
52
  dupes = int(row['Dupes'])
53
 
54
- # Calculate distance from threshold
55
  threshold = salary_max - 500
56
  distance_from_threshold = salary - threshold
57
 
58
- # Apply dramatic reduction when below threshold
59
- if distance_from_threshold < 0:
60
- # For every 100 under threshold, divide dupes by 2
 
 
 
 
 
 
61
  reduction_factor = 2 ** (abs(distance_from_threshold) / 100)
62
  adjusted_dupes = dupes / reduction_factor
63
  else:
 
51
  own_diff = float(row['own_diff'])
52
  dupes = int(row['Dupes'])
53
 
54
+ # Calculate current distance from threshold
55
  threshold = salary_max - 500
56
  distance_from_threshold = salary - threshold
57
 
58
+ # Check if salary crossed the threshold due to salary_diff
59
+ original_salary = salary - salary_diff # What the salary was before the change
60
+
61
+ if original_salary >= threshold and salary < threshold:
62
+ # Salary crossed from above to below threshold - apply dramatic reduction
63
+ reduction_factor = 2 ** (abs(distance_from_threshold) / 100)
64
+ adjusted_dupes = dupes / reduction_factor
65
+ elif distance_from_threshold < 0:
66
+ # Already below threshold - apply reduction
67
  reduction_factor = 2 ** (abs(distance_from_threshold) / 100)
68
  adjusted_dupes = dupes / reduction_factor
69
  else: