Skip to content

Commit a849323

Browse files
glassbead0vnugent
authored andcommitted
feat: add Repeat option for ticks
1 parent 97036cc commit a849323

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

documentation/tick_logic.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Here are all the possible values for `Climb.type` (also called discipline), as d
2727
| snow | Aid | Send |
2828
| ice | Boulder | Attempt |
2929
| aid | | Frenchfree |
30-
| tr | | |
30+
| tr | | Repeat |
3131
| alpine | | |
3232
| mixed | | |
3333

@@ -55,10 +55,10 @@ Since a route can have multiple disciplines, these options are composable. eg: a
5555

5656
| Tick Style | Attempt Type options |
5757
|------------|----------------------|
58-
| 'Lead' | 'Onsight', 'Flash', 'Redpoint', 'Pinkpoint', 'Attempt', 'Frenchfree' |
58+
| 'Lead' | 'Onsight', 'Flash', 'Redpoint', 'Pinkpoint', 'Attempt', 'Frenchfree', 'Repeat' |
5959
| 'Follow', 'TR' or 'Aid | 'Send', 'Attempt' |
60-
| 'Solo' | 'Onsight', 'Flash', 'Redpoint', 'Attempt' |
61-
| 'Boulder' | 'Flash', 'Send', 'Attempt' |
60+
| 'Solo' | 'Onsight', 'Flash', 'Redpoint', 'Attempt', 'Repeat' |
61+
| 'Boulder' | 'Flash', 'Send', 'Attempt', 'Repeat' |
6262

6363
## A few justifications
6464

@@ -68,6 +68,7 @@ Since a route can have multiple disciplines, these options are composable. eg: a
6868
* While 'Frenchfree' and 'Aid' could be considered synomonous, some climbers may want to distinguish, for example, a multipitch route where one pitch was intentionally 'French freed' (Time Wave Zero being a common example), which is distinctly different in character than, eg: aiding the Nose on El Cap.
6969
* Eventually, it might be cool to allow ticks for individual pitches, but that is not supported right now.
7070
* Given the 43,008 possible combinations, no simple logical system will perfectly capture every edge case.
71+
* Repeats: routes can be "repeated" after they are sent. this generally only applies if you have previously sent a route or boulder cleanly, and you send the route/boulder again cleanly. This is not typically used, for example, to mark additional attempts on a route that you haven't cleanly sent yet (one would use "attempt" for that). The only `Tick Style`s, for which `Repeat` is not allowed is `Follow` `TR` and `Aid`. While aid routes may be repeated, this is a rare enough use case and simplifies the logic in the code.
7172

7273

7374
## Importing from Mountain Project

src/db/TickSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const TickSchema = new Schema<TickType>({
1717
climbId: { type: Schema.Types.String, required: true, index: true },
1818
userId: { type: Schema.Types.String, required: true, index: true },
1919
style: { type: Schema.Types.String, enum: ['Lead', 'Solo', 'TR', 'Follow', 'Aid', 'Boulder'], required: false },
20-
attemptType: { type: Schema.Types.String, enum: ['Onsight', 'Flash', 'Pinkpoint', 'Frenchfree', 'Redpoint', 'Send', 'Attempt'], required: false, index: true },
20+
attemptType: { type: Schema.Types.String, enum: ['Onsight', 'Flash', 'Pinkpoint', 'Frenchfree', 'Redpoint', 'Send', 'Attempt', 'Repeat'], required: false, index: true },
2121
dateClimbed: { type: Schema.Types.Date },
2222
grade: { type: Schema.Types.String, required: false, index: true },
2323
// Bear in mind that these enum types must be kept in sync with the TickSource enum

src/db/TickTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export type TickSource =
1717
'MP'
1818

1919
export type TickStyle = 'Lead' | 'Solo' | 'TR' | 'Follow' | 'Aid' | 'Boulder'
20-
export type TickAttemptType = 'Onsight' | 'Flash' | 'Pinkpoint' | 'Frenchfree' | 'Send' | 'Attempt' | 'Redpoint'
20+
export type TickAttemptType = 'Onsight' | 'Flash' | 'Pinkpoint' | 'Frenchfree' | 'Send' | 'Attempt' | 'Redpoint' | 'Repeat'
2121

2222
export const TickSourceValues: TickSource[] = ['OB', 'MP']
2323
export const TickStyleValues: TickStyle[] = ['Lead', 'Solo', 'TR', 'Follow', 'Aid', 'Boulder']
24-
export const TickAttemptTypeValues: TickAttemptType[] = ['Onsight', 'Flash', 'Pinkpoint', 'Frenchfree', 'Send', 'Attempt', 'Redpoint']
24+
export const TickAttemptTypeValues: TickAttemptType[] = ['Onsight', 'Flash', 'Pinkpoint', 'Frenchfree', 'Send', 'Attempt', 'Redpoint', 'Repeat']
2525

2626
/** Ticks
2727
* Ticks represent log entries for a user's climbing activity. They contain

src/graphql/schema/Tick.gql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ enum TickAttemptType {
136136
Send
137137
"Redpoint"
138138
Redpoint
139+
"Repeat"
140+
Repeat
139141
}
140142

141143
enum TickStyle {

src/model/TickDataSource.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ export default class TickDataSource extends MongoDataSource<TickType> {
118118
// validate attempt type for each tick style
119119
switch (tickStyle) {
120120
case 'Lead':
121-
if (!['Onsight', 'Flash', 'Redpoint', 'Pinkpoint', 'Attempt', 'Frenchfree', 'null'].includes(attemptType)) {
121+
if (!['Onsight', 'Flash', 'Redpoint', 'Pinkpoint', 'Attempt', 'Frenchfree', 'Repeat', 'null'].includes(attemptType)) {
122122
throw new Error(`Invalid attempt type ${attemptType} for Lead style`)
123123
}
124124
break
125125
case 'Solo':
126-
if (!['Onsight', 'Flash', 'Redpoint', 'Attempt', 'null'].includes(attemptType)) {
126+
if (!['Onsight', 'Flash', 'Redpoint', 'Attempt', 'Repeat', 'null'].includes(attemptType)) {
127127
throw new Error(`Invalid attempt type ${attemptType} for Solo style`)
128128
}
129129
break
130130
case 'Boulder':
131-
if (!['Flash', 'Send', 'Attempt', 'null'].includes(attemptType)) {
131+
if (!['Flash', 'Send', 'Attempt', 'Repeat', 'null'].includes(attemptType)) {
132132
throw new Error(`Invalid attempt type ${attemptType} for Boulder style`)
133133
}
134134
break

0 commit comments

Comments
 (0)