Skip to content

Commit

Permalink
Update courses.go
Browse files Browse the repository at this point in the history
  • Loading branch information
KemalKrKX authored Dec 6, 2024
1 parent c75cf8f commit e1107d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dao/courses.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,11 @@ func (d coursesDao) DeleteCourse(course model.Course) {

func (d coursesDao) IsUserEnrolledInCourse(user uint, course uint) (bool, error) {
var nRows int64
err := DB.Table("course_users").Where("user_id = ? AND course_id = ?", user, course).Count(&nRows).Error
var err error
if DB == nil {
return false, err
}
err = DB.Table("course_users").Where("user_id = ? AND course_id = ?", user, course).Count(&nRows).Error
if err != nil {
return false, err
}
Expand Down

0 comments on commit e1107d2

Please sign in to comment.