From acca75db1e64ecd913706440c519cbc2824e2a38 Mon Sep 17 00:00:00 2001 From: Carlo Bortolan <106114526+carlobortolan@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:03:05 +0100 Subject: [PATCH] Add alerts for test courses and outdated semesters (#1408) --- web/admin.go | 5 +++ .../admin/admin_tabs/edit-course.gohtml | 31 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/web/admin.go b/web/admin.go index 8ee7389b9..c6bddef7a 100644 --- a/web/admin.go +++ b/web/admin.go @@ -248,8 +248,13 @@ func (r mainRoutes) EditCoursePage(c *gin.Context) { if err != nil { logger.Error("Error getting invited users for course", "err", err) } + y, t := tum.GetCurrentSemester() + indexData := NewIndexData() indexData.TUMLiveContext = tumLiveContext + indexData.CurrentYear = y + indexData.CurrentTerm = t + courses, err := r.CoursesDao.GetAdministeredCoursesByUserId(context.Background(), tumLiveContext.User.ID, "", 0) if err != nil { logger.Error("couldn't query courses for user.", "err", err) diff --git a/web/template/admin/admin_tabs/edit-course.gohtml b/web/template/admin/admin_tabs/edit-course.gohtml index 92a4ac014..cbb052d73 100644 --- a/web/template/admin/admin_tabs/edit-course.gohtml +++ b/web/template/admin/admin_tabs/edit-course.gohtml @@ -5,6 +5,9 @@ {{- /*gotype: github.com/TUM-Dev/gocast/web.AdminPageData*/ -}} {{$course := .IndexData.TUMLiveContext.Course}} {{$lecture := .IndexData.TUMLiveContext.Stream}} +{{$currentYear := .IndexData.CurrentYear}} +{{$currentTerm := .IndexData.CurrentTerm}} +
@@ -20,6 +23,32 @@ role="alert"> Course was created successfully.
+ {{if (eq $course.TeachingTerm "Test")}} + + {{else if or (ne $course.TeachingTerm $currentTerm) (ne $course.Year $currentYear)}} + + {{end}}