diff --git a/package.json b/package.json index 6c207e600..208411e61 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@heroicons/react": "2.0.13", "@lexical/react": "^0.7.5", "@math.gl/web-mercator": "3.6.2", - "@openbeta/sandbag": "^0.0.33", + "@openbeta/sandbag": "^0.0.45", "@radix-ui/react-alert-dialog": "^1.0.0", "@radix-ui/react-dialog": "^1.0.0", "@radix-ui/react-dropdown-menu": "^2.0.1", diff --git a/src/js/grades/Grade.ts b/src/js/grades/Grade.ts index 510cb5381..fb86b476e 100644 --- a/src/js/grades/Grade.ts +++ b/src/js/grades/Grade.ts @@ -24,6 +24,18 @@ const gradeContextToGradeScales = { aid: GradeScales.FRENCH, snow: GradeScales.FRENCH, // is this the same as alpine? ice: GradeScales.FRENCH // is this the same as alpine? + }, + AU: { + trad: GradeScales.EWBANK, + sport: GradeScales.EWBANK, + bouldering: GradeScales.VSCALE, + tr: GradeScales.EWBANK, + deepwatersolo: GradeScales.EWBANK, + alpine: GradeScales.YDS, + mixed: GradeScales.YDS, + aid: GradeScales.AID, + snow: GradeScales.YDS, // is this the same as alpine? + ice: GradeScales.WI } } @@ -79,7 +91,7 @@ export default class Grade { const isValidGrade = (userInput: string): string | undefined => { if (userInput == null || userInput === '') return undefined const score = getScale(this.gradescales.bouldering)?.getScore(userInput) ?? -1 - return score >= 0 || Array.isArray(score) ? undefined : 'Invalid grade' + return Array.isArray(score) || score >= 0 ? undefined : 'Invalid grade' } return { validate: { @@ -92,7 +104,7 @@ export default class Grade { const isValidGrade = (userInput: string): string | undefined => { if (userInput == null || userInput === '') return undefined // possible to have unknown grade (Ex: route under development) const score = getScale(this.gradescales[discipline])?.getScore(userInput) ?? -1 - return score >= 0 || Array.isArray(score) ? undefined : 'Invalid grade' + return Array.isArray(score) || score >= 0 ? undefined : 'Invalid grade' } return { validate: { @@ -125,7 +137,7 @@ export class GradeHelper { if (userInput == null || userInput === '') return 'Missing grade' const _d = discipline == null && this.isBoulder ? 'bouldering' : 'trad' const score = getScale(this.gradeScales[_d])?.getScore(userInput) ?? -1 - return score >= 0 || Array.isArray(score) ? undefined : 'Invalid grade' + return Array.isArray(score) || score >= 0 ? undefined : 'Invalid grade' } return { validate: { diff --git a/yarn.lock b/yarn.lock index de90183be..a6a46045d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1882,10 +1882,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@openbeta/sandbag@^0.0.33": - version "0.0.33" - resolved "https://registry.yarnpkg.com/@openbeta/sandbag/-/sandbag-0.0.33.tgz#bb771d94c5a3fc2c9d9e7fcad7e85e6809b89d0e" - integrity sha512-YACAVdBU2bn0A7XIilw22yieS/QrAHqmIpiDWHJr/lAw4M3hEDq956SEfw/H0pwukTLy8A6z9K/o4uD84t4OiA== +"@openbeta/sandbag@^0.0.45": + version "0.0.45" + resolved "https://registry.yarnpkg.com/@openbeta/sandbag/-/sandbag-0.0.45.tgz#b6230ddf63f265b91d0a0359a2f87c5359dded74" + integrity sha512-8s2YFeUBU3lK2EzQIZSsf/apEIaxhtHJNfWWDmtjIE7/wlgqm84BSX72wur1FGrqcI9o3P1dkZmevHnu0ItGZQ== "@panva/hkdf@^1.0.2": version "1.1.1"