Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Polish scale #173

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Javascript utilities for working with rock climbing grades.
- [x] Ewbanks
- [x] Saxon
- [x] Brazilian
- [x] Polish (Kurtyka)

**Bouldering**
- [x] Vermin (V-scale)
Expand Down
3 changes: 2 additions & 1 deletion src/GradeScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const GradeScales = {
EWBANK: 'ewbank',
SAXON: 'saxon',
NORWEGIAN: 'norwegian',
BRAZILIAN_CRUX: 'brazilian_crux'
BRAZILIAN_CRUX: 'brazilian_crux',
POLISH: 'polish'
} as const

export type GradeScalesTypes = typeof GradeScales[keyof typeof GradeScales]
Expand Down
106 changes: 106 additions & 0 deletions src/__tests__/scales/polish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// import { GradeBands } from '../../GradeBands'
import { Polish } from '../../scales'

describe('Polish', () => {
describe('isType', () => {
test('VI is a valid grade', () => {
expect(Polish.isType('VI')).toBe(true)
})
test('asd is not a valid grade', () => {
expect(Polish.isType('asd')).toBe(false)
})
test('VI+/VI.1 is a valid slash grade', () => {
expect(Polish.isType('VI+/VI.1')).toBe(true)
})
test('VI+/VI.1+ is not a valid slash grade', () => {
expect(Polish.isType('VI+/VI.1')).toBe(false)
})
})
// describe('Get Score', () => {
// test('9a > 5c', () => {
// const lowGrade = Polish.getScore('5c')
// const highGrade = Polish.getScore('9a')
// expect(highGrade[0]).toBeGreaterThan(lowGrade[1])
// })

// test('1c > 1a+', () => {
// const highGrade = Polish.getScore('1c')
// const lowGrade = Polish.getScore('1a+')
// expect(highGrade[0]).toBeGreaterThan(lowGrade[1])
// })

// test('1a/1a+ > 1a, one grade away', () => {
// const highGrade = Polish.getScore('1a/1a+')
// const lowGrade = Polish.getScore('1a')
// expect(highGrade[0] < lowGrade[1] && highGrade[0] > lowGrade[0])
// expect(highGrade[1]).toBeGreaterThan(lowGrade[1])
// })

// test('4a > 3c+/4a, one grade away', () => {
// const highGrade = Polish.getScore('4a')
// const lowGrade = Polish.getScore('3c+/4a')
// expect(highGrade[0] < lowGrade[1] && highGrade[0] > lowGrade[0])
// expect(highGrade[1]).toBeGreaterThan(lowGrade[1])
// })
// })

// describe('invalid grade format', () => {
// jest.spyOn(console, 'warn').mockImplementation()
// beforeEach(() => {
// jest.clearAllMocks()
// })
// test('extra plus modifier', () => {
// const invalidGrade = Polish.getScore('5a++')
// expect(console.warn).toHaveBeenCalledWith('Unexpected grade format: 5a++ for grade scale polish')
// expect(invalidGrade).toEqual(-1)
// })
// test('invalid minus modifier', () => {
// const invalidGrade = Polish.getScore('5a-')
// expect(console.warn).toHaveBeenCalledWith('Unexpected grade format: 5a- for grade scale polish')
// expect(invalidGrade).toEqual(-1)
// })
// test('extra slash grade', () => {
// const invalidGrade = Polish.getScore('5a/5a+/5b+')
// expect(console.warn).toHaveBeenCalledWith('Unexpected grade format: 5a/5a+/5b+ for grade scale polish')
// expect(invalidGrade).toEqual(-1)
// })
// test('extra slash', () => {
// const invalidGrade = Polish.getScore('5a/')
// expect(console.warn).toHaveBeenCalledWith('Unexpected grade format: 5a/ for grade scale polish')
// expect(invalidGrade).toEqual(-1)
// })
// test('not Polish scale', () => {
// const invalidGrade = Polish.getScore('v11')
// expect(console.warn).toHaveBeenCalledWith('Unexpected grade format: v11 for grade scale polish')
// expect(invalidGrade).toEqual(-1)
// })
// })

// describe('Get Grade', () => {
// test('bottom of range', () => {
// expect(Polish.getGrade(0)).toBe('1a')
// })

// test('top of range', () => {
// expect(Polish.getGrade(1000)).toBe('9c+')
// })

// test('single score provided', () => {
// expect(Polish.getGrade(34)).toBe('3c+')
// expect(Polish.getGrade(34.5)).toBe('3c+')
// expect(Polish.getGrade(35)).toBe('3c+')
// })
// test('range of scores provided', () => {
// expect(Polish.getGrade([0.5, 2])).toBe('1a/1a+')
// expect(Polish.getGrade([8, 12])).toBe('1c/2a')
// expect(Polish.getGrade([16, 17])).toBe('2b')
// })
// })

// describe('Get Grade Band', () => {
// test('gets Gradeband', () => {
// expect(Polish.getGradeBand('1a')).toEqual(GradeBands.BEGINNER)
// expect(Polish.getGradeBand('9c+')).toEqual(GradeBands.EXPERT)
// })
// })
})
18 changes: 18 additions & 0 deletions src/data/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Intro
Climbing scales are defined in the '.csv' files within this folder.

