Поправил графики
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { api, getSession } from '../api.js';
|
||||
import { escapeHtml, showAlert, hideAlert } from '../utils.js';
|
||||
import { preferredScheduleSemester } from '../schedule-period.js';
|
||||
import { canEditScheduleOverrides, createScheduleOverridePanel } from './schedule-override-panel.js';
|
||||
|
||||
const ROLE_DEPARTMENT = 'DEPARTMENT';
|
||||
@@ -321,17 +322,7 @@ export async function initScheduleView() {
|
||||
|
||||
function buildSectionContext(target) {
|
||||
const selectedGroupId = target === TARGET_GROUPS ? normalizeId(valueOf('schedule-view-group')) : '';
|
||||
const selectedDepartmentId = role === ROLE_DEPARTMENT
|
||||
? userDepartmentId
|
||||
: (target === TARGET_DEPARTMENTS ? normalizeId(valueOf('schedule-view-department')) : '');
|
||||
const allowedGroupIds = new Set();
|
||||
if (selectedGroupId) {
|
||||
allowedGroupIds.add(selectedGroupId);
|
||||
} else if (selectedDepartmentId) {
|
||||
state.dictionaries.groups
|
||||
.filter(group => String(group.departmentId) === String(selectedDepartmentId))
|
||||
.forEach(group => allowedGroupIds.add(String(group.id)));
|
||||
}
|
||||
const allowedGroupIds = allowedGroupIdsForScheduleTarget(target, selectedGroupId);
|
||||
return {
|
||||
selectedGroupId,
|
||||
selectedGroupName: selectedGroupId ? groupNameById(selectedGroupId) : '',
|
||||
@@ -801,8 +792,11 @@ export async function initScheduleView() {
|
||||
|
||||
function selectCurrentSemester() {
|
||||
if (!semesterSelect) return;
|
||||
const currentSemester = findSemesterForDate(state.dictionaries.semesters, dateInput.value);
|
||||
semesterSelect.value = currentSemester ? String(currentSemester.id) : '';
|
||||
const preferredSemester = preferredScheduleSemester(
|
||||
state.dictionaries.semesters,
|
||||
dateInput.value
|
||||
);
|
||||
semesterSelect.value = preferredSemester ? String(preferredSemester.id) : '';
|
||||
synchronizeDateWithSemester();
|
||||
updatePeriodLabel();
|
||||
}
|
||||
@@ -960,6 +954,12 @@ function buildScheduleSections(lessons, splitType, context) {
|
||||
.sort((a, b) => naturalCompare(a.title, b.title));
|
||||
}
|
||||
|
||||
export function allowedGroupIdsForScheduleTarget(target, selectedGroupId) {
|
||||
return target === TARGET_GROUPS && selectedGroupId
|
||||
? new Set([String(selectedGroupId)])
|
||||
: new Set();
|
||||
}
|
||||
|
||||
function splitEntitiesForLesson(lesson, splitType, context) {
|
||||
if (splitType === TARGET_TEACHERS) {
|
||||
return [singleEntity('teacher', lesson.teacherId, lesson.teacherName, 'Преподаватель не указан')];
|
||||
|
||||
Reference in New Issue
Block a user