jobscore/jobscore.py

27 lines
747 B
Python
Raw Normal View History

2024-11-13 17:42:07 +07:00
def compare(history, data):
for row in history:
if row['year'] == data['from' ]:
before = row
if row['year'] == data['to' ]:
after = row
else:
pass
before_value = before ['salary'] / before ['based'][data['based']]
after_value = after ['salary'] / after ['based'][data['based']]
change = (after_value - before_value) / before_value * 100
return change
def proposal(history, data):
for row in history:
if row['year'] == data['from']:
before = row
else:
pass
new_value = ((data['percent']/100)+1) * before['salary'] / before['based'][data['based']['type']] * data['based']['value']
return new_value