@@ -17,6 +17,7 @@ import (
17
17
"github.com/chrischdi/gotournament/pkg/matchday"
18
18
"github.com/chrischdi/gotournament/pkg/schedule"
19
19
"github.com/chrischdi/gotournament/pkg/team"
20
+ "github.com/chrischdi/gotournament/tpl"
20
21
)
21
22
22
23
func registerHandlers () {
@@ -62,7 +63,7 @@ func setup(w http.ResponseWriter, r *http.Request) {
62
63
63
64
fmt .Fprintf (w , "<h2>Time</h2>\n " )
64
65
t = template .New ("timeSetup" )
65
- t , err = template .ParseFiles ( filepath . Join ( " tpl" , "timeSetup.tmpl" ) )
66
+ t , err = template .ParseFS ( tpl . Content , "timeSetup.tmpl" )
66
67
if err != nil {
67
68
fmt .Fprintf (os .Stderr , "error: %v\n " , err )
68
69
}
@@ -71,13 +72,14 @@ func setup(w http.ResponseWriter, r *http.Request) {
71
72
"Start" : fmt .Sprintf ("%02d:%02d" , config .ConfigData .Start .Hour (), config .ConfigData .Start .Minute ()),
72
73
"Duration" : config .ConfigData .GameDuration .Minutes (),
73
74
"Pause" : config .ConfigData .KOPause .Minutes (),
75
+ "NrPlaces" : len (config .ConfigData .Places ),
74
76
})
75
77
76
78
writeTemplate (w , "modifyGroups.tmpl" , data .GetData ())
77
79
78
80
fmt .Fprintf (w , "<h2>Add Groups</h2>\n " )
79
81
t = template .New ("addGroup" )
80
- t , err = template .ParseFiles ( filepath . Join ( " tpl" , "addGroup.tmpl" ) )
82
+ t , err = template .ParseFS ( tpl . Content , "addGroup.tmpl" )
81
83
if err != nil {
82
84
fmt .Fprintf (os .Stderr , "error: %v\n " , err )
83
85
}
@@ -253,7 +255,13 @@ func setupUpdate(w http.ResponseWriter, r *http.Request) error {
253
255
data .SaveFile ()
254
256
// Tournament().UpdateTime(starth, startm, duration, pause)
255
257
// Tournament().UpdateKOTime()
256
-
258
+ case "places" :
259
+ nrPlaces , err := strconv .Atoi (r .FormValue ("nrplaces" ))
260
+ if err != nil {
261
+ return fmt .Errorf ("error updating time: %v" , err )
262
+ }
263
+ config .UpdatePlaces (nrPlaces )
264
+ schedule .CalculateGroupSchedule ()
257
265
case "group" :
258
266
for _ , v := range strings .Split (r .FormValue ("uuids" ), "," ) {
259
267
err := team .UpdateTeamName (v , r .FormValue (v ))
0 commit comments