@@ -48,20 +48,21 @@ func GetAssignmentConfig(course, assignment string, onlyForStudentsOrGroups ...s
4848 }
4949
5050 assignmentConfig := & AssignmentConfig {
51- Course : course ,
52- Name : assignment ,
53- Path : path ,
54- URL : url ,
55- Per : per ,
56- Description : description (assignmentKey ),
57- ContainerRegistry : containerRegistry ,
58- AccessLevel : accessLevel (assignmentKey ),
59- Students : students (per , course , assignment , onlyForStudentsOrGroups ... ),
60- Groups : groups (per , course , assignment , onlyForStudentsOrGroups ... ),
61- Startercode : startercode (assignmentKey ),
62- Clone : clone (assignmentKey ),
63- Release : release ,
64- Seeder : seeder (assignmentKey ),
51+ Course : course ,
52+ Name : assignment ,
53+ UseCoursenameAsPrefix : viper .GetBool (course + ".useCoursenameAsPrefix" ),
54+ Path : path ,
55+ URL : url ,
56+ Per : per ,
57+ Description : description (assignmentKey ),
58+ ContainerRegistry : containerRegistry ,
59+ AccessLevel : accessLevel (assignmentKey ),
60+ Students : students (per , course , assignment , onlyForStudentsOrGroups ... ),
61+ Groups : groups (per , course , assignment , onlyForStudentsOrGroups ... ),
62+ Startercode : startercode (assignmentKey ),
63+ Clone : clone (assignmentKey ),
64+ Release : release ,
65+ Seeder : seeder (assignmentKey ),
6566 }
6667
6768 return assignmentConfig
@@ -83,6 +84,26 @@ func (cfg *AssignmentConfig) RepoSuffix(student *Student) string {
8384 return ""
8485}
8586
87+ func (cfg * AssignmentConfig ) RepoBaseName () string {
88+ if cfg .UseCoursenameAsPrefix {
89+ return fmt .Sprintf ("%s-%s" , cfg .Course , cfg .Name )
90+ }
91+
92+ return cfg .Name
93+ }
94+
95+ func (cfg * AssignmentConfig ) RepoNameWithSuffix (suffix string ) string {
96+ return fmt .Sprintf ("%s-%s" , cfg .RepoBaseName (), suffix )
97+ }
98+
99+ func (cfg * AssignmentConfig ) RepoNameForStudent (student * Student ) string {
100+ return cfg .RepoNameWithSuffix (cfg .RepoSuffix (student ))
101+ }
102+
103+ func (cfg * AssignmentConfig ) RepoNameForGroup (group * Group ) string {
104+ return cfg .RepoNameWithSuffix (group .Name )
105+ }
106+
86107func assignmentPath (course , assignment string ) string {
87108 path := viper .GetString (course + ".coursepath" )
88109 if semesterpath := viper .GetString (course + ".semesterpath" ); len (semesterpath ) > 0 {
0 commit comments