feat: lecturer on class sessions and in the session course ref
The schedule showed a lecturer only where the session notes named one (Globalizacja), so the student plan had nobody under the other courses. The session JSON now carries the course lecturer in its course ref and an optional per-session lecturer (new nullable column, admin field, seed key) for courses shared between two people. The student app shows the session's own lecturer or, failing that, the course's.
This commit is contained in:
@@ -17,6 +17,7 @@ type courseRef struct {
|
||||
Code *string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Form string `json:"form"`
|
||||
Lecturer *string `json:"lecturer"`
|
||||
Semester int `json:"semester"`
|
||||
}
|
||||
|
||||
@@ -24,7 +25,7 @@ func newCourseRef(c *models.Course) *courseRef {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return &courseRef{ID: c.ID, Code: c.Code, Name: c.Name, Form: c.Form, Semester: c.Semester}
|
||||
return &courseRef{ID: c.ID, Code: c.Code, Name: c.Name, Form: c.Form, Lecturer: c.Lecturer, Semester: c.Semester}
|
||||
}
|
||||
|
||||
// courseJSON is a course's own fields.
|
||||
@@ -105,6 +106,7 @@ type sessionJSON struct {
|
||||
EndsAt string `json:"ends_at"`
|
||||
Room *string `json:"room"`
|
||||
Kind *string `json:"kind"`
|
||||
Lecturer *string `json:"lecturer"`
|
||||
Notes *string `json:"notes"`
|
||||
IsOnline bool `json:"is_online"`
|
||||
Course *courseRef `json:"course"`
|
||||
@@ -119,6 +121,7 @@ func newSessionJSON(s models.ClassSession) sessionJSON {
|
||||
EndsAt: models.FormatDateTime(s.EndsAt),
|
||||
Room: s.Room,
|
||||
Kind: s.Kind,
|
||||
Lecturer: s.Lecturer,
|
||||
Notes: s.Notes,
|
||||
IsOnline: s.IsOnline,
|
||||
Course: newCourseRef(s.Course),
|
||||
|
||||
Reference in New Issue
Block a user