James McCool
commited on
Commit
·
24c4247
1
Parent(s):
c4b1445
Refactor reassess_dupes function in reassess_edge.py to improve clarity by introducing local variables for salary, salary_diff, own_diff, and dupes, enhancing readability while maintaining existing logic for ownership adjustments.
Browse files- global_func/reassess_edge.py +10 -4
global_func/reassess_edge.py
CHANGED
|
@@ -45,6 +45,12 @@ def calculate_weighted_ownership_single_row(row_ownerships):
|
|
| 45 |
return weighted * 10000
|
| 46 |
|
| 47 |
def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
st.write(f"DEBUG: row['salary'] = {row['salary']}")
|
| 49 |
st.write(f"DEBUG: (salary_max - 500) = {salary_max - 500}")
|
| 50 |
st.write(f"DEBUG: row['salary'] - (salary_max - 500) = {row['salary'] - (salary_max - 500)}")
|
|
@@ -54,12 +60,12 @@ def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
|
| 54 |
st.write(f"DEBUG: max/100 = {max(0, row['salary'] - (salary_max - 500)) / 100}")
|
| 55 |
st.write(f"DEBUG: salary component = {(max(0, row['salary'] - (salary_max - 500)) / 100) * (2 + row['salary_diff'] / 200) * (1 if row['salary_diff'] >= 0 else -1)}")
|
| 56 |
return math.ceil(
|
| 57 |
-
|
| 58 |
(
|
| 59 |
-
(max(0, (
|
| 60 |
-
(1 if
|
| 61 |
|
| 62 |
-
(
|
| 63 |
)
|
| 64 |
)
|
| 65 |
|
|
|
|
| 45 |
return weighted * 10000
|
| 46 |
|
| 47 |
def reassess_dupes(row: pd.Series, salary_max: int) -> float:
|
| 48 |
+
|
| 49 |
+
salary = int(row['salary'])
|
| 50 |
+
salary_diff = int(row['salary_diff'])
|
| 51 |
+
own_diff = float(row['own_diff'])
|
| 52 |
+
dupes = int(row['Dupes'])
|
| 53 |
+
|
| 54 |
st.write(f"DEBUG: row['salary'] = {row['salary']}")
|
| 55 |
st.write(f"DEBUG: (salary_max - 500) = {salary_max - 500}")
|
| 56 |
st.write(f"DEBUG: row['salary'] - (salary_max - 500) = {row['salary'] - (salary_max - 500)}")
|
|
|
|
| 60 |
st.write(f"DEBUG: max/100 = {max(0, row['salary'] - (salary_max - 500)) / 100}")
|
| 61 |
st.write(f"DEBUG: salary component = {(max(0, row['salary'] - (salary_max - 500)) / 100) * (2 + row['salary_diff'] / 200) * (1 if row['salary_diff'] >= 0 else -1)}")
|
| 62 |
return math.ceil(
|
| 63 |
+
dupes +
|
| 64 |
(
|
| 65 |
+
(max(0, (salary - (salary_max - 500)) / 100) * (2 + (salary_diff / 200)) *
|
| 66 |
+
(1 if salary_diff >= 0 else -1)) +
|
| 67 |
|
| 68 |
+
(own_diff / 10)
|
| 69 |
)
|
| 70 |
)
|
| 71 |
|