From 0c36a864cc4d7318621edb2d8bcbaf5f6f1ffec6 Mon Sep 17 00:00:00 2001 From: Oscar Gonzalez Date: Mon, 6 Nov 2023 17:29:16 -0400 Subject: [PATCH 1/3] Fix calculate delta percent --- src/delta.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/delta.ts b/src/delta.ts index 1f0490c..aa1e7b4 100644 --- a/src/delta.ts +++ b/src/delta.ts @@ -17,7 +17,7 @@ export const calculateDeltaValue = (current?: number, previous?: number) => { export const calculateDeltaPercent = (current?: number, previous?: number) => { if (!current || !previous) return null; - return ((current - previous) / current) * 100; + return ((current - previous) / previous) * 100; }; export const calculateDelta = (current?: number, previous?: number) => { From d55ea6b744e7b5bca1fbf4b2b68da7efbc7602b4 Mon Sep 17 00:00:00 2001 From: Geovanni Perez <1775792+geoperez@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:41:52 -0600 Subject: [PATCH 2/3] Update lint-pr.yml --- .github/workflows/lint-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index f025feb..2e42165 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -6,6 +6,6 @@ on: jobs: build: - uses: unosquare/bump-npm-version/.github/workflows/lint.yml@master + uses: unosquare/bump-npm-version/.github/workflows/lint-pnpm.yml@master secrets: - github-token: ${{ secrets.GPR_ACCESS_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GPR_ACCESS_TOKEN }} From 8faa32c2dc94b336c708137dae96cddefee4e8cd Mon Sep 17 00:00:00 2001 From: Oscar Gonzalez Date: Tue, 7 Nov 2023 09:33:24 -0400 Subject: [PATCH 3/3] Adjust tests --- test/delta.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/delta.spec.ts b/test/delta.spec.ts index 8524644..b9efe35 100644 --- a/test/delta.spec.ts +++ b/test/delta.spec.ts @@ -4,13 +4,13 @@ describe('calculateDelta', () => { it('should return delta, deltaPercent, and deltaString', () => { const [delta, deltaPercent, deltaString] = calculateDelta(10, 5); expect(delta).toBe(5); - expect(deltaPercent).toBe(50); + expect(deltaPercent).toBe(100); expect(deltaString).toBe('increase'); }); it('should return delta, deltaPercent, and deltaString', () => { const [delta, deltaPercent, deltaString] = calculateDelta(5, 10); expect(delta).toBe(-5); - expect(deltaPercent).toBe(-100); + expect(deltaPercent).toBe(-50); expect(deltaString).toBe('decrease'); }); it('should return delta, deltaPercent, and deltaString', () => {