First commit

This commit is contained in:
Dita Aji Pratama 2024-11-13 17:42:07 +07:00
commit 74f49efcc3
3 changed files with 122 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Dita Aji Pratama
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

75
README.md Normal file
View File

@ -0,0 +1,75 @@
# JobScore
Python Script for check your profession value.
## Usage
import the script
import jobscore
prepare your list.
history = [
{
'year' : 2015,
'salary' : 2200000.00,
'based' : {
'gold' : 474773.00,
'umr' : 2700000.00
}
},
{
'year' : 2016,
'salary' : 3300000.00,
'based' : {
'gold' : 568643.00,
'umr' : 3100000.00
}
},
{
'year' : 2018,
'salary' : 4000000.00,
'based' : {
'gold' : 567498.00,
'umr' : 3648036.00
}
},
{
'year' : 2019,
'salary' : 8000000.00,
'based' : {
'gold' : 758000.00,
'umr' : 3900000.00
}
}
]
define a number formating (optional).
def formating(i):
return "{:,.2f}".format(i)
to get a percent of the changes comparison in your profession value.
data = {
'from' : 2018,
'to' : 2019,
'based' : 'gold'
}
result = formating( jobscore.compare(history, data) )
print(f'{result}%')
to get a salary increase proposal based on your last profession value.
data = {
'percent' : 20, # increase you expected
'from' : 2019,
'based' : {
'type' : 'gold',
'value' : 1073235.00 # current based value
}
}
result = formating( jobscore.proposal(history, data) )
print(f'Rp {result}')

26
jobscore.py Normal file
View File

@ -0,0 +1,26 @@
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