We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a88b3f1 commit c1fac10Copy full SHA for c1fac10
workspace/exercise_metadata.go
@@ -87,3 +87,23 @@ func (em *ExerciseMetadata) PathToParent() string {
87
}
88
return filepath.Join(dir, em.Track)
89
90
+
91
+// Exercise is an implementation of a problem on disk.
92
+func (em *ExerciseMetadata) Exercise(workspace string) Exercise {
93
+ return Exercise{
94
+ Root: em.root(workspace),
95
+ Track: em.Track,
96
+ Slug: em.ExerciseSlug,
97
+ }
98
+}
99
100
+// root represents the root of the exercise.
101
+func (em *ExerciseMetadata) root(workspace string) string {
102
+ if em.Team != "" {
103
+ return filepath.Join(workspace, "teams", em.Team)
104
105
+ if !em.IsRequester {
106
+ return filepath.Join(workspace, "users", em.Handle)
107
108
+ return workspace
109
0 commit comments