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 {
|
Date struct {
|
||||||
MinuteGranularity int // Restricts the minutes on which office hours can start and end to multiples of it.
|
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 {
|
EarliestStartTime struct {
|
||||||
Hour int
|
Hour int
|
||||||
Minute 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)
|
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())
|
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) {
|
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)
|
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())
|
log.Println(err.Error())
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
},
|
},
|
||||||
"date": {
|
"date": {
|
||||||
"minuteGranularity": 5,
|
"minuteGranularity": 5,
|
||||||
"maxDuration": 120,
|
|
||||||
"earliestStartTime": {
|
"earliestStartTime": {
|
||||||
"hour" : 8,
|
"hour" : 8,
|
||||||
"minute" : 0
|
"minute" : 0
|
||||||
|
|
|
@ -16,7 +16,6 @@ type maskData struct {
|
||||||
Courses []models.Course
|
Courses []models.Course
|
||||||
Rooms []models.Room
|
Rooms []models.Room
|
||||||
MinuteGranularity int
|
MinuteGranularity int
|
||||||
MaxDuration int
|
|
||||||
EarliestStartTime struct {
|
EarliestStartTime struct {
|
||||||
Hour int
|
Hour int
|
||||||
Minute int
|
Minute int
|
||||||
|
@ -110,8 +109,8 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors = append(errors, "Die Dauer muss eine ganze Zahl sein.")
|
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) {
|
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 %d Minuten lang sein.", b.config.Date.MinuteGranularity, b.config.Date.MaxDuration))
|
errors = append(errors, fmt.Sprintf("Sprechstunden müssen zwischen %d und 120 Minuten lang sein.", b.config.Date.MinuteGranularity))
|
||||||
}
|
}
|
||||||
|
|
||||||
roomname := req.FormValue("raumname")
|
roomname := req.FormValue("raumname")
|
||||||
|
@ -145,7 +144,6 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
||||||
courses,
|
courses,
|
||||||
rooms,
|
rooms,
|
||||||
b.config.Date.MinuteGranularity,
|
b.config.Date.MinuteGranularity,
|
||||||
b.config.Date.MaxDuration,
|
|
||||||
b.config.Date.EarliestStartTime,
|
b.config.Date.EarliestStartTime,
|
||||||
b.config.Date.LatestStartTime,
|
b.config.Date.LatestStartTime,
|
||||||
courseid,
|
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>")
|
return template.HTML("<p class=\"text-center\">Aktuell sind keine passenden Sprechstunden eingetragen.</p>")
|
||||||
}
|
}
|
||||||
var tableBody string
|
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 {
|
for minute := 0; minute < 60; minute += b.config.Date.MinuteGranularity {
|
||||||
tableBody += "<tr>"
|
tableBody += "<tr>"
|
||||||
if minute == 0 {
|
if minute == 0 {
|
||||||
|
|
|
@ -15,7 +15,6 @@ INSERT INTO `course` (name) VALUES
|
||||||
('Analysis I'),
|
('Analysis I'),
|
||||||
('Analysis II (engl.)'),
|
('Analysis II (engl.)'),
|
||||||
('Analysis II'),
|
('Analysis II'),
|
||||||
('Applied Proof Theory'),
|
|
||||||
('Aussagen- und Prädikatenlogik'),
|
('Aussagen- und Prädikatenlogik'),
|
||||||
('Automaten, Formale Sprachen und Entscheidbarkeit'),
|
('Automaten, Formale Sprachen und Entscheidbarkeit'),
|
||||||
('Banach- und C*-Algebren'),
|
('Banach- und C*-Algebren'),
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
<div class="form-floating mb-3">
|
||||||
<input class="form-control required" required name="dauer" id="dauer" type="number"
|
<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="">
|
{{ if ne .Duration 0}}value="{{.Duration}}"{{end}} placeholder="">
|
||||||
<label for="dauer">Dauer in Minuten</label>
|
<label for="dauer">Dauer in Minuten</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue