feat: колонки шифр/профиль/вид нагрузки + комментарии под строкой
- Таблица дисциплин кафедры: новые колонки «Шифр» (специальность графика), «Профиль» (профиль обучения графика), «Вид нагрузки» (уникальные типы занятий дисциплины из teacher_lesson_types) - Комментарии открываются строкой таблицы под выбранной дисциплиной, а не отдельной карточкой внизу страницы - Селект графиков получил стили дизайн-системы (фон, границы, шрифт) — раньше был нечитаемым - Тесты: backend 5/5, frontend 240/240; проверено в браузере
This commit is contained in:
1 parent
efacac1c59
commit
37665f1aae
13 files changed
+242
-38
No files matched your search
+37
-4
@@ -15,6 +15,7 @@ import com.magistr.app.repository.SubjectCommentRepository;
|
|||||||
import com.magistr.app.repository.SubjectRepository;
|
import com.magistr.app.repository.SubjectRepository;
|
||||||
import com.magistr.app.repository.TeacherCreationRequestRepository;
|
import com.magistr.app.repository.TeacherCreationRequestRepository;
|
||||||
import com.magistr.app.repository.TeacherDepartmentAssignmentRepository;
|
import com.magistr.app.repository.TeacherDepartmentAssignmentRepository;
|
||||||
|
import com.magistr.app.repository.TeacherSubjectRepository;
|
||||||
import com.magistr.app.repository.UserRepository;
|
import com.magistr.app.repository.UserRepository;
|
||||||
import com.magistr.app.service.ScheduleQueryService;
|
import com.magistr.app.service.ScheduleQueryService;
|
||||||
import com.magistr.app.service.SubjectImportService;
|
import com.magistr.app.service.SubjectImportService;
|
||||||
@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -47,6 +49,7 @@ public class DepartmentWorkspaceController {
|
|||||||
private final TeacherDepartmentAssignmentRepository teacherDepartmentAssignmentRepository;
|
private final TeacherDepartmentAssignmentRepository teacherDepartmentAssignmentRepository;
|
||||||
private final TeacherCreationRequestRepository teacherCreationRequestRepository;
|
private final TeacherCreationRequestRepository teacherCreationRequestRepository;
|
||||||
private final AcademicCalendarSubjectRepository calendarSubjectRepository;
|
private final AcademicCalendarSubjectRepository calendarSubjectRepository;
|
||||||
|
private final TeacherSubjectRepository teacherSubjectRepository;
|
||||||
private final ScheduleQueryService scheduleQueryService;
|
private final ScheduleQueryService scheduleQueryService;
|
||||||
private final TeacherDepartmentService teacherDepartmentService;
|
private final TeacherDepartmentService teacherDepartmentService;
|
||||||
private final SubjectImportService subjectImportService;
|
private final SubjectImportService subjectImportService;
|
||||||
@@ -59,13 +62,14 @@ public class DepartmentWorkspaceController {
|
|||||||
TeacherDepartmentAssignmentRepository teacherDepartmentAssignmentRepository,
|
TeacherDepartmentAssignmentRepository teacherDepartmentAssignmentRepository,
|
||||||
TeacherCreationRequestRepository teacherCreationRequestRepository,
|
TeacherCreationRequestRepository teacherCreationRequestRepository,
|
||||||
AcademicCalendarSubjectRepository calendarSubjectRepository,
|
AcademicCalendarSubjectRepository calendarSubjectRepository,
|
||||||
|
TeacherSubjectRepository teacherSubjectRepository,
|
||||||
ScheduleQueryService scheduleQueryService,
|
ScheduleQueryService scheduleQueryService,
|
||||||
TeacherDepartmentService teacherDepartmentService,
|
TeacherDepartmentService teacherDepartmentService,
|
||||||
SubjectImportService subjectImportService) {
|
SubjectImportService subjectImportService) {
|
||||||
this(subjectRepository, subjectCommentRepository, userRepository, departmentRepository,
|
this(subjectRepository, subjectCommentRepository, userRepository, departmentRepository,
|
||||||
teacherDepartmentAssignmentRepository, teacherCreationRequestRepository,
|
teacherDepartmentAssignmentRepository, teacherCreationRequestRepository,
|
||||||
calendarSubjectRepository, scheduleQueryService, teacherDepartmentService,
|
calendarSubjectRepository, teacherSubjectRepository, scheduleQueryService,
|
||||||
subjectImportService,
|
teacherDepartmentService, subjectImportService,
|
||||||
BusinessTimeService.systemDefault());
|
BusinessTimeService.systemDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +81,7 @@ public class DepartmentWorkspaceController {
|
|||||||
TeacherDepartmentAssignmentRepository teacherDepartmentAssignmentRepository,
|
TeacherDepartmentAssignmentRepository teacherDepartmentAssignmentRepository,
|
||||||
TeacherCreationRequestRepository teacherCreationRequestRepository,
|
TeacherCreationRequestRepository teacherCreationRequestRepository,
|
||||||
AcademicCalendarSubjectRepository calendarSubjectRepository,
|
AcademicCalendarSubjectRepository calendarSubjectRepository,
|
||||||
|
TeacherSubjectRepository teacherSubjectRepository,
|
||||||
ScheduleQueryService scheduleQueryService,
|
ScheduleQueryService scheduleQueryService,
|
||||||
TeacherDepartmentService teacherDepartmentService,
|
TeacherDepartmentService teacherDepartmentService,
|
||||||
SubjectImportService subjectImportService,
|
SubjectImportService subjectImportService,
|
||||||
@@ -88,6 +93,7 @@ public class DepartmentWorkspaceController {
|
|||||||
this.teacherDepartmentAssignmentRepository = teacherDepartmentAssignmentRepository;
|
this.teacherDepartmentAssignmentRepository = teacherDepartmentAssignmentRepository;
|
||||||
this.teacherCreationRequestRepository = teacherCreationRequestRepository;
|
this.teacherCreationRequestRepository = teacherCreationRequestRepository;
|
||||||
this.calendarSubjectRepository = calendarSubjectRepository;
|
this.calendarSubjectRepository = calendarSubjectRepository;
|
||||||
|
this.teacherSubjectRepository = teacherSubjectRepository;
|
||||||
this.scheduleQueryService = scheduleQueryService;
|
this.scheduleQueryService = scheduleQueryService;
|
||||||
this.teacherDepartmentService = teacherDepartmentService;
|
this.teacherDepartmentService = teacherDepartmentService;
|
||||||
this.subjectImportService = subjectImportService;
|
this.subjectImportService = subjectImportService;
|
||||||
@@ -151,19 +157,44 @@ public class DepartmentWorkspaceController {
|
|||||||
Collectors.mapping(this::toCalendarAttachmentDto, Collectors.toList())
|
Collectors.mapping(this::toCalendarAttachmentDto, Collectors.toList())
|
||||||
));
|
));
|
||||||
|
|
||||||
|
Map<Long, List<String>> lessonTypesBySubject = lessonTypesBySubjectId(
|
||||||
|
subjects.stream().map(Subject::getId).toList());
|
||||||
|
|
||||||
return subjects.stream()
|
return subjects.stream()
|
||||||
.map(subject -> toDepartmentCalendarSubjectDto(subject, attachmentsBySubject))
|
.map(subject -> toDepartmentCalendarSubjectDto(subject, attachmentsBySubject, lessonTypesBySubject))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Виды нагрузки дисциплин: уникальные типы занятий из привязок
|
||||||
|
* преподавателей (teacher_lesson_types), без повторов от разных педагогов.
|
||||||
|
*/
|
||||||
|
private Map<Long, List<String>> lessonTypesBySubjectId(List<Long> subjectIds) {
|
||||||
|
if (subjectIds.isEmpty()) {
|
||||||
|
return Map.of();
|
||||||
|
}
|
||||||
|
Map<Long, List<String>> lessonTypesBySubject = new LinkedHashMap<>();
|
||||||
|
for (Object[] row : teacherSubjectRepository.findLessonTypeNamesBySubjectIds(subjectIds)) {
|
||||||
|
Long subjectId = ((Number) row[0]).longValue();
|
||||||
|
String lessonTypeName = String.valueOf(row[1]);
|
||||||
|
List<String> lessonTypes = lessonTypesBySubject.computeIfAbsent(subjectId, key -> new ArrayList<>());
|
||||||
|
if (!lessonTypes.contains(lessonTypeName)) {
|
||||||
|
lessonTypes.add(lessonTypeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lessonTypesBySubject;
|
||||||
|
}
|
||||||
|
|
||||||
private DepartmentCalendarSubjectDto toDepartmentCalendarSubjectDto(
|
private DepartmentCalendarSubjectDto toDepartmentCalendarSubjectDto(
|
||||||
Subject subject,
|
Subject subject,
|
||||||
Map<Long, List<DepartmentCalendarSubjectDto.CalendarAttachmentDto>> attachmentsBySubject) {
|
Map<Long, List<DepartmentCalendarSubjectDto.CalendarAttachmentDto>> attachmentsBySubject,
|
||||||
|
Map<Long, List<String>> lessonTypesBySubject) {
|
||||||
return new DepartmentCalendarSubjectDto(
|
return new DepartmentCalendarSubjectDto(
|
||||||
subject.getId(),
|
subject.getId(),
|
||||||
subject.getCode(),
|
subject.getCode(),
|
||||||
subject.getName(),
|
subject.getName(),
|
||||||
subject.getDepartmentId(),
|
subject.getDepartmentId(),
|
||||||
|
lessonTypesBySubject.getOrDefault(subject.getId(), List.of()),
|
||||||
attachmentsBySubject.getOrDefault(subject.getId(), List.of())
|
attachmentsBySubject.getOrDefault(subject.getId(), List.of())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -175,6 +206,8 @@ public class DepartmentWorkspaceController {
|
|||||||
return new DepartmentCalendarSubjectDto.CalendarAttachmentDto(
|
return new DepartmentCalendarSubjectDto.CalendarAttachmentDto(
|
||||||
calendar.getId(),
|
calendar.getId(),
|
||||||
calendar.getTitle(),
|
calendar.getTitle(),
|
||||||
|
calendar.getSpeciality() == null ? null : calendar.getSpeciality().getSpecialityCode(),
|
||||||
|
calendar.getSpecialtyProfile() == null ? null : calendar.getSpecialtyProfile().getName(),
|
||||||
academicYear == null ? null : academicYear.getId(),
|
academicYear == null ? null : academicYear.getId(),
|
||||||
academicYear == null ? null : academicYear.getTitle(),
|
academicYear == null ? null : academicYear.getTitle(),
|
||||||
calendarSubject.getSemesterNumber()
|
calendarSubject.getSemesterNumber()
|
||||||
|
|||||||
@@ -6,18 +6,22 @@ import java.util.List;
|
|||||||
* Дисциплина кафедры вместе с прикреплениями к календарным графикам.
|
* Дисциплина кафедры вместе с прикреплениями к календарным графикам.
|
||||||
* Прикрепления приходят из academic_calendar_subjects: дисциплина попадает
|
* Прикрепления приходят из academic_calendar_subjects: дисциплина попадает
|
||||||
* на страницу той кафедры, за которой она закреплена в справочнике.
|
* на страницу той кафедры, за которой она закреплена в справочнике.
|
||||||
|
* lessonTypes — виды нагрузки (типы занятий) из привязок преподавателей.
|
||||||
*/
|
*/
|
||||||
public record DepartmentCalendarSubjectDto(
|
public record DepartmentCalendarSubjectDto(
|
||||||
Long id,
|
Long id,
|
||||||
String code,
|
String code,
|
||||||
String name,
|
String name,
|
||||||
Long departmentId,
|
Long departmentId,
|
||||||
|
List<String> lessonTypes,
|
||||||
List<CalendarAttachmentDto> attachments
|
List<CalendarAttachmentDto> attachments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
public record CalendarAttachmentDto(
|
public record CalendarAttachmentDto(
|
||||||
Long calendarId,
|
Long calendarId,
|
||||||
String calendarTitle,
|
String calendarTitle,
|
||||||
|
String specialtyCode,
|
||||||
|
String specialtyProfileName,
|
||||||
Long academicYearId,
|
Long academicYearId,
|
||||||
String academicYearTitle,
|
String academicYearTitle,
|
||||||
Integer semesterNumber
|
Integer semesterNumber
|
||||||
|
|||||||
+1
@@ -41,6 +41,7 @@ public interface AcademicCalendarSubjectRepository extends JpaRepository<Academi
|
|||||||
join fetch calendarSubject.academicCalendar calendar
|
join fetch calendarSubject.academicCalendar calendar
|
||||||
join fetch calendar.academicYear academicYear
|
join fetch calendar.academicYear academicYear
|
||||||
join fetch calendar.speciality speciality
|
join fetch calendar.speciality speciality
|
||||||
|
join fetch calendar.specialtyProfile specialtyProfile
|
||||||
join fetch calendarSubject.subject subject
|
join fetch calendarSubject.subject subject
|
||||||
where subject.departmentId = :departmentId
|
where subject.departmentId = :departmentId
|
||||||
and subject.status <> 'ARCHIVED'
|
and subject.status <> 'ARCHIVED'
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface TeacherSubjectRepository extends JpaRepository<TeacherSubject, TeacherSubjectId> {
|
public interface TeacherSubjectRepository extends JpaRepository<TeacherSubject, TeacherSubjectId> {
|
||||||
@@ -47,4 +48,18 @@ public interface TeacherSubjectRepository extends JpaRepository<TeacherSubject,
|
|||||||
@Param("subjectId") Long subjectId,
|
@Param("subjectId") Long subjectId,
|
||||||
@Param("lessonTypeId") Long lessonTypeId
|
@Param("lessonTypeId") Long lessonTypeId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Виды нагрузки дисциплин (типы занятий из привязок преподавателей)
|
||||||
|
* для сводной колонки на странице кафедры. Один тип от разных
|
||||||
|
* преподавателей не дублируется — уникальность собирает контроллер.
|
||||||
|
*/
|
||||||
|
@Query(value = """
|
||||||
|
select link.subject_id, type.name
|
||||||
|
from teacher_lesson_types link
|
||||||
|
join lesson_types type on type.id = link.lesson_type_id
|
||||||
|
where link.subject_id in (:subjectIds)
|
||||||
|
order by link.subject_id, type.name
|
||||||
|
""", nativeQuery = true)
|
||||||
|
List<Object[]> findLessonTypeNamesBySubjectIds(@Param("subjectIds") Collection<Long> subjectIds);
|
||||||
}
|
}
|
||||||
+32
-1
@@ -10,6 +10,8 @@ import com.magistr.app.model.AcademicYear;
|
|||||||
import com.magistr.app.model.Department;
|
import com.magistr.app.model.Department;
|
||||||
import com.magistr.app.model.LifecycleEntity;
|
import com.magistr.app.model.LifecycleEntity;
|
||||||
import com.magistr.app.model.Role;
|
import com.magistr.app.model.Role;
|
||||||
|
import com.magistr.app.model.Speciality;
|
||||||
|
import com.magistr.app.model.SpecialtyProfile;
|
||||||
import com.magistr.app.model.Subject;
|
import com.magistr.app.model.Subject;
|
||||||
import com.magistr.app.model.TeacherDepartmentAssignment;
|
import com.magistr.app.model.TeacherDepartmentAssignment;
|
||||||
import com.magistr.app.model.User;
|
import com.magistr.app.model.User;
|
||||||
@@ -19,6 +21,7 @@ import com.magistr.app.repository.SubjectRepository;
|
|||||||
import com.magistr.app.repository.DepartmentRepository;
|
import com.magistr.app.repository.DepartmentRepository;
|
||||||
import com.magistr.app.repository.TeacherCreationRequestRepository;
|
import com.magistr.app.repository.TeacherCreationRequestRepository;
|
||||||
import com.magistr.app.repository.TeacherDepartmentAssignmentRepository;
|
import com.magistr.app.repository.TeacherDepartmentAssignmentRepository;
|
||||||
|
import com.magistr.app.repository.TeacherSubjectRepository;
|
||||||
import com.magistr.app.repository.UserRepository;
|
import com.magistr.app.repository.UserRepository;
|
||||||
import com.magistr.app.service.BusinessTimeService;
|
import com.magistr.app.service.BusinessTimeService;
|
||||||
import com.magistr.app.service.ScheduleQueryService;
|
import com.magistr.app.service.ScheduleQueryService;
|
||||||
@@ -69,6 +72,7 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
mock(TeacherDepartmentAssignmentRepository.class),
|
mock(TeacherDepartmentAssignmentRepository.class),
|
||||||
mock(TeacherCreationRequestRepository.class),
|
mock(TeacherCreationRequestRepository.class),
|
||||||
mock(AcademicCalendarSubjectRepository.class),
|
mock(AcademicCalendarSubjectRepository.class),
|
||||||
|
mock(TeacherSubjectRepository.class),
|
||||||
mock(ScheduleQueryService.class),
|
mock(ScheduleQueryService.class),
|
||||||
mock(TeacherDepartmentService.class),
|
mock(TeacherDepartmentService.class),
|
||||||
mock(SubjectImportService.class)
|
mock(SubjectImportService.class)
|
||||||
@@ -97,6 +101,7 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
assignmentRepository,
|
assignmentRepository,
|
||||||
mock(TeacherCreationRequestRepository.class),
|
mock(TeacherCreationRequestRepository.class),
|
||||||
mock(AcademicCalendarSubjectRepository.class),
|
mock(AcademicCalendarSubjectRepository.class),
|
||||||
|
mock(TeacherSubjectRepository.class),
|
||||||
mock(ScheduleQueryService.class),
|
mock(ScheduleQueryService.class),
|
||||||
teacherDepartmentService,
|
teacherDepartmentService,
|
||||||
mock(SubjectImportService.class),
|
mock(SubjectImportService.class),
|
||||||
@@ -127,6 +132,7 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
assignmentRepository,
|
assignmentRepository,
|
||||||
mock(TeacherCreationRequestRepository.class),
|
mock(TeacherCreationRequestRepository.class),
|
||||||
mock(AcademicCalendarSubjectRepository.class),
|
mock(AcademicCalendarSubjectRepository.class),
|
||||||
|
mock(TeacherSubjectRepository.class),
|
||||||
mock(ScheduleQueryService.class),
|
mock(ScheduleQueryService.class),
|
||||||
mock(TeacherDepartmentService.class),
|
mock(TeacherDepartmentService.class),
|
||||||
mock(SubjectImportService.class)
|
mock(SubjectImportService.class)
|
||||||
@@ -149,12 +155,20 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
void subjectCalendarAttachmentsSortByNameAndGroupAttachments() {
|
void subjectCalendarAttachmentsSortByNameAndGroupAttachments() {
|
||||||
SubjectRepository subjectRepository = mock(SubjectRepository.class);
|
SubjectRepository subjectRepository = mock(SubjectRepository.class);
|
||||||
AcademicCalendarSubjectRepository calendarSubjectRepository = mock(AcademicCalendarSubjectRepository.class);
|
AcademicCalendarSubjectRepository calendarSubjectRepository = mock(AcademicCalendarSubjectRepository.class);
|
||||||
|
TeacherSubjectRepository teacherSubjectRepository = mock(TeacherSubjectRepository.class);
|
||||||
Subject databases = new Subject(10L, "Базы данных", "DB201", 1L);
|
Subject databases = new Subject(10L, "Базы данных", "DB201", 1L);
|
||||||
Subject crypto = new Subject(11L, "Криптография", "KR101", 1L);
|
Subject crypto = new Subject(11L, "Криптография", "KR101", 1L);
|
||||||
// порядок из репозитория намеренно не по алфавиту — контроллер сортирует
|
// порядок из репозитория намеренно не по алфавиту — контроллер сортирует
|
||||||
when(subjectRepository.findByDepartmentIdAndStatusNot(1L, LifecycleEntity.STATUS_ARCHIVED))
|
when(subjectRepository.findByDepartmentIdAndStatusNot(1L, LifecycleEntity.STATUS_ARCHIVED))
|
||||||
.thenReturn(List.of(crypto, databases));
|
.thenReturn(List.of(crypto, databases));
|
||||||
|
|
||||||
|
Speciality speciality = new Speciality();
|
||||||
|
speciality.setId(3L);
|
||||||
|
speciality.setSpecialityName("Информационная безопасность");
|
||||||
|
speciality.setSpecialityCode("10.03.01");
|
||||||
|
SpecialtyProfile specialtyProfile = new SpecialtyProfile();
|
||||||
|
specialtyProfile.setId(4L);
|
||||||
|
specialtyProfile.setName("Без профиля");
|
||||||
AcademicYear year = new AcademicYear();
|
AcademicYear year = new AcademicYear();
|
||||||
year.setId(1L);
|
year.setId(1L);
|
||||||
year.setTitle("2026/2027");
|
year.setTitle("2026/2027");
|
||||||
@@ -164,11 +178,20 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
calendar.setId(2L);
|
calendar.setId(2L);
|
||||||
calendar.setTitle("2026/2027 · 10.03.01 Информационная безопасность");
|
calendar.setTitle("2026/2027 · 10.03.01 Информационная безопасность");
|
||||||
calendar.setAcademicYear(year);
|
calendar.setAcademicYear(year);
|
||||||
|
calendar.setSpeciality(speciality);
|
||||||
|
calendar.setSpecialtyProfile(specialtyProfile);
|
||||||
AcademicCalendarSubject link = new AcademicCalendarSubject();
|
AcademicCalendarSubject link = new AcademicCalendarSubject();
|
||||||
link.setAcademicCalendar(calendar);
|
link.setAcademicCalendar(calendar);
|
||||||
link.setSemesterNumber(3);
|
link.setSemesterNumber(3);
|
||||||
link.setSubject(databases);
|
link.setSubject(databases);
|
||||||
when(calendarSubjectRepository.findBySubjectDepartmentId(1L)).thenReturn(List.of(link));
|
when(calendarSubjectRepository.findBySubjectDepartmentId(1L)).thenReturn(List.of(link));
|
||||||
|
// один и тот же тип занятия от двух преподавателей не дублируется
|
||||||
|
when(teacherSubjectRepository.findLessonTypeNamesBySubjectIds(List.of(10L, 11L)))
|
||||||
|
.thenReturn(List.of(
|
||||||
|
new Object[]{10L, "Лабораторные занятия"},
|
||||||
|
new Object[]{10L, "Лекции"},
|
||||||
|
new Object[]{10L, "Лекции"}
|
||||||
|
));
|
||||||
|
|
||||||
DepartmentWorkspaceController controller = new DepartmentWorkspaceController(
|
DepartmentWorkspaceController controller = new DepartmentWorkspaceController(
|
||||||
subjectRepository,
|
subjectRepository,
|
||||||
@@ -178,6 +201,7 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
mock(TeacherDepartmentAssignmentRepository.class),
|
mock(TeacherDepartmentAssignmentRepository.class),
|
||||||
mock(TeacherCreationRequestRepository.class),
|
mock(TeacherCreationRequestRepository.class),
|
||||||
calendarSubjectRepository,
|
calendarSubjectRepository,
|
||||||
|
teacherSubjectRepository,
|
||||||
mock(ScheduleQueryService.class),
|
mock(ScheduleQueryService.class),
|
||||||
mock(TeacherDepartmentService.class),
|
mock(TeacherDepartmentService.class),
|
||||||
mock(SubjectImportService.class)
|
mock(SubjectImportService.class)
|
||||||
@@ -192,10 +216,16 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
DepartmentCalendarSubjectDto.CalendarAttachmentDto attachment = result.get(0).attachments().get(0);
|
DepartmentCalendarSubjectDto.CalendarAttachmentDto attachment = result.get(0).attachments().get(0);
|
||||||
assertThat(attachment.calendarId()).isEqualTo(2L);
|
assertThat(attachment.calendarId()).isEqualTo(2L);
|
||||||
assertThat(attachment.calendarTitle()).isEqualTo("2026/2027 · 10.03.01 Информационная безопасность");
|
assertThat(attachment.calendarTitle()).isEqualTo("2026/2027 · 10.03.01 Информационная безопасность");
|
||||||
|
assertThat(attachment.specialtyCode()).isEqualTo("10.03.01");
|
||||||
|
assertThat(attachment.specialtyProfileName()).isEqualTo("Без профиля");
|
||||||
assertThat(attachment.academicYearTitle()).isEqualTo("2026/2027");
|
assertThat(attachment.academicYearTitle()).isEqualTo("2026/2027");
|
||||||
assertThat(attachment.semesterNumber()).isEqualTo(3);
|
assertThat(attachment.semesterNumber()).isEqualTo(3);
|
||||||
// дисциплина без прикреплений получает пустой список, а не null
|
// виды нагрузки дисциплины: уникальные типы занятий по алфавиту
|
||||||
|
assertThat(result.get(0).lessonTypes())
|
||||||
|
.containsExactly("Лабораторные занятия", "Лекции");
|
||||||
|
// дисциплина без прикреплений и без типов получает пустые списки, а не null
|
||||||
assertThat(result.get(1).attachments()).isEmpty();
|
assertThat(result.get(1).attachments()).isEmpty();
|
||||||
|
assertThat(result.get(1).lessonTypes()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -208,6 +238,7 @@ class DepartmentWorkspaceControllerTest {
|
|||||||
mock(TeacherDepartmentAssignmentRepository.class),
|
mock(TeacherDepartmentAssignmentRepository.class),
|
||||||
mock(TeacherCreationRequestRepository.class),
|
mock(TeacherCreationRequestRepository.class),
|
||||||
mock(AcademicCalendarSubjectRepository.class),
|
mock(AcademicCalendarSubjectRepository.class),
|
||||||
|
mock(TeacherSubjectRepository.class),
|
||||||
mock(ScheduleQueryService.class),
|
mock(ScheduleQueryService.class),
|
||||||
mock(TeacherDepartmentService.class),
|
mock(TeacherDepartmentService.class),
|
||||||
mock(SubjectImportService.class)
|
mock(SubjectImportService.class)
|
||||||
|
|||||||
@@ -1274,6 +1274,9 @@ payload обрабатываются один раз, используется
|
|||||||
специальностей в прикрепления не попадают. Роль `DEPARTMENT` видит только свою
|
специальностей в прикрепления не попадают. Роль `DEPARTMENT` видит только свою
|
||||||
кафедру, `ADMIN` может передать `departmentId`. Элемент `attachments` может быть пустым —
|
кафедру, `ADMIN` может передать `departmentId`. Элемент `attachments` может быть пустым —
|
||||||
такая дисциплина на странице кафедры помечается «Не прикреплена к графику».
|
такая дисциплина на странице кафедры помечается «Не прикреплена к графику».
|
||||||
|
`lessonTypes` — уникальные виды нагрузки дисциплины (типы занятий из привязок
|
||||||
|
преподавателей `teacher_lesson_types`); у прикрепления `specialtyCode` и
|
||||||
|
`specialtyProfileName` — шифр и профиль специальности графика.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
@@ -1282,10 +1285,13 @@ payload обрабатываются один раз, используется
|
|||||||
"code": "DB201",
|
"code": "DB201",
|
||||||
"name": "Базы данных",
|
"name": "Базы данных",
|
||||||
"departmentId": 1,
|
"departmentId": 1,
|
||||||
|
"lessonTypes": ["Лекции", "Лабораторные занятия"],
|
||||||
"attachments": [
|
"attachments": [
|
||||||
{
|
{
|
||||||
"calendarId": 2,
|
"calendarId": 2,
|
||||||
"calendarTitle": "2026/2027 · 10.03.01 Информационная безопасность · Очная",
|
"calendarTitle": "2026/2027 · 10.03.01 Информационная безопасность · Очная",
|
||||||
|
"specialtyCode": "10.03.01",
|
||||||
|
"specialtyProfileName": "Без профиля",
|
||||||
"academicYearId": 1,
|
"academicYearId": 1,
|
||||||
"academicYearTitle": "2026/2027",
|
"academicYearTitle": "2026/2027",
|
||||||
"semesterNumber": 3
|
"semesterNumber": 3
|
||||||
|
|||||||
@@ -99,9 +99,11 @@ Bearer-токен проверяется на backend. Frontend-скрытие
|
|||||||
- На странице кафедры дисциплины показываются вместе с прикреплениями к календарным графикам
|
- На странице кафедры дисциплины показываются вместе с прикреплениями к календарным графикам
|
||||||
(`GET /api/department/subjects/calendar`): дисциплина попадает в список той кафедры, за которой
|
(`GET /api/department/subjects/calendar`): дисциплина попадает в список той кафедры, за которой
|
||||||
она закреплена в справочнике; график относится к кафедре, только если его специальность
|
она закреплена в справочнике; график относится к кафедре, только если его специальность
|
||||||
используется активными группами этой кафедры. Прикрепления группируются по графику с перечнем
|
используется активными группами этой кафедры. В таблице — колонки «Шифр» и «Профиль»
|
||||||
семестров; при нескольких графиках показывается выпадающий список. Фильтр
|
(специальность графика), «Вид нагрузки» (уникальные типы занятий дисциплины из привязок
|
||||||
«В календарных графиках / Без графика» отделяет дисциплины, не входящие ни в один график.
|
преподавателей). Прикрепления группируются по графику с перечнем семестров; при нескольких
|
||||||
|
графиках показывается выпадающий список. Комментарии открываются строкой под дисциплиной.
|
||||||
|
Фильтр «В календарных графиках / Без графика» отделяет дисциплины, не входящие ни в один график.
|
||||||
|
|
||||||
### Жизненный цикл справочников
|
### Жизненный цикл справочников
|
||||||
|
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ legacy-файл вкладки. Последними (волна 6) — `schedul
|
|||||||
загрузка 84 857 байт gzip (лимит 90 000), общие chunk 79 217 байт gzip
|
загрузка 84 857 байт gzip (лимит 90 000), общие chunk 79 217 байт gzip
|
||||||
(лимит 85 000), lazy-вкладки 128 571 байт gzip в 25 chunk'ах (лимит 150 000,
|
(лимит 85 000), lazy-вкладки 128 571 байт gzip в 25 chunk'ах (лимит 150 000,
|
||||||
загружаются по одной) — лимиты не поднимались;
|
загружаются по одной) — лимиты не поднимались;
|
||||||
- `npm run check`: 239 тестов пройдено (обновлены импорты тестов с legacy-модулей
|
- `npm run check`: 240 тестов пройдено (обновлены импорты тестов с legacy-модулей
|
||||||
на React-сервисы, добавлены payload-валидация, DOM-рендер конструктора
|
на React-сервисы, добавлены payload-валидация, DOM-рендер конструктора
|
||||||
и контроль разрешения lazy-вкладок; проверки `LegacyTabView`/`legacy-views`
|
и контроль разрешения lazy-вкладок; проверки `LegacyTabView`/`legacy-views`
|
||||||
заменены на контроль отсутствия legacy-модулей).
|
заменены на контроль отсутствия legacy-модулей).
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
### Качество и надёжность
|
### Качество и надёжность
|
||||||
|
|
||||||
- **239 тестов** проходят (`npm run check`), против ~170 на момент начала этапа 5:
|
- **240 тестов** проходят (`npm run check`), против ~170 на момент начала этапа 5:
|
||||||
контракты API, payload-валидация, DOM-рендер каждой вкладки, бюджеты bundle, CSP,
|
контракты API, payload-валидация, DOM-рендер каждой вкладки, бюджеты bundle, CSP,
|
||||||
разрешение всех lazy-вкладок (регрессия на React error #306 поймана и закрыта тестом).
|
разрешение всех lazy-вкладок (регрессия на React error #306 поймана и закрыта тестом).
|
||||||
- Логика вынесена в **чистые сервисы** (`*-service.js`) — тестируются в Node без браузера
|
- Логика вынесена в **чистые сервисы** (`*-service.js`) — тестируются в Node без браузера
|
||||||
@@ -97,5 +97,5 @@
|
|||||||
cd frontend
|
cd frontend
|
||||||
npm ci
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
npm run check # 239/239 тестов, бюджеты, CSP
|
npm run check # 240/240 тестов, бюджеты, CSP
|
||||||
```
|
```
|
||||||
@@ -686,6 +686,58 @@
|
|||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Кабинет кафедры: селект графиков и строка комментариев ===== */
|
||||||
|
|
||||||
|
.department-subject-calendar-select {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 360px;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.45rem 0.65rem;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 1px solid var(--bg-card-border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.department-subject-calendar-select:focus {
|
||||||
|
outline: none;
|
||||||
|
background: var(--bg-input-focus);
|
||||||
|
border-color: var(--accent);
|
||||||
|
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.department-comments-row > td {
|
||||||
|
padding: 0.9rem 0.8rem 1rem;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border-bottom: 1px solid var(--bg-card-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.department-comments-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 0.75rem;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.department-comments-card .card-header-row {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.department-comments-card .card-header-row h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.department-comments-card .department-comment-list {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.schedule-section-label {
|
.schedule-section-label {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 0.78rem;
|
font-size: 0.78rem;
|
||||||
@@ -4187,9 +4239,9 @@ tbody tr:hover {
|
|||||||
.project-dialog-field textarea { width: 100%; resize: vertical; }
|
.project-dialog-field textarea { width: 100%; resize: vertical; }
|
||||||
.project-dialog-error { min-height: 1.3rem; margin-top: 0.35rem; color: var(--danger, #dc2626); font-size: 0.85rem; }
|
.project-dialog-error { min-height: 1.3rem; margin-top: 0.35rem; color: var(--danger, #dc2626); font-size: 0.85rem; }
|
||||||
|
|
||||||
/* ===== Êëàññû ýòàïà 5 (âîëíà 1): çàìåíà inline-ñòèëåé ïåðåíåñ¸ííûõ âêëàäîê ===== */
|
/* ===== ������ ����� 5 (����� 1): ������ inline-������ ����������� ������� ===== */
|
||||||
|
|
||||||
/* Çàãîëîâîê êàðòî÷êè ñ äåéñòâèåì ñïðàâà (àóäèòîðèè) */
|
/* ��������� �������� � ��������� ������ (���������) */
|
||||||
.card-toolbar {
|
.card-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -4203,7 +4255,7 @@ tbody tr:hover {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ñòðîêè è ãðóïïû ôîðì */
|
/* ������ � ������ ���� */
|
||||||
.form-row--spacing {
|
.form-row--spacing {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
@@ -4234,7 +4286,7 @@ tbody tr:hover {
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ß÷åéêè òàáëèö */
|
/* ������ ������ */
|
||||||
.th-actions {
|
.th-actions {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
@@ -4258,7 +4310,7 @@ tbody tr:hover {
|
|||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ìîäàëüíûå îêíà ïåðåíåñ¸ííûõ âêëàäîê */
|
/* ��������� ���� ����������� ������� */
|
||||||
.modal-content--medium {
|
.modal-content--medium {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
@@ -4287,7 +4339,7 @@ tbody tr:hover {
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ñîñòîÿíèå çàãðóçêè lazy-âêëàäêè */
|
/* ��������� �������� lazy-������� */
|
||||||
.tab-loading {
|
.tab-loading {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -4297,7 +4349,7 @@ tbody tr:hover {
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Äàøáîðä: ìåòðèêè è ìîíèòîðèíã */
|
/* �������: ������� � ���������� */
|
||||||
.dashboard-metric-label {
|
.dashboard-metric-label {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
@@ -4350,7 +4402,7 @@ tbody tr:hover {
|
|||||||
border: 1px solid rgba(16, 185, 129, 0.2);
|
border: 1px solid rgba(16, 185, 129, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Äàøáîðä: öåíòð ïðåäóïðåæäåíèé (Red Zone) */
|
/* �������: ����� �������������� (Red Zone) */
|
||||||
.red-zone-card {
|
.red-zone-card {
|
||||||
border-top: 4px solid var(--error, #ef4444);
|
border-top: 4px solid var(--error, #ef4444);
|
||||||
}
|
}
|
||||||
@@ -4390,9 +4442,9 @@ tbody tr:hover {
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Ýòàï 5 (âîëíà 2): êëàññû inline-ñòèëåé ïåðåíåñ¸ííûõ âêëàäîê ===== */
|
/* ===== ���� 5 (����� 2): ������ inline-������ ����������� ������� ===== */
|
||||||
|
|
||||||
/* Øèðîêèå ìîäàëüíûå îêíà (ïîäãðóïïû, ïðîôèëè, êàëåíäàðíûå ãðàôèêè) */
|
/* ������� ��������� ���� (���������, �������, ����������� �������) */
|
||||||
.modal-content--wide {
|
.modal-content--wide {
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
@@ -4408,7 +4460,7 @@ tbody tr:hover {
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ôîðìà ïðîôèëÿ íà âêëàäêå ñòðóêòóðû âóçà */
|
/* ����� ������� �� ������� ��������� ���� */
|
||||||
.profile-form-spec {
|
.profile-form-spec {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
@@ -4424,13 +4476,13 @@ tbody tr:hover {
|
|||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ðÿä êíîïîê ôîðìû, âûðîâíåííûõ ïî íèæíåé êðîìêå */
|
/* ��� ������ �����, ����������� �� ������ ������ */
|
||||||
.form-actions-row {
|
.form-actions-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
/* Âîëíà 3 (ýòàï 5): çàìåíà inline-ñòèëÿ èç legacy department-workspace.html */
|
/* ����� 3 (���� 5): ������ inline-����� �� legacy department-workspace.html */
|
||||||
.schedule-section-label--flush {
|
.schedule-section-label--flush {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ import { apiClient } from '../shared/api-client.js';
|
|||||||
import { defaultSchedulePeriod } from '../../admin/js/schedule-period.js';
|
import { defaultSchedulePeriod } from '../../admin/js/schedule-period.js';
|
||||||
import { toIsoDate } from '../shared/dates.js';
|
import { toIsoDate } from '../shared/dates.js';
|
||||||
|
|
||||||
export const SUBJECT_TABLE_COLUMNS = 4;
|
export const SUBJECT_TABLE_COLUMNS = 7;
|
||||||
export const DEPARTMENT_REQUEST_TABLE_COLUMNS = 6;
|
export const DEPARTMENT_REQUEST_TABLE_COLUMNS = 6;
|
||||||
|
|
||||||
// --- Справочники и период ---
|
// --- Справочники и период ---
|
||||||
@@ -109,6 +109,19 @@ export function attachmentGroupLabel(group) {
|
|||||||
return `${title} — ${semesterNumbersLabel(group.semesterNumbers)}`;
|
return `${title} — ${semesterNumbersLabel(group.semesterNumbers)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Уникальные значения поля прикреплений для сводных колонок (шифр, профиль).
|
||||||
|
export function uniqueAttachmentValues(attachments, field) {
|
||||||
|
const values = new Set();
|
||||||
|
(attachments || []).forEach(attachment => {
|
||||||
|
if (attachment && attachment[field]) values.add(attachment[field]);
|
||||||
|
});
|
||||||
|
return Array.from(values).sort((left, right) => left.localeCompare(right, 'ru'));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listValuesLabel(values) {
|
||||||
|
return (values || []).join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
export function importSubjectsPayload(rows, departmentId) {
|
export function importSubjectsPayload(rows, departmentId) {
|
||||||
if (!departmentId) return { error: 'Выберите кафедру' };
|
if (!departmentId) return { error: 'Выберите кафедру' };
|
||||||
const payload = (rows || [])
|
const payload = (rows || [])
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { Fragment, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { getSession } from '../../../admin/js/api.js';
|
import { getSession } from '../../../admin/js/api.js';
|
||||||
import { addDays, toIsoDate } from '../../shared/dates.js';
|
import { addDays, toIsoDate } from '../../shared/dates.js';
|
||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
formatDateTime,
|
formatDateTime,
|
||||||
importSubjects,
|
importSubjects,
|
||||||
importSubjectsPayload,
|
importSubjectsPayload,
|
||||||
|
listValuesLabel,
|
||||||
requestStatusClass,
|
requestStatusClass,
|
||||||
requestStatusLabel,
|
requestStatusLabel,
|
||||||
saveSubjectComment,
|
saveSubjectComment,
|
||||||
@@ -35,6 +36,7 @@ import {
|
|||||||
teacherMetrics,
|
teacherMetrics,
|
||||||
teacherOptionLabel,
|
teacherOptionLabel,
|
||||||
teacherRequestPayload,
|
teacherRequestPayload,
|
||||||
|
uniqueAttachmentValues,
|
||||||
workloadLabel
|
workloadLabel
|
||||||
} from '../department-workspace-service.js';
|
} from '../department-workspace-service.js';
|
||||||
|
|
||||||
@@ -693,6 +695,9 @@ export function DepartmentWorkspaceTab() {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Код</th>
|
<th>Код</th>
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
|
<th>Шифр</th>
|
||||||
|
<th>Профиль</th>
|
||||||
|
<th>Вид нагрузки</th>
|
||||||
<th>Календарный график</th>
|
<th>Календарный график</th>
|
||||||
<th>Комментарии</th>
|
<th>Комментарии</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -718,10 +723,17 @@ export function DepartmentWorkspaceTab() {
|
|||||||
</tr>
|
</tr>
|
||||||
) : visibleSubjects.map(subject => {
|
) : visibleSubjects.map(subject => {
|
||||||
const attachmentGroups = subjectAttachmentGroups(subject.attachments);
|
const attachmentGroups = subjectAttachmentGroups(subject.attachments);
|
||||||
|
const specialtyCode = listValuesLabel(uniqueAttachmentValues(subject.attachments, 'specialtyCode'));
|
||||||
|
const specialtyProfile = listValuesLabel(uniqueAttachmentValues(subject.attachments, 'specialtyProfileName'));
|
||||||
|
const lessonTypes = listValuesLabel(subject.lessonTypes);
|
||||||
return (
|
return (
|
||||||
<tr key={subject.id}>
|
<Fragment key={subject.id}>
|
||||||
|
<tr>
|
||||||
<td>{subject.code || '-'}</td>
|
<td>{subject.code || '-'}</td>
|
||||||
<td>{subject.name || '-'}</td>
|
<td>{subject.name || '-'}</td>
|
||||||
|
<td>{specialtyCode || '-'}</td>
|
||||||
|
<td>{specialtyProfile || '-'}</td>
|
||||||
|
<td>{lessonTypes || '-'}</td>
|
||||||
<td>
|
<td>
|
||||||
{attachmentGroups.length === 0 ? (
|
{attachmentGroups.length === 0 ? (
|
||||||
<span className="text-muted">Не прикреплена к графику</span>
|
<span className="text-muted">Не прикреплена к графику</span>
|
||||||
@@ -751,19 +763,14 @@ export function DepartmentWorkspaceTab() {
|
|||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
{comments && comments.subjectId === subject.id && (
|
||||||
})}
|
<tr className="department-comments-row" id="department-comments-row">
|
||||||
</tbody>
|
<td colSpan={SUBJECT_TABLE_COLUMNS}>
|
||||||
</table>
|
<div className="department-comments-card" id="department-comments-card">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{comments && (
|
|
||||||
<div className="card department-workspace-table-card" id="department-comments-card">
|
|
||||||
<div className="card-header-row">
|
<div className="card-header-row">
|
||||||
<h2 id="department-comments-title">
|
<h3 id="department-comments-title">
|
||||||
Комментарии: {comments.subjectName || 'дисциплина'}
|
Комментарии: {comments.subjectName || 'дисциплина'}
|
||||||
</h2>
|
</h3>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-sm btn-ghost"
|
className="btn btn-sm btn-ghost"
|
||||||
@@ -810,7 +817,16 @@ export function DepartmentWorkspaceTab() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
)}
|
)}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -127,6 +127,7 @@ import {
|
|||||||
formatDateTime,
|
formatDateTime,
|
||||||
importSubjects,
|
importSubjects,
|
||||||
importSubjectsPayload,
|
importSubjectsPayload,
|
||||||
|
listValuesLabel,
|
||||||
requestStatusClass,
|
requestStatusClass,
|
||||||
requestStatusLabel,
|
requestStatusLabel,
|
||||||
semesterNumbersLabel,
|
semesterNumbersLabel,
|
||||||
@@ -137,6 +138,7 @@ import {
|
|||||||
teacherOptionLabel,
|
teacherOptionLabel,
|
||||||
teacherRequestPayload,
|
teacherRequestPayload,
|
||||||
teacherWorkloadEndpoint,
|
teacherWorkloadEndpoint,
|
||||||
|
uniqueAttachmentValues,
|
||||||
workloadLabel
|
workloadLabel
|
||||||
} from '../react/admin/department-workspace-service.js';
|
} from '../react/admin/department-workspace-service.js';
|
||||||
import {
|
import {
|
||||||
@@ -1432,6 +1434,9 @@ test('вкладка кабинета кафедры рендерит формы
|
|||||||
assert.match(markup, /Все дисциплины/);
|
assert.match(markup, /Все дисциплины/);
|
||||||
assert.match(markup, /В календарных графиках/);
|
assert.match(markup, /В календарных графиках/);
|
||||||
assert.match(markup, /Без графика/);
|
assert.match(markup, /Без графика/);
|
||||||
|
assert.match(markup, /Шифр/);
|
||||||
|
assert.match(markup, /Профиль/);
|
||||||
|
assert.match(markup, /Вид нагрузки/);
|
||||||
assert.match(markup, /Календарный график/);
|
assert.match(markup, /Календарный график/);
|
||||||
assert.match(markup, /Загрузка\.\.\./);
|
assert.match(markup, /Загрузка\.\.\./);
|
||||||
assert.doesNotMatch(markup, /style="/);
|
assert.doesNotMatch(markup, /style="/);
|
||||||
@@ -1481,6 +1486,32 @@ test('прикрепления дисциплины группируются п
|
|||||||
assert.deepEqual(subjectAttachmentGroups([]), []);
|
assert.deepEqual(subjectAttachmentGroups([]), []);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('сводные колонки дисциплин собирают уникальные шифры и профили', () => {
|
||||||
|
const attachments = [
|
||||||
|
{ calendarId: 2, specialtyCode: '10.03.01', specialtyProfileName: 'Без профиля' },
|
||||||
|
{ calendarId: 5, specialtyCode: '09.03.01', specialtyProfileName: 'Без профиля' },
|
||||||
|
{ calendarId: 2, specialtyCode: '10.03.01', specialtyProfileName: 'Без профиля' }
|
||||||
|
];
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
uniqueAttachmentValues(attachments, 'specialtyCode'),
|
||||||
|
['09.03.01', '10.03.01']
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
uniqueAttachmentValues(attachments, 'specialtyProfileName'),
|
||||||
|
['Без профиля']
|
||||||
|
);
|
||||||
|
assert.equal(listValuesLabel(uniqueAttachmentValues(attachments, 'specialtyCode')), '09.03.01, 10.03.01');
|
||||||
|
assert.equal(listValuesLabel(uniqueAttachmentValues(attachments, 'specialtyProfileName')), 'Без профиля');
|
||||||
|
// без прикреплений колонки пустые
|
||||||
|
assert.deepEqual(uniqueAttachmentValues([], 'specialtyCode'), []);
|
||||||
|
assert.deepEqual(uniqueAttachmentValues(null, 'specialtyCode'), []);
|
||||||
|
assert.equal(listValuesLabel([]), '');
|
||||||
|
assert.equal(listValuesLabel(null), '');
|
||||||
|
// виды нагрузки дисциплины выводятся списком через запятую
|
||||||
|
assert.equal(listValuesLabel(['Лекции', 'Лабораторные занятия']), 'Лекции, Лабораторные занятия');
|
||||||
|
});
|
||||||
|
|
||||||
test('двухнедельный период загруженности считается по локальному времени', () => {
|
test('двухнедельный период загруженности считается по локальному времени', () => {
|
||||||
assert.deepEqual(twoWeekRange('2026-09-28'), { startDate: '2026-09-28', endDate: '2026-10-11' });
|
assert.deepEqual(twoWeekRange('2026-09-28'), { startDate: '2026-09-28', endDate: '2026-10-11' });
|
||||||
// среда 30.09 — период всё равно начинается с понедельника
|
// среда 30.09 — период всё равно начинается с понедельника
|
||||||
|
|||||||
Reference in new issue
Block a user