From 74f49efcc3e238a2033a2c3195f61eb71db3b51f Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 13 Nov 2024 17:42:07 +0700 Subject: [PATCH] First commit --- LICENSE | 21 +++++++++++++++ README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ jobscore.py | 26 +++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 jobscore.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..29cd69f --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..98c25eb --- /dev/null +++ b/README.md @@ -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}') \ No newline at end of file diff --git a/jobscore.py b/jobscore.py new file mode 100644 index 0000000..8fb44c5 --- /dev/null +++ b/jobscore.py @@ -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