Skip to content

Commit

Permalink
assign 'unkown' as default grade band;remove link to google sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
actuallyyun committed May 26, 2023
1 parent 459aa7f commit 1ddc78a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/data/csvtojson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// to run `ts-node ./csvtojson.ts`
// Source sheet: https://docs.google.com/spreadsheets/d/1c0cZDNnj77UqXfJzvSE1MlwtTxmueqdlXG_RpcSzvqU/edit?usp=sharing

import csv from 'csv-parser'
import * as fs from 'fs'
Expand All @@ -8,6 +7,9 @@ import { Boulder, Route, IceGrade } from '../scales'
const boulderGrades: Boulder[] = []
const routeGrades: Route[] = []

/* Use 'unknown' for default band property as grade band is assigned in each individual grade scale.
*/

fs.createReadStream('./boulder.csv')
.pipe(csv())
.on('data', (data) => {
Expand All @@ -18,7 +20,7 @@ fs.createReadStream('./boulder.csv')
score: parseInt(data.Score, 10),
v: data['V Scale'],
font: data['Font Scale'],
band: data['Level Bands']
band: 'unknown'
})
})
.on('end', () => {
Expand All @@ -43,16 +45,16 @@ fs.createReadStream('./routes.csv')
uiaa: data.UIAA,
ewbank: data.Ewbank,
saxon: data.Saxon,
band: data['Level Bands']
band: 'unknown'
})
})
.on('end', () => {
const data = JSON.stringify(routeGrades)
fs.writeFileSync('routes.json', data)
// [
// { score: 26, yds: '5.10a', french: '3a+',saxon: '3', band: 'beginner' },
// { score: 27, yds: '5.10a', french: '3b',saxon: '3', band: 'beginner' },
// ]
// [
// { score: 26, yds: '5.10a', french: '3a+',saxon: '3', band: 'beginner' },
// { score: 27, yds: '5.10a', french: '3b',saxon: '3', band: 'beginner' },
// ]
})

const iceGrades: IceGrade[] = []
Expand Down

0 comments on commit 1ddc78a

Please sign in to comment.