Add Private Lessons (Özel Ders İstek) page and advisory teacher filtering in Syllabus
This commit is contained in:
parent
573a249580
commit
455baa6aa4
11 changed files with 1489 additions and 9 deletions
|
|
@ -368,6 +368,68 @@ async function runAllTests() {
|
|||
assert.strictEqual(s.selectedStation, 'İst-4');
|
||||
});
|
||||
|
||||
// 7. Advisory Teacher & Private Lessons Tests
|
||||
await test('SyllabusService: advisoryTeacher filtering collapses multiple Danışmanlık teachers down to student advisor', () => {
|
||||
// 5 advisory variations for period 2
|
||||
const tuesdayLessons: Lesson[] = [
|
||||
{ period: '2. Ders', periodNumber: 2, subject: 'Danışmanlık', teacher: 'ÜLKÜ ESEN', teacherPhoto: null, startTime: '10:15', endTime: '10:51', time: '10:15 - 10:51', station: null, day: 2, dayName: 'Salı' },
|
||||
{ period: '2. Ders', periodNumber: 2, subject: 'Danışmanlık', teacher: 'CAN TÜRKOĞLU', teacherPhoto: null, startTime: '10:15', endTime: '10:51', time: '10:15 - 10:51', station: null, day: 2, dayName: 'Salı' },
|
||||
{ period: '2. Ders', periodNumber: 2, subject: 'Danışmanlık', teacher: 'SEVGİ BİKİL', teacherPhoto: null, startTime: '10:15', endTime: '10:51', time: '10:15 - 10:51', station: null, day: 2, dayName: 'Salı' },
|
||||
{ period: '2. Ders', periodNumber: 2, subject: 'Danışmanlık', teacher: 'MERVE BAŞTAN', teacherPhoto: null, startTime: '10:15', endTime: '10:51', time: '10:15 - 10:51', station: null, day: 2, dayName: 'Salı' },
|
||||
{ period: '2. Ders', periodNumber: 2, subject: 'Danışmanlık', teacher: 'MUSTAFA ŞEN', teacherPhoto: null, startTime: '10:15', endTime: '10:51', time: '10:15 - 10:51', station: null, day: 2, dayName: 'Salı' }
|
||||
];
|
||||
|
||||
// Filter with CAN TÜRKOĞLU
|
||||
const filteredForCan = SyllabusService.filterLessonsForStation(tuesdayLessons, 'İst-4', 'CAN TÜRKOĞLU');
|
||||
assert.strictEqual(filteredForCan.length, 1, 'Should filter out the other 4 teachers and keep exactly 1');
|
||||
assert.strictEqual(filteredForCan[0].teacher, 'CAN TÜRKOĞLU');
|
||||
|
||||
// Filter with ÜLKÜ ESEN
|
||||
const filteredForUlku = SyllabusService.filterLessonsForStation(tuesdayLessons, 'İst-4', 'ÜLKÜ ESEN');
|
||||
assert.strictEqual(filteredForUlku.length, 1);
|
||||
assert.strictEqual(filteredForUlku[0].teacher, 'ÜLKÜ ESEN');
|
||||
});
|
||||
|
||||
await test('LocalDatabase: savePrivateLessons, getPrivateLessons, and advisory teacher persistence', () => {
|
||||
const db = LocalDatabase.getInstance();
|
||||
const testStudentId = `test_student_pl_${Date.now()}`;
|
||||
|
||||
const mockLessons = [
|
||||
{
|
||||
id: 'pl_1',
|
||||
subject: 'Coğrafya',
|
||||
teacherName: 'SEVDA KILIÇOĞLU',
|
||||
teacherPhoto: 'http://example.com/2337.jpg',
|
||||
date: '26.10.2026',
|
||||
parsedDate: '2026-10-26',
|
||||
isUpcoming: true
|
||||
},
|
||||
{
|
||||
id: 'pl_2',
|
||||
subject: 'Danışmanlık',
|
||||
teacherName: 'CAN TÜRKOĞLU',
|
||||
teacherPhoto: 'http://example.com/2211.jpg',
|
||||
date: '20.10.2026',
|
||||
parsedDate: '2026-10-20',
|
||||
isUpcoming: false
|
||||
}
|
||||
];
|
||||
|
||||
db.savePrivateLessons(testStudentId, mockLessons, undefined, 'CAN TÜRKOĞLU');
|
||||
|
||||
const plStore = db.getPrivateLessons(testStudentId);
|
||||
assert(plStore !== null);
|
||||
assert.strictEqual(plStore.lessons.length, 2);
|
||||
assert.strictEqual(plStore.detectedAdvisor, 'CAN TÜRKOĞLU');
|
||||
|
||||
// Verify auto-set advisory teacher
|
||||
assert.strictEqual(db.getStudentAdvisoryTeacher(testStudentId), 'CAN TÜRKOĞLU');
|
||||
|
||||
// Manual override
|
||||
db.setStudentAdvisoryTeacher(testStudentId, 'SEVGİ BİKİL');
|
||||
assert.strictEqual(db.getStudentAdvisoryTeacher(testStudentId), 'SEVGİ BİKİL');
|
||||
});
|
||||
|
||||
// 6. Optional Live Portal Test (via environment variables only)
|
||||
const testStudentId = process.env.TEST_STUDENT_ID;
|
||||
const testPassword = process.env.TEST_PASSWORD;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue