Skip to content

Commit

Permalink
chore(salaryCalculator): prettify
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Aug 23, 2024
1 parent fb33030 commit 087f2c2
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.fieldset {
border: 0 none;
padding: 0;
border: 0 none;
padding: 0;
}

.wrapper {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
display: flex;
flex-direction: column;
gap: 0.5rem;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.calculator{
display: flex;
flex-direction: column;
gap: 2rem;
}
.calculator {
display: flex;
flex-direction: column;
gap: 2rem;
}
47 changes: 23 additions & 24 deletions src/salaryAndBenefits/utils/calculateSalary.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import { payscale } from "./salaryData";

interface PayScale {
[year: number]: {
[examinationYear: number]: number;
};
}

const salaryPayscale: PayScale = payscale;

export function calculateSalary(
currentYear: number,
examinationYear: number,
degree: string
): number {
[year: number]: {
[examinationYear: number]: number;
};
}

const salaryPayscale: PayScale = payscale;

const degreeValue = degree === "bachelor" ? 1 : 0;
const adjustedYear = (examinationYear + degreeValue);
return salaryPayscale[currentYear][adjustedYear];
}
export function calculateSalary(
currentYear: number,
examinationYear: number,
degree: string,
): number {
const degreeValue = degree === "bachelor" ? 1 : 0;
const adjustedYear = examinationYear + degreeValue;
return salaryPayscale[currentYear][adjustedYear];
}

export function calculatePension(salary: number): number {
return Math.round(salary * 0.07);
}
export function calculatePension(salary: number): number {
return Math.round(salary * 0.07);
}

export function maxExperience(thisYear: number): number {
const years = Object.keys(salaryPayscale[thisYear]).map(Number)
return Math.min(...years);
}
export function maxExperience(thisYear: number): number {
const years = Object.keys(salaryPayscale[thisYear]).map(Number);
return Math.min(...years);
}
79 changes: 39 additions & 40 deletions src/salaryAndBenefits/utils/salaryData.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
export const payscale = {
2024: {
2024 : 600000,
2023 : 635833,
2022 : 681829,
2021 : 734982,
2020 : 789982,
2019 : 838539,
2018 : 879553,
2017 : 916886,
2016 : 949000,
2015 : 977333,
2014 : 1005324,
2013 : 1031405,
2012 : 1064738,
2011 : 1091489,
2010 : 1113742,
2009 : 1138742,
2008 : 1166667,
2007 : 1192460,
2006 : 1210126,
2005 : 1233560,
2004 : 1264767,
2003 : 1289780,
2002 : 1299680,
2001 : 1295953,
2000 : 1305501,
1999 : 1328501,
1998 : 1349349,
1997 : 1365121,
1996 : 1384832,
1995 : 1399711,
1994 : 1422069,
1993 : 1429358,
1992 : 1452891,
1991 : 1458021,
1990 : 1467321,
1989 : 1484721
}
} ;

2024: {
2024: 600000,
2023: 635833,
2022: 681829,
2021: 734982,
2020: 789982,
2019: 838539,
2018: 879553,
2017: 916886,
2016: 949000,
2015: 977333,
2014: 1005324,
2013: 1031405,
2012: 1064738,
2011: 1091489,
2010: 1113742,
2009: 1138742,
2008: 1166667,
2007: 1192460,
2006: 1210126,
2005: 1233560,
2004: 1264767,
2003: 1289780,
2002: 1299680,
2001: 1295953,
2000: 1305501,
1999: 1328501,
1998: 1349349,
1997: 1365121,
1996: 1384832,
1995: 1399711,
1994: 1422069,
1993: 1429358,
1992: 1452891,
1991: 1458021,
1990: 1467321,
1989: 1484721,
},
};

0 comments on commit 087f2c2

Please sign in to comment.