30 lines
427 B
Go
30 lines
427 B
Go
package main
|
|
|
|
func AssignExtraRooms(rooms []RoomFolder, roomsPerNight int) {
|
|
latestnight := 0
|
|
|
|
for _, r := range rooms {
|
|
if r.cfg.night > latestnight {
|
|
latestnight = r.cfg.night
|
|
}
|
|
}
|
|
|
|
night := latestnight + 1
|
|
room := 1
|
|
|
|
for i, r := range rooms {
|
|
if r.cfg.night > 0 {
|
|
continue
|
|
}
|
|
|
|
rooms[i].cfg.night = night
|
|
rooms[i].cfg.room = room
|
|
|
|
room++
|
|
if room > roomsPerNight {
|
|
room = 1
|
|
night++
|
|
}
|
|
}
|
|
}
|