OpenBeta / sandbag

JS utilities for working with climbing grades
MIT License
24 stars 17 forks source link

Support getting scale from grade string #136

Open vnugent opened 1 year ago

vnugent commented 1 year ago

While building graphs and charts https://github.com/OpenBeta/open-tick-list/issues/9 I have a constant need to call getScore() to convert grade in string format (Ex:v4or5.8`) to numeric values for sorting and plotting them on the y-axes. However, since we don't store grade context with tick data, it makes building graphs difficult.

Proposal:


const score = getScale('v3').getScore()

const scale = getScale('6a') // we have a problem here. Is it FR or FONT?

Duplicated https://github.com/OpenBeta/sandbag/issues/94

*Edit: Perhaps we should store grade context when recording ticks. Similarly when we measure distance we have to include the unit, 2km vs 2miles

musoke commented 1 year ago
const scale = getScale('6a') // we have a problem here. Is it FR or FONT?

Perhaps we should store grade context when recording ticks. Similarly when we measure distance we have to include the unit, 2km vs 2miles

Not just the context, the discipline would also be needed for your example.

That example shouldn't be an issue though: the convention is that 6a is French sport and 6A is Font (see #107). It's still possible to confuse it with British technical though.