summaryrefslogtreecommitdiff
path: root/wsm.go
diff options
context:
space:
mode:
Diffstat (limited to 'wsm.go')
-rw-r--r--wsm.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/wsm.go b/wsm.go
index b0c1c7b..ee3bc69 100644
--- a/wsm.go
+++ b/wsm.go
@@ -80,11 +80,7 @@ func messageChooseCourse(ctx context.Context, c *websocket.Conn, reportError rep
return reportError("Course ID must be an integer")
}
courseID := int(_courseID)
- course := func() *courseT {
- coursesLock.RLock()
- defer coursesLock.RUnlock()
- return courses[courseID]
- }()
+ course := getCourseByID(courseID)
err = func() (returnedError error) { /* Named returns so I could modify them in defer */
tx, err := db.Begin(ctx)
@@ -184,11 +180,7 @@ func messageUnchooseCourse(ctx context.Context, c *websocket.Conn, reportError r
return reportError("Course ID must be an integer")
}
courseID := int(_courseID)
- course := func() *courseT {
- coursesLock.RLock()
- defer coursesLock.RUnlock()
- return courses[courseID]
- }()
+ course := getCourseByID(courseID)
ct, err := db.Exec(
ctx,