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:
@@ -284,7 +284,7 @@ func TestSeedCommandIsIdempotent(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
changed := filepath.Join(dir, "changed.json")
|
||||
writeJSON(t, changed, `{"courses": [{"key": "a", "name": "Przedmiot przykładowy A", "form": "wyklad", "semester": 1, "lecturer": "dr Inna Osoba", "sort_order": 1}],
|
||||
"class_sessions": [{"course": "a", "starts_at": "2030-10-05T08:00:00+02:00", "ends_at": "2030-10-05T10:00:00+02:00", "room": "105"}]}`)
|
||||
"class_sessions": [{"course": "a", "starts_at": "2030-10-05T08:00:00+02:00", "ends_at": "2030-10-05T10:00:00+02:00", "room": "105", "lecturer": "dr Zastępca"}]}`)
|
||||
seedFixture(t, plugins, changed)
|
||||
var updated models.Course
|
||||
gdb.Where("id = ?", ids[0]).Take(&updated)
|
||||
@@ -292,7 +292,8 @@ func TestSeedCommandIsIdempotent(t *testing.T) {
|
||||
t.Errorf("course after update = %+v", updated)
|
||||
}
|
||||
gdb.Where("course_id = ?", ids[0]).Take(&session)
|
||||
if session.Room == nil || *session.Room != "105" || session.MeetingID != nil || count(t, gdb, "jz_bm_class_sessions") != 3 {
|
||||
if session.Room == nil || *session.Room != "105" || session.MeetingID != nil || count(t, gdb, "jz_bm_class_sessions") != 3 ||
|
||||
session.Lecturer == nil || *session.Lecturer != "dr Zastępca" {
|
||||
t.Errorf("session after update = %+v", session)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user