Compare commits
No commits in common. "5a8a248c530bb2ade3278784fe1f8585f39d285e" and "e32d5023aa0b8e5fc73cc248273cfe1340cd1976" have entirely different histories.
5a8a248c53
...
e32d5023aa
6 changed files with 4 additions and 13 deletions
|
@ -24,7 +24,6 @@ type Config struct {
|
|||
}
|
||||
Date struct {
|
||||
MinuteGranularity int // Restricts the minutes on which office hours can start and end to multiples of it.
|
||||
MaxDuration int // Limits the length of office hours to minutes
|
||||
EarliestStartTime struct {
|
||||
Hour int
|
||||
Minute int
|
||||
|
@ -104,10 +103,6 @@ func validateConfig(conf *Config) error {
|
|||
err = fmt.Errorf("Validating config: Earliest start time minute must be between 0 and 60, but is %d.", conf.Date.EarliestStartTime.Minute)
|
||||
log.Println(err.Error())
|
||||
}
|
||||
if !(conf.Date.MaxDuration >= conf.Date.MinuteGranularity && conf.Date.MaxDuration <= 4*60) {
|
||||
err = fmt.Errorf("Validating config: Maximum duration must be between %d minute and 4 hours, but is %d.", conf.Date.MinuteGranularity, conf.Date.MaxDuration)
|
||||
log.Println(err.Error())
|
||||
}
|
||||
if !(conf.Date.LatestStartTime.Hour >= 0 && conf.Date.LatestStartTime.Hour <= 23) {
|
||||
err = fmt.Errorf("Validating config: Latest start time hour must be between 0 and 23, but is %d.", conf.Date.LatestStartTime.Hour)
|
||||
log.Println(err.Error())
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
},
|
||||
"date": {
|
||||
"minuteGranularity": 5,
|
||||
"maxDuration": 120,
|
||||
"earliestStartTime": {
|
||||
"hour" : 8,
|
||||
"minute" : 0
|
||||
|
|
|
@ -16,7 +16,6 @@ type maskData struct {
|
|||
Courses []models.Course
|
||||
Rooms []models.Room
|
||||
MinuteGranularity int
|
||||
MaxDuration int
|
||||
EarliestStartTime struct {
|
||||
Hour int
|
||||
Minute int
|
||||
|
@ -110,8 +109,8 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
if err != nil {
|
||||
errors = append(errors, "Die Dauer muss eine ganze Zahl sein.")
|
||||
}
|
||||
if !(duration >= b.config.Date.MinuteGranularity && duration <= b.config.Date.MaxDuration && duration%b.config.Date.MinuteGranularity == 0) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen zwischen %d und %d Minuten lang sein.", b.config.Date.MinuteGranularity, b.config.Date.MaxDuration))
|
||||
if !(duration >= b.config.Date.MinuteGranularity && duration <= 120 && duration%b.config.Date.MinuteGranularity == 0) {
|
||||
errors = append(errors, fmt.Sprintf("Sprechstunden müssen zwischen %d und 120 Minuten lang sein.", b.config.Date.MinuteGranularity))
|
||||
}
|
||||
|
||||
roomname := req.FormValue("raumname")
|
||||
|
@ -145,7 +144,6 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
courses,
|
||||
rooms,
|
||||
b.config.Date.MinuteGranularity,
|
||||
b.config.Date.MaxDuration,
|
||||
b.config.Date.EarliestStartTime,
|
||||
b.config.Date.LatestStartTime,
|
||||
courseid,
|
||||
|
|
|
@ -51,7 +51,7 @@ func (b *BaseHandler) printTimetable(timetable map[models.Date]map[int]models.Of
|
|||
return template.HTML("<p class=\"text-center\">Aktuell sind keine passenden Sprechstunden eingetragen.</p>")
|
||||
}
|
||||
var tableBody string
|
||||
for hour := b.config.Date.EarliestStartTime.Hour; hour < b.config.Date.LatestStartTime.Hour+b.config.Date.MaxDuration/60; hour += 1 {
|
||||
for hour := 8; hour < 19; hour += 1 {
|
||||
for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity {
|
||||
tableBody += "<tr>"
|
||||
if minute == 0 {
|
||||
|
|
|
@ -15,7 +15,6 @@ INSERT INTO `course` (name) VALUES
|
|||
('Analysis I'),
|
||||
('Analysis II (engl.)'),
|
||||
('Analysis II'),
|
||||
('Applied Proof Theory'),
|
||||
('Aussagen- und Prädikatenlogik'),
|
||||
('Automaten, Formale Sprachen und Entscheidbarkeit'),
|
||||
('Banach- und C*-Algebren'),
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control required" required name="dauer" id="dauer" type="number"
|
||||
min="{{.MinuteGranularity}}" max="{{.MaxDuration}}" step="{{.MinuteGranularity}}"
|
||||
min="{{.MinuteGranularity}}" max="120" step="{{.MinuteGranularity}}"
|
||||
{{ if ne .Duration 0}}value="{{.Duration}}"{{end}} placeholder="">
|
||||
<label for="dauer">Dauer in Minuten</label>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue