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:
@@ -19,6 +19,7 @@ type ClassSession struct {
|
||||
EndsAt time.Time `gorm:"column:ends_at"`
|
||||
Room *string `gorm:"column:room"`
|
||||
Kind *string `gorm:"column:kind"`
|
||||
Lecturer *string `gorm:"column:lecturer"`
|
||||
Notes *string `gorm:"column:notes"`
|
||||
IsOnline bool `gorm:"column:is_online"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
@@ -31,7 +32,7 @@ func (ClassSession) TableName() string { return "jz_bm_class_sessions" }
|
||||
// Fillable lists the columns mass assignment may set. course_id and
|
||||
// meeting_id are set through the admin relation pickers.
|
||||
func (ClassSession) Fillable() []string {
|
||||
return []string{"course_id", "meeting_id", "starts_at", "ends_at", "room", "kind", "notes", "is_online"}
|
||||
return []string{"course_id", "meeting_id", "starts_at", "ends_at", "room", "kind", "lecturer", "notes", "is_online"}
|
||||
}
|
||||
|
||||
// Rules are checked by the admin API on every save.
|
||||
@@ -41,6 +42,7 @@ func (ClassSession) Rules() map[string]string {
|
||||
"ends_at": "required",
|
||||
"room": "nullable|max:100",
|
||||
"kind": "nullable|max:100",
|
||||
"lecturer": "nullable|max:255",
|
||||
"is_online": "boolean",
|
||||
}
|
||||
}
|
||||
@@ -57,6 +59,6 @@ func (s *ClassSession) TemporalErrors() map[string][]string {
|
||||
|
||||
// BeforeSave stores NULL for empty optional text.
|
||||
func (s *ClassSession) BeforeSave(*gorm.DB) error {
|
||||
blank(&s.Room, &s.Kind, &s.Notes)
|
||||
blank(&s.Room, &s.Kind, &s.Lecturer, &s.Notes)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -35,10 +35,15 @@ fields:
|
||||
label: jz.bm::lang.sessions.kind
|
||||
type: text
|
||||
span: right
|
||||
lecturer:
|
||||
label: jz.bm::lang.sessions.lecturer
|
||||
comment: jz.bm::lang.sessions.lecturer_comment
|
||||
type: text
|
||||
span: left
|
||||
is_online:
|
||||
label: jz.bm::lang.sessions.is_online
|
||||
type: switch
|
||||
span: left
|
||||
span: right
|
||||
notes:
|
||||
label: jz.bm::lang.common.notes
|
||||
type: textarea
|
||||
|
||||
@@ -26,10 +26,15 @@ fields:
|
||||
label: jz.bm::lang.sessions.kind
|
||||
type: text
|
||||
span: right
|
||||
lecturer:
|
||||
label: jz.bm::lang.sessions.lecturer
|
||||
comment: jz.bm::lang.sessions.lecturer_comment
|
||||
type: text
|
||||
span: left
|
||||
is_online:
|
||||
label: jz.bm::lang.sessions.is_online
|
||||
type: switch
|
||||
span: left
|
||||
span: right
|
||||
notes:
|
||||
label: jz.bm::lang.common.notes
|
||||
type: textarea
|
||||
|
||||
Reference in New Issue
Block a user