Skip to content

Commit 7c8f366

Browse files
authored
Merge pull request #25 from ThreeDotsLabs/skip
tdl training skip
2 parents 0ae1769 + f1f33c3 commit 7c8f366

File tree

10 files changed

+607
-166
lines changed

10 files changed

+607
-166
lines changed

tdl/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ Note: after completing this exercise, the next exercise will be the last one you
270270
return handlers.Jump(c.Context, exerciseID)
271271
},
272272
},
273+
{
274+
Name: "skip",
275+
Usage: "Skip the current exercise and the rest of the module (only selected modules)",
276+
ArgsUsage: "",
277+
Action: func(c *cli.Context) error {
278+
return newHandlers(c).Skip(c.Context)
279+
},
280+
},
273281
},
274282
},
275283
{

trainings/api/protobuf/server.proto

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ service Trainings {
1717

1818
rpc GetExercises(GetExercisesRequest) returns (GetExercisesResponse) {};
1919
rpc GetExercise(GetExerciseRequest) returns (NextExerciseResponse) {};
20+
21+
rpc SkipExercise(SkipExerciseRequest) returns (SkipExerciseResponse) {};
2022
}
2123

2224
message InitRequest {
@@ -63,6 +65,20 @@ message NextExerciseResponse {
6365
repeated File files_to_create = 3;
6466

6567
bool is_text_only = 5;
68+
bool is_optional = 6;
69+
70+
message Module {
71+
string id = 1;
72+
string name = 2;
73+
}
74+
75+
message Exercise {
76+
string id = 1;
77+
Module module = 2;
78+
string name = 3;
79+
}
80+
81+
Exercise exercise = 7;
6682
}
6783

6884
message NextExercise {
@@ -124,6 +140,7 @@ message GetExercisesResponse {
124140
message Exercise {
125141
string id = 1;
126142
string name = 2;
143+
bool is_skipped = 3;
127144
}
128145

129146
repeated Module modules = 1;
@@ -134,3 +151,11 @@ message GetExerciseRequest {
134151
string token = 2;
135152
string exercise_id = 3;
136153
}
154+
155+
message SkipExerciseRequest {
156+
string training_name = 1;
157+
string exercise_id = 2;
158+
string token = 3;
159+
}
160+
161+
message SkipExerciseResponse {}

trainings/config/exercise.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type ExerciseConfig struct {
1313
ExerciseID string `toml:"exercise_id"`
1414
Directory string `toml:"directory"`
1515
IsTextOnly bool `toml:"is_text_only"`
16+
IsOptional bool `toml:"is_optional"`
1617
}
1718

1819
func (c Config) WriteExerciseConfig(trainingRootFs afero.Fs, cfg ExerciseConfig) error {

0 commit comments

Comments
 (0)