Compare commits
2 commits
6a60d11f1e
...
12a5080659
Author | SHA1 | Date | |
---|---|---|---|
12a5080659 | |||
ae3f261047 |
4 changed files with 7 additions and 5 deletions
|
@ -59,10 +59,10 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
//Parse date
|
||||
week, err := strconv.Atoi(req.FormValue("woche"))
|
||||
if err != nil {
|
||||
errors = append(errors, "Die Woche muss eine ganze Zahl sein.")
|
||||
errors = append(errors, "Die Vorlesungswoche muss eine ganze Zahl sein.")
|
||||
}
|
||||
if !(week >= 0 && week <= 2) {
|
||||
errors = append(errors, "Sprechstunden müssen jede, jede gerade oder jede ungerade Woche stattfinden.")
|
||||
errors = append(errors, "Sprechstunden müssen jede, jede gerade oder jede ungerade Vorlesungswoche stattfinden.")
|
||||
}
|
||||
day, err := strconv.Atoi(req.FormValue("tag"))
|
||||
if err != nil {
|
||||
|
|
|
@ -240,7 +240,9 @@ func (r *OfficeHourRepo) NumberByTimeSpanAndRoom(date models.Date, duration int,
|
|||
for _, officeHour := range officeHours {
|
||||
// increase count if officehour starts before this point in time and ends later
|
||||
if models.DateLess(officeHour.Date, models.GetEndDate(date, minute, false)) && models.DateLess(models.GetEndDate(date, minute, false), models.GetEndDate(officeHour.Date, officeHour.Duration, false)) {
|
||||
minuteCount += 1
|
||||
if date.Week == 0 || officeHour.Week == 0 || date.Week == officeHour.Week { // office hours in alternating weeks should not collide
|
||||
minuteCount += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if minuteCount > count {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<option value="{{$course.Id}}"{{if eq $course.Id $.SelectedCourse}} selected{{end}}>{{$course.Name}}</option>
|
||||
{{end}}
|
||||
</select><br>
|
||||
<label for="woche">Woche</label>:
|
||||
<label for="woche">Vorlesungswoche</label>:
|
||||
<select name="woche" id="woche">
|
||||
<option value="0"{{if eq 0 $.Date.Week}} selected{{end}}>Jede</option>
|
||||
<option value="1"{{if eq 1 $.Date.Week}} selected{{end}}>Ungerade</option>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<td rowspan="{{divide .OfficeHour.Duration .MinuteGranularity}}" style="border: 1px solid">
|
||||
{{if .DeleteIcons}}<div style="text-align: right;"><a href="/deleteOfficeHour?id={{.OfficeHour.Id}}">❌</a></div>{{end}}
|
||||
{{printf "%02d" .OfficeHour.Date.Hour}}:{{printf "%02d" .OfficeHour.Date.Minute}} - {{printf "%02d" .OfficeHour.EndDate.Hour}}:{{printf "%02d" .OfficeHour.EndDate.Minute}}<br>
|
||||
{{if eq .OfficeHour.Date.Week 1}}in ungeraden Wochen<br>{{end}}{{if eq .OfficeHour.Date.Week 2}}in geraden Wochen<br>{{end}}
|
||||
{{if eq .OfficeHour.Date.Week 1}}in ungeraden Vorlesungswochen<br>{{end}}{{if eq .OfficeHour.Date.Week 2}}in geraden Vorlesungswochen<br>{{end}}
|
||||
{{.OfficeHour.Course.Name}}<br>
|
||||
{{.OfficeHour.Tutor.Name}}<br>
|
||||
{{.OfficeHour.Room.Name}}<br>
|
||||
|
|
Loading…
Reference in a new issue