Skip to content

Commit

Permalink
fix: initialized student dashboard projects
Browse files Browse the repository at this point in the history
  • Loading branch information
harshkhandeparkar committed Nov 13, 2023
1 parent 00b1c3e commit 14d9ef8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controllers/student.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ func StudentBlogLink(w http.ResponseWriter, r *http.Request) {
}

func CreateStudentDashboard(modelStudent models.Student, db *gorm.DB) StudentDashboard {
var projects []ProjectDashboard
var projects []ProjectDashboard = make([]ProjectDashboard, 0)

for _, proj_id := range strings.Split(modelStudent.ProjectsWorked, ",") {
var project ProjectDashboard
db.Table("projects").
Expand All @@ -238,6 +239,7 @@ func CreateStudentDashboard(modelStudent models.Student, db *gorm.DB) StudentDas
First(&project)
projects = append(projects, project)
}

languages := strings.Split(modelStudent.LanguagesUsed, ",")
return StudentDashboard{
Name: modelStudent.Name,
Expand Down

0 comments on commit 14d9ef8

Please sign in to comment.