diff options
Diffstat (limited to 'newcourses.go')
-rw-r--r-- | newcourses.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/newcourses.go b/newcourses.go index bc7dfe6..5963e1b 100644 --- a/newcourses.go +++ b/newcourses.go @@ -320,16 +320,6 @@ func handleNewCourses(w http.ResponseWriter, req *http.Request) { return false } } - courses.Clear() - err = setupCourses(ctx) - if err != nil { - wstr( - w, - http.StatusInternalServerError, - "Error setting up course table again", - ) - return false - } err = tx.Commit(ctx) if err != nil { wstr( @@ -345,5 +335,16 @@ func handleNewCourses(w http.ResponseWriter, req *http.Request) { return } + courses.Clear() + err = setupCourses(req.Context()) + if err != nil { + wstr( + w, + http.StatusInternalServerError, + "Error setting up course table again, the data might be corrupted!", + ) + return + } + http.Redirect(w, req, "/", http.StatusSeeOther) } |