Each discipline have dedicated files:
- [aid](./aid.csv) climbing
- [bouldering](./boulder.csv)
- [ice](./ice.csv) climbing
- [sport/trad](./routes.csv) climbing

In each file is defined a *score* representing a discrete virtual grade starting from 0.
For each score it is reported the correspective grade for each supported scale.
A grade in a given scale (e.g. french 6a) can corrispond to multiple scores.

## Adding/Editing scales

The main step to add or modify a scale is to add or modify the correspective column in the desired csv file.

Scales are converted into json files with [this](./csvtojson.ts) script (see instruction within the script).
218 changes: 109 additions & 109 deletions src/data/routes.csv
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
score,yds,french,uiaa,ewbank,saxon,norwegian,brazilian_crux
0,5.0,1a,1,1,1,1-,I
1,5.0,1a,1,1,1,1-,I
2,5.0,1a+,1,1,1,1-,I
3,5.0,1a+,1,1,1,1-,I
4,5.0,1b,1,1,1,1,I
5,5.0,1b,1,2,1,1,I
6,5.0,1b+,1,2,1,1+,I
7,5.0,1b+,1,2,1,1+,I
8,5.0,1c,1,2,1,1+,Isup
9,5.0,1c,1,2,1,1+,Isup
10,5.0,1c+,1,3,1,2-,Isup
11,5,1c+,1,4,1,2-,Isup
12,5.1,2a,2,5,2,2,Isup
13,5.1,2a,2,5,2,2,Isup
14,5.1,2a+,2,5,2,2,II
15,5.1,2a+,2,6,2,2,II
16,5.1,2b,2,6,2,2+,II
17,5.1,2b,2,6,2,2+,II
18,5.2,2b+,2,7,2,2+,II
19,5.2,2b+,2,7,2,2+,II
20,5.2,2c,2,7,2,3-,II
21,5.2,2c,2,7,2,3-,II
22,5.3,2c+,2,8,2,3,IIsup
23,5.3,2c+,2,8,2,3,IIsup
24,5.3,3a,3,9,3,3,IIsup
25,5.3,3a,3,9,3,3,IIsup
26,5.4,3a+,3,10,3,3+,IIsup
27,5.4,3a+,3,10,3,3+,IIsup
28,5.4,3b,3,10,3,3+,III
29,5.4,3b,3,10,3,3+,III
30,5.4,3b+,3,10,3,4-,III
31,5.5,3b+,3,11,3,4-,III
32,5.5,3c,3,11,3,4,III
33,5.5,3c,3,12,3,4,III
34,5.5,3c+,3,12,3,4,III
35,5.5,3c+,3,12,3,4,III
36,5.6,4a,4,13,4,4+,IIIsup
37,5.6,4a,4,13,4,4+,IIIsup
38,5.6,4a+,4+,13,4,4+,IIIsup
39,5.6,4a+,4+,13,4,4+,IIIsup
40,5.6,4b,4+,13,5,5-,IIIsup
41,5.7,4b,4+,14,5,5-,IIIsup
42,5.7,4b+,5-,14,5,5-,IV
43,5.7,4b+,5-,14,5,5-,IV
44,5.7,4c,5-,15,5,5,IV
45,5.7,4c,5-,15,5,5,IV
46,5.8,4c+,5,16,6,5,IV
47,5.8,4c+,5,16,6,5,IV
48,5.8,5a,5,16,7a,5+,IVsup
49,5.8,5a,5,16,7a,5+,IVsup
50,5.8,5a+,5+,16,7a,5+,IVsup
51,5.8,5a+,5+,16,7a,5+,IVsup
52,5.9,5b,5+,17,7a,5+,IVsup
53,5.9,5b,5+,17,7a,5+,IVsup
54,5.9,5b+,6-,17,7b,5+,IVsup
55,5.9,5b+,6-,17,7b,5+,IVsup
56,5.9,5c,6,17,7b,6-,V
57,5.10a,5c,6,18,7b,6-,V
58,5.10a,5c+,6+,18,7c,6-,V
59,5.10a,5c+,6+,18,7c,6-,V
60,5.10a,6a,6+,18,7c,6-,V
61,5.10a,6a,6+,18,7c,6-,V
62,5.10b,6a+,7-,19,8a,6,Vsup
63,5.10b,6a+,7-,19,8a,6,Vsup
64,5.10c,6b,7,20,8b,6,VI
65,5.10c,6b,7,20,8b,6,VI
66,5.10d,6b+,7+,20,8c,6+,VIsup
67,5.11a,6b+,7+,21,8c,6+,VIsup
68,5.11a,6c,7+/8-,21,9a,7-,VIIa
69,5.11b,6c,7+/8-,22,9a,7-,VIIa
70,5.11b,6c+,8-,22,9a,7,VIIb
71,5.11c,6c+,8-,23,9a,7,VIIb
72,5.11c,7a,8,23,9b,7+,VIIc
73,5.11d,7a,8,23,9b,7+,VIIc
74,5.11d,7a+,8+,24,9c,8-,VIIIa
75,5.12a,7a+,8+,24,9c,8-,VIIIa
76,5.12b,7b,8+/9-,25,10a,8-,VIIIb
77,5.12b,7b,8+/9-,25,10a,8-,VIIIb
78,5.12c,7b+,9-,26,10a,8,VIIIc
79,5.12c,7b+,9-,26,10a,8,VIIIc
80,5.12d,7c,9,27,10b,8+,IXa
81,5.12d,7c,9,27,10b,8+,IXa
82,5.13a,7c+,9+,28,10c,8+,IXb
83,5.13a,7c+,9+,28,10c,8+,IXb
84,5.13b,8a,10-,29,10c,9-,IXc
85,5.13b,8a,10-,29,10c,9-,IXc
86,5.13c,8a+,10,30,11b,9-,Xa
87,5.13c,8a+,10,30,11b,9-,Xa
88,5.13d,8b,10+,31,11c,9,Xb
89,5.13d,8b,10+,31,11c,9,Xb
90,5.14a,8b+,10+/11-,32,11c,9+,Xc
91,5.14a,8b+,10+/11-,32,11c,9+,Xc
92,5.14b,8c,11-,33,12a,9+,XIa
93,5.14b,8c,11-,33,12a,9+,XIa
94,5.14c,8c+,11,34,12b,10-,XIb
95,5.14c,8c+,11,34,12b,10-,XIb
96,5.14d,9a,11,35,12c,10,XIc
97,5.14d,9a,11,35,12c,10,XIc
98,5.15a,9a+,11/11+,36,13a,10+,XIIa
99,5.15a,9a+,11/11+,36,13a,10+,XIIa
100,5.15b,9b,11+,37,13b,10+,XIIb
101,5.15b,9b,11+,37,13b,10+,XIIb
102,5.15c,9b+,11+/12-,38,13b,11-,XIIc
103,5.15c,9b+,11+/12-,38,13b,11-,XIIc
104,5.15d,9c,12-,39,13c,11,XIIIa
105,5.15d,9c,12-,39,13c,11,XIIIb
106,5.16a,9c+,12,40,13c,11+,XIIIc
107,5.16a,9c+,12,40,13c,11+,XIVa
score,yds,french,uiaa,ewbank,saxon,norwegian,brazilian_crux,polish
0,5.0,1a,1,1,1,1-,I,I
1,5.0,1a,1,1,1,1-,I,I
2,5.0,1a+,1,1,1,1-,I,I
3,5.0,1a+,1,1,1,1-,I,I
4,5.0,1b,1,1,1,1,I,I
5,5.0,1b,1,2,1,1,I,I
6,5.0,1b+,1,2,1,1+,I,I
7,5.0,1b+,1,2,1,1+,I,I
8,5.0,1c,1,2,1,1+,Isup,I
9,5.0,1c,1,2,1,1+,Isup,I
10,5.0,1c+,1,3,1,2-,Isup,I
11,5,1c+,1,4,1,2-,Isup,I
12,5.1,2a,2,5,2,2,Isup,II
13,5.1,2a,2,5,2,2,Isup,II
14,5.1,2a+,2,5,2,2,II,II
15,5.1,2a+,2,6,2,2,II,II
16,5.1,2b,2,6,2,2+,II,II
17,5.1,2b,2,6,2,2+,II,II
18,5.2,2b+,2,7,2,2+,II,II
19,5.2,2b+,2,7,2,2+,II,II
20,5.2,2c,2,7,2,3-,II,II
21,5.2,2c,2,7,2,3-,II,II
22,5.3,2c+,2,8,2,3,IIsup,II
23,5.3,2c+,2,8,2,3,IIsup,II
24,5.3,3a,3,9,3,3,IIsup,III
25,5.3,3a,3,9,3,3,IIsup,III
26,5.4,3a+,3,10,3,3+,IIsup,III
27,5.4,3a+,3,10,3,3+,IIsup,III
28,5.4,3b,3,10,3,3+,III,III
29,5.4,3b,3,10,3,3+,III,III
30,5.4,3b+,3,10,3,4-,III,III
31,5.5,3b+,3,11,3,4-,III,III
32,5.5,3c,3,11,3,4,III,III
33,5.5,3c,3,12,3,4,III,III
34,5.5,3c+,3,12,3,4,III,III
35,5.5,3c+,3,12,3,4,III,III
36,5.6,4a,4,13,4,4+,IIIsup,IV
37,5.6,4a,4,13,4,4+,IIIsup,IV
38,5.6,4a+,4+,13,4,4+,IIIsup,IV
39,5.6,4a+,4+,13,4,4+,IIIsup,IV
40,5.6,4b,4+,13,5,5-,IIIsup,IV
41,5.7,4b,4+,14,5,5-,IIIsup,IV
42,5.7,4b+,5-,14,5,5-,IV,IV
43,5.7,4b+,5-,14,5,5-,IV,IV
44,5.7,4c,5-,15,5,5,IV,IV+
45,5.7,4c,5-,15,5,5,IV,IV+
46,5.8,4c+,5,16,6,5,IV,IV+
47,5.8,4c+,5,16,6,5,IV,IV+
48,5.8,5a,5,16,7a,5+,IVsup,V-
49,5.8,5a,5,16,7a,5+,IVsup,V-
50,5.8,5a+,5+,16,7a,5+,IVsup,V-
51,5.8,5a+,5+,16,7a,5+,IVsup,V-
52,5.9,5b,5+,17,7a,5+,IVsup,V
53,5.9,5b,5+,17,7a,5+,IVsup,V
54,5.9,5b+,6-,17,7b,5+,IVsup,V
55,5.9,5b+,6-,17,7b,5+,IVsup,V
56,5.9,5c,6,17,7b,6-,V,V+
57,5.10a,5c,6,18,7b,6-,V,V+
58,5.10a,5c+,6+,18,7c,6-,V,VI-
59,5.10a,5c+,6+,18,7c,6-,V,VI-
60,5.10a,6a,6+,18,7c,6-,V,VI
61,5.10a,6a,6+,18,7c,6-,V,VI
62,5.10b,6a+,7-,19,8a,6,Vsup,VI+
63,5.10b,6a+,7-,19,8a,6,Vsup,VI+
64,5.10c,6b,7,20,8b,6,VI,VI.1
65,5.10c,6b,7,20,8b,6,VI,VI.1
66,5.10d,6b+,7+,20,8c,6+,VIsup,VI.1+
67,5.11a,6b+,7+,21,8c,6+,VIsup,VI.1+
68,5.11a,6c,7+/8-,21,9a,7-,VIIa,VI.2
69,5.11b,6c,7+/8-,22,9a,7-,VIIa,VI.2
70,5.11b,6c+,8-,22,9a,7,VIIb,VI.2+
71,5.11c,6c+,8-,23,9a,7,VIIb,VI.2+
72,5.11c,7a,8,23,9b,7+,VIIc,VI.3
73,5.11d,7a,8,23,9b,7+,VIIc,VI.3
74,5.11d,7a+,8+,24,9c,8-,VIIIa,VI.3+
75,5.12a,7a+,8+,24,9c,8-,VIIIa,VI.3+
76,5.12b,7b,8+/9-,25,10a,8-,VIIIb,VI.4
77,5.12b,7b,8+/9-,25,10a,8-,VIIIb,VI.4
78,5.12c,7b+,9-,26,10a,8,VIIIc,VI.4
79,5.12c,7b+,9-,26,10a,8,VIIIc,VI.4
80,5.12d,7c,9,27,10b,8+,IXa,VI.4+
81,5.12d,7c,9,27,10b,8+,IXa,VI.4+
82,5.13a,7c+,9+,28,10c,8+,IXb,VI.5
83,5.13a,7c+,9+,28,10c,8+,IXb,VI.5
84,5.13b,8a,10-,29,10c,9-,IXc,VI.5+
85,5.13b,8a,10-,29,10c,9-,IXc,VI.5+
86,5.13c,8a+,10,30,11b,9-,Xa,VI.5+
87,5.13c,8a+,10,30,11b,9-,Xa,VI.5+
88,5.13d,8b,10+,31,11c,9,Xb,VI.6
89,5.13d,8b,10+,31,11c,9,Xb,VI.6
90,5.14a,8b+,10+/11-,32,11c,9+,Xc,VI.6+
91,5.14a,8b+,10+/11-,32,11c,9+,Xc,VI.6+
92,5.14b,8c,11-,33,12a,9+,XIa,VI.7
93,5.14b,8c,11-,33,12a,9+,XIa,VI.7
94,5.14c,8c+,11,34,12b,10-,XIb,VI.7+
95,5.14c,8c+,11,34,12b,10-,XIb,VI.7+
96,5.14d,9a,11,35,12c,10,XIc,VI.8
97,5.14d,9a,11,35,12c,10,XIc,VI.8
98,5.15a,9a+,11/11+,36,13a,10+,XIIa,VI.8
99,5.15a,9a+,11/11+,36,13a,10+,XIIa,VI.8+
100,5.15b,9b,11+,37,13b,10+,XIIb,VI.8+
101,5.15b,9b,11+,37,13b,10+,XIIb,VI.9
102,5.15c,9b+,11+/12-,38,13b,11-,XIIc,VI.9
103,5.15c,9b+,11+/12-,38,13b,11-,XIIc,VI.9+
104,5.15d,9c,12-,39,13c,11,XIIIa,VI.9+
105,5.15d,9c,12-,39,13c,11,XIIIb,VI.9+
106,5.16a,9c+,12,40,13c,11+,XIIIc,VI.9+
107,5.16a,9c+,12,40,13c,11+,XIVa,VI.9+
Loading
Loading