feat: семестровые привязки преподавателей к дисциплинам в отдельной вкладке
Привязка «преподаватель ↔ дисциплина» теперь создаётся на сочетание «дисциплина + учебный год + номер семестра»: дисциплина в двух семестрах одного графика или в разных графиках получает отдельные строки привязки, на каждый семестр можно назначить своих преподавателей. Привязка с обоими семестровыми полями NULL («без семестра») действует для всех семестров. Backend: - teacher_subjects: суррогатный id, колонки academic_year_id/semester_number, UNIQUE NULLS NOT DISTINCT (user_id, subject_id, academic_year_id, semester_number), FK на academic_years, CHECK semester_number > 0 - POST/DELETE /api/teacher-subjects принимают пару academicYearId+semesterNumber (оба null или оба заданы, иначе 400); GET добавляет поля семестра в ответ - /api/users/teachers/options: новые параметры semesterId+semesterNumber — сужение до привязки «дисциплина + семестр» с fallback на «без семестра» - тестовые данные: привязки по вхождениям дисциплин в графики специальностей активных групп кафедры (как в AcademicCalendarSubjectRepository) Frontend: - новая вкладка «Преподаватели дисциплин» (department-bindings, роль DEPARTMENT): строки по семестрам из календарных графиков, колонка «Семестр», пагинация, привязка/отвязка с семестровым контекстом - конструктор правил: список преподавателя слота сужается по дисциплине и семестру группы; номер семестра подтягивается и в модалке конфликта - реестр дисциплин: метка семестра у привязок, удаление с семестровым контекстом Документация: API.md, BUSINESS_LOGIC.md, DATABASE.md, FRONTEND.md
This commit is contained in:
1 parent
ddf1850155
commit
329a762d54
29 files changed
+861
-209
No files matched your search
@@ -916,9 +916,23 @@ export function ScheduleTab() {
|
||||
newMeta: ruleDraftMeta(pendingPayload, dictionaries),
|
||||
existingTitle: ruleTitle(conflictRule, latest.subjects),
|
||||
existingMeta: ruleMeta(conflictRule, dictionaries),
|
||||
semesterNumber: null,
|
||||
slots: (conflictRule.slots || []).map(slot => ({ ...slotFromRule(slot), original: slot }))
|
||||
});
|
||||
setConflictAlert(null);
|
||||
// Номер семестра группы конфликтующего правила нужен, чтобы сузить
|
||||
// список преподавателя слота до привязок этого семестра. Подтягиваем
|
||||
// его асинхронно: до загрузки список сужается только по дисциплине.
|
||||
const conflictGroupId = Array.isArray(conflictRule.groupIds) ? conflictRule.groupIds[0] : null;
|
||||
if (conflictGroupId && conflictRule.semesterId) {
|
||||
fetchRuleSubjectOptions(conflictGroupId, conflictRule.semesterId)
|
||||
.then(options => {
|
||||
if (options && options.semesterNumber) {
|
||||
setConflict(current => (current ? { ...current, semesterNumber: options.semesterNumber } : current));
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
function closeConflictModal() {
|
||||
@@ -1751,6 +1765,7 @@ export function ScheduleTab() {
|
||||
subgroups={subgroups}
|
||||
selectedGroupIds={selectedGroupIds}
|
||||
semesterId={ruleSemesterId}
|
||||
semesterNumber={ruleSubjectOptions?.semesterNumber || null}
|
||||
subjectId={ruleSubjectId}
|
||||
preferences={approvedPreferences}
|
||||
subgroupMenuOpen={subgroupMenuOpenIndex === index}
|
||||
@@ -1815,6 +1830,8 @@ export function ScheduleTab() {
|
||||
conflictFields={conflict.conflictFields}
|
||||
timeSlotOptions={timeSlotOptions}
|
||||
subjectId={conflict.conflictRule?.subjectId || ''}
|
||||
semesterId={conflict.conflictRule?.semesterId || ''}
|
||||
semesterNumber={conflict.semesterNumber || null}
|
||||
onSlotChange={handleConflictSlotChange}
|
||||
/>
|
||||
))}
|
||||
@@ -2071,7 +2088,7 @@ export function ScheduleTab() {
|
||||
function RuleSlotRow({
|
||||
slot, index, slotCount, disabled,
|
||||
timeSlotOptions, lessonTypeOptions, lessonTypes, subgroups, selectedGroupIds,
|
||||
semesterId, subjectId, preferences,
|
||||
semesterId, semesterNumber, subjectId, preferences,
|
||||
subgroupMenuOpen, onToggleSubgroupMenu, onChange, onRemove
|
||||
}) {
|
||||
const isSingle = slotCount === 1;
|
||||
@@ -2122,7 +2139,7 @@ function RuleSlotRow({
|
||||
optionLabel={teacherOptionLabel}
|
||||
optionDescription={teacherOptionDescription}
|
||||
load={(query, selectedId) => (subjectId
|
||||
? fetchTeacherOptions(query, selectedId, subjectId)
|
||||
? fetchTeacherOptions(query, selectedId, subjectId, semesterId, semesterNumber)
|
||||
: Promise.resolve([]))}
|
||||
selectedValue={slot.teacherId}
|
||||
selectedLabel={slot.teacherName}
|
||||
@@ -2270,7 +2287,7 @@ function RuleSlotRow({
|
||||
|
||||
// --- Строка слота конфликтующего правила ---
|
||||
|
||||
function ConflictSlotRow({ slot, index, conflictFields, timeSlotOptions, subjectId, onSlotChange }) {
|
||||
function ConflictSlotRow({ slot, index, conflictFields, timeSlotOptions, subjectId, semesterId, semesterNumber, onSlotChange }) {
|
||||
const original = slot.original || {};
|
||||
const fixedParts = [
|
||||
original.lessonTypeName,
|
||||
@@ -2316,7 +2333,7 @@ function ConflictSlotRow({ slot, index, conflictFields, timeSlotOptions, subject
|
||||
optionLabel={teacherOptionLabel}
|
||||
optionDescription={teacherOptionDescription}
|
||||
load={(query, selectedId) => (subjectId
|
||||
? fetchTeacherOptions(query, selectedId, subjectId)
|
||||
? fetchTeacherOptions(query, selectedId, subjectId, semesterId, semesterNumber)
|
||||
: fetchTeacherOptions(query, selectedId))}
|
||||
selectedValue={slot.teacherId}
|
||||
selectedLabel={slot.teacherName}
|
||||
|
||||
Reference in new issue
Block a user