-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[new-score]: remove score, add new score percentiles
- Loading branch information
Showing
13 changed files
with
100 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
query ScorePercentiles { | ||
scorePercentiles { | ||
percentile25, | ||
percentile50, | ||
percentile75 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { ScorePercentilesQueryPayload } from '../../../../graphql/backend/vault' | ||
import { apiUrls } from '../../../../utils' | ||
import graphql from '../../../../graphql' | ||
|
||
import modifyScorePercentiles from './modifyScorePercentiles' | ||
import { ModifiedScorePercentiles } from './types' | ||
|
||
|
||
type GetScorePercentilesInput = { | ||
options: StakeWise.Options | ||
} | ||
|
||
const getScorePercentiles = async (input: GetScorePercentilesInput) => { | ||
const { options } = input | ||
|
||
const data = await graphql.backend.vault.fetchScorePercentilesQuery<ModifiedScorePercentiles>({ | ||
url: apiUrls.getBackendUrl(options), | ||
modifyResult: (data: ScorePercentilesQueryPayload) => modifyScorePercentiles(data), | ||
}) | ||
|
||
return data | ||
} | ||
|
||
|
||
export default getScorePercentiles |
23 changes: 23 additions & 0 deletions
23
src/methods/vault/requests/getScorePercentiles/modifyScorePercentiles.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ScorePercentilesQueryPayload } from '../../../../graphql/backend/vault' | ||
import modifyScorePercentiles from './modifyScorePercentiles' | ||
|
||
|
||
describe('modifyScorePercentiles functions', () => { | ||
const sampleInput: ScorePercentilesQueryPayload = { | ||
scorePercentiles: { | ||
percentile25: '95.00', | ||
percentile50: '97.00', | ||
percentile75: '98.00', | ||
}, | ||
} | ||
|
||
it('should correctly modify a score percentiles', () => { | ||
const result = modifyScorePercentiles(sampleInput) | ||
|
||
expect(result).toEqual({ | ||
percentile25: 95.00, | ||
percentile50: 97.00, | ||
percentile75: 98.00, | ||
}) | ||
}) | ||
}) |
16 changes: 16 additions & 0 deletions
16
src/methods/vault/requests/getScorePercentiles/modifyScorePercentiles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { ScorePercentilesQueryPayload } from '../../../../graphql/backend/vault' | ||
import { ModifiedScorePercentiles } from './types' | ||
|
||
|
||
const modifyScorePercentiles = (input: ScorePercentilesQueryPayload): ModifiedScorePercentiles => { | ||
const { scorePercentiles } = input | ||
|
||
return ({ | ||
percentile25: Number(scorePercentiles.percentile25), | ||
percentile50: Number(scorePercentiles.percentile50), | ||
percentile75: Number(scorePercentiles.percentile75), | ||
}) | ||
} | ||
|
||
|
||
export default modifyScorePercentiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type ModifiedScorePercentiles = { | ||
percentile25: number | ||
percentile50: number | ||
percentile75: number | ||
} |
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/methods/vault/requests/getScoring/modifyScoring.spec.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.