Skip to content

Commit

Permalink
Replace allowableConversionType with conversionGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Agilulfo committed Oct 7, 2024
1 parent c3f644e commit fa261e0
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/GradeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export const convertGrade = (
if (fromScale === null || toScale === null) {
return ''
}
const checkScaleToConvert: boolean = fromScale.allowableConversionType.includes(toGradeScaleType)
if (!checkScaleToConvert) {
const sameConversionGroup: boolean = fromScale.conversionGroup === toScale.conversionGroup
if (!sameConversionGroup) {
console.warn(
`Scale: ${fromScale.displayName} doesn't support converting to Scale: ${toScale.displayName}`
)
Expand Down
2 changes: 1 addition & 1 deletion src/GradeScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default interface GradeScale {
displayName: string
name: GradeScalesTypes
offset: number
allowableConversionType: GradeScalesTypes[]
conversionGroup: string
grades?: string[]
}

Expand Down
2 changes: 1 addition & 1 deletion src/scales/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AIScale: GradeScale = {
displayName: 'AI Grade',
name: GradeScales.AI,
offset: 1000,
allowableConversionType: [GradeScales.WI],
conversionGroup: 'Ice',
isType: (grade: string): boolean => {
if (isAI(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/aid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const AidScale: GradeScale = {
displayName: 'Aid Grade',
name: GradeScales.AID,
offset: 1000,
allowableConversionType: [],
conversionGroup: 'Aid',
isType: (grade: string): boolean => {
if (isAid(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/brazilian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const BrazilianCrux: GradeScale = {
displayName: 'Brazilian Crux Scale',
name: GradeScales.BRAZILIAN_CRUX,
offset: 1000,
allowableConversionType: [GradeScales.YDS, GradeScales.SAXON, GradeScales.EWBANK, GradeScales.FRENCH, GradeScales.NORWEGIAN],
conversionGroup: 'Free',
isType: (grade: string): boolean => isBrazilianCrux(grade) !== null,
getScore,
getGrade: (score: number | Tuple): string => {
Expand Down
2 changes: 1 addition & 1 deletion src/scales/ewbank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const EwbankScale: GradeScale = {
displayName: 'Ewbank Grade',
name: GradeScales.EWBANK,
offset: 1000,
allowableConversionType: [GradeScales.YDS, GradeScales.FRENCH, GradeScales.SAXON],
conversionGroup: 'Free',
isType: (grade: string): boolean => {
if (isEwbank(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const FontScale: GradeScale = {
displayName: 'Fontainebleau',
name: GradeScales.FONT,
offset: 1000,
allowableConversionType: [GradeScales.VSCALE],
conversionGroup: 'Bouldering',
isType: (grade: string): boolean => {
if (isFont(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/french.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const FrenchScale: GradeScale = {
displayName: 'French Scale',
name: GradeScales.FRENCH,
offset: 1000,
allowableConversionType: [GradeScales.YDS, GradeScales.EWBANK, GradeScales.SAXON],
conversionGroup: 'Free',
isType: (grade: string): boolean => {
if (isFrench(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/norwegian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Norwegian: GradeScale = {
displayName: 'Norwegian Scale',
name: GradeScales.NORWEGIAN,
offset: 1000,
allowableConversionType: [],
conversionGroup: 'Free',
isType: (grade: string): boolean => {
if (isNorwegian(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/saxon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const SaxonScale: GradeScale = {
displayName: 'Saxon Scale',
name: GradeScales.SAXON,
offset: 1000,
allowableConversionType: [GradeScales.YDS, GradeScales.EWBANK, GradeScales.FRENCH],
conversionGroup: 'Free',
isType: (grade: string): boolean => {
if (isSaxon(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/uiaa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const UIAAScale: GradeScale = {
displayName: 'UIAA Scale',
name: GradeScales.UIAA,
offset: 2000,
allowableConversionType: [GradeScales.YDS, GradeScales.SAXON, GradeScales.EWBANK, GradeScales.FRENCH],
conversionGroup: 'Free',
isType: (grade: string): boolean => {
if (isUIAA(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/v.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const VScale: GradeScale = {
displayName: 'V Scale',
name: GradeScales.VSCALE,
offset: 1000,
allowableConversionType: [GradeScales.FONT],
conversionGroup: 'Bouldering',
isType: (grade: string): boolean => {
const isVGrade = grade.match(vGradeRegex)
// If there isn't a match sort it to the bottom
Expand Down
2 changes: 1 addition & 1 deletion src/scales/wi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const WIScale: GradeScale = {
displayName: 'WI Grade',
name: GradeScales.WI,
offset: 1000,
allowableConversionType: [GradeScales.AI],
conversionGroup: 'Ice',
isType: (grade: string): boolean => {
if (isWI(grade) === null) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/scales/yds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const YosemiteDecimal: GradeScale = {
displayName: 'Yosemite Decimal System',
name: GradeScales.YDS,
offset: 1000,
allowableConversionType: [GradeScales.FRENCH, GradeScales.EWBANK, GradeScales.SAXON],
conversionGroup: 'Free',
isType: (grade: string): boolean => {
if (isYds(grade) === null) {
return false
Expand Down

0 comments on commit fa261e0

Please sign in to comment.