diff --git a/lib/lesson-reports.js b/lib/lesson-reports.js index d355c8a..814c71f 100644 --- a/lib/lesson-reports.js +++ b/lib/lesson-reports.js @@ -1,5 +1,4 @@ const LESSON_REPORT_EDIT_DENIED = 'Изменять отчёт о занятии может только его автор или администратор'; -const LESSON_TOPIC_MATCH_WINDOW_SEC = 3600; function lessonReportEditable(report, user) { if (!report || !user) return false; @@ -18,23 +17,20 @@ function stripLessonTopicNumber(topic) { return String(topic || '').trim().replace(/\s*\d+\s*\/\s*\d+\s*$/, '').trim(); } -async function findCurrentLessonTopic(pool, { groupId, timezone, windowSec = LESSON_TOPIC_MATCH_WINDOW_SEC }) { +async function findCurrentLessonTopic(pool, { groupId, timezone }) { const { rows } = await pool.query(` SELECT lr.topic FROM lesson_reports lr WHERE lr.group_id = $2 AND lr.lesson_date = (now() AT TIME ZONE $1)::date - AND lr.lesson_time IS NOT NULL - AND ABS(EXTRACT(EPOCH FROM (lr.lesson_time - (now() AT TIME ZONE $1)::time))) <= $3 - ORDER BY ABS(EXTRACT(EPOCH FROM (lr.lesson_time - (now() AT TIME ZONE $1)::time))) ASC, lr.id DESC + ORDER BY lr.lesson_time NULLS LAST, lr.id DESC LIMIT 1 - `, [timezone, groupId, windowSec]); + `, [timezone, groupId]); return rows.length ? stripLessonTopicNumber(rows[0].topic) || null : null; } module.exports = { LESSON_REPORT_EDIT_DENIED, - LESSON_TOPIC_MATCH_WINDOW_SEC, lessonReportEditable, lessonReportWriteBlocked, stripLessonTopicNumber, diff --git a/public/admin.css b/public/admin.css index 6c79a6d..42768ba 100644 --- a/public/admin.css +++ b/public/admin.css @@ -74,7 +74,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b .sidebar nav a[data-nav=sidebar]{--nav-ink:#7e22ce} .sidebar nav a svg{color:var(--nav-ink,var(--muted))} .sidebar nav a.active svg{color:var(--accent)} -.sidebar nav a .nav-dot{width:9px;height:9px;border-radius:50%;flex-shrink:0;border:0;padding:0;background:#d4d4d8;color:var(--nav-ink,var(--accent));cursor:pointer;position:relative;transition:background .14s ease,transform .14s ease} +.sidebar nav a .nav-dot{width:9px;height:9px;border-radius:50%;flex-shrink:0;border:0;padding:0;color:var(--nav-ink,var(--accent));cursor:pointer;position:relative;transition:background .14s ease,transform .14s ease} .sidebar nav a .nav-dot::after{content:'';position:absolute;inset:-6px;border-radius:50%} .sidebar nav a:hover .nav-dot{background:#a1a1aa;transform:scale(1.1)} .sidebar nav a .nav-dot.on{background:currentColor;box-shadow:0 0 0 3px rgba(0,0,0,.06);transform:none}