Merge branch 'Redesign' of https://gitea.zuev.company/Zuev/magistr into Redesign

This commit is contained in:
dipatrik10
2026-08-14 23:41:59 +03:00
10 changed files with 118 additions and 35 deletions

View File

@@ -186,7 +186,7 @@ function renderProblems() {
`).join('')}</span>
<small>
Правило #${escapeHtml(String(problem.scheduleRuleId || '—'))}
· ${escapeHtml(String(affectedLessonCount))} ${escapeHtml(lessonWord(affectedLessonCount))} снижают оценку
· затронуто ${escapeHtml(String(affectedLessonCount))} ${escapeHtml(lessonWord(affectedLessonCount))}
· суммарный штраф
</small>
</span>
@@ -238,7 +238,7 @@ function renderRuleDetails(problem) {
<div class="quality-recommendations-head">
<span class="quality-kicker">Правило #${escapeHtml(String(problem.scheduleRuleId || '—'))}</span>
<h3>${escapeHtml(problem.subjectName || problem.title)}</h3>
<p>${escapeHtml(String(affectedLessonCount))} ${escapeHtml(lessonWord(affectedLessonCount))} снижают оценку; суммарный штраф −${escapeHtml(String(problem.penalty))}.</p>
<p>Затронуто ${escapeHtml(String(affectedLessonCount))} ${escapeHtml(lessonWord(affectedLessonCount))}; суммарный штраф −${escapeHtml(String(problem.penalty))}.</p>
</div>
<div class="quality-rule-detail-list">
${issueLabels.map(label => `<span>${escapeHtml(label)}</span>`).join('')}

View File

@@ -491,12 +491,25 @@ export async function initSchedule() {
}
renderRules();
renderVisualSchedule();
openRequestedRule();
} catch (error) {
rulesTbody.innerHTML = `<tr><td colspan="7" class="loading-row">Ошибка загрузки: ${escapeHtml(error.message)}</td></tr>`;
setVisualState('Ошибка загрузки правил расписания');
}
}
function openRequestedRule() {
const requestedRuleId = localStorage.getItem('magistr.schedule.openRuleId');
if (!requestedRuleId) return;
localStorage.removeItem('magistr.schedule.openRuleId');
const rule = rules.find(item => String(item.id) === requestedRuleId);
if (!rule) {
showAlert('schedule-rule-alert', 'Не удалось найти выбранное правило в этом расписании.', 'error');
return;
}
fillRuleForm(rule);
}
function renderRules() {
if (!rules.length) {
rulesTbody.innerHTML = '<tr><td colspan="7" class="loading-row">Правила расписания не созданы</td></tr>';
@@ -2079,6 +2092,13 @@ export async function initSchedule() {
return new Date(year, month - 1, day);
}
function localIsoDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
function compactWeekRanges(weeks, maxWeeks, parity) {
const uniqueWeeks = [...new Set((weeks || []).map(Number).filter(Boolean))].sort((a, b) => a - b);
if (!uniqueWeeks.length) return '';