Improve photo search: include path, student name, and group name in search query

This commit is contained in:
dev
2026-11-01 21:35:53 +03:00
parent 773e092253
commit 574f1bc204
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
<div class="main">
<h2>Фото</h2>
<div class="filters">
<div><label>Поиск</label><input type="text" id="searchInput" class="search-input" placeholder="Описание или имя"></div>
<div><label>Поиск</label><input type="text" id="searchInput" class="search-input" placeholder="Описание, файл или имя"></div>
<div><label>Ученик</label><input type="text" id="studentFilter" list="studentFilterList" placeholder="Все / введите имя..."><datalist id="studentFilterList"></datalist></div>
<div><label>По лицам</label><select id="faceStudentFilter"><option value="">Без фильтра</option><option value="__unassigned__">Неопознанные лица</option></select></div>
<div><label>Группа</label><select id="groupFilter"><option value="">Все группы</option></select></div>
+1 -1
View File
@@ -11446,7 +11446,7 @@ app.get('/api/photos', requireAuth, async (req, res) => {
try {
const conditions = [];
const params = [];
if (search) { params.push(`%${search}%`); conditions.push(`t.title ILIKE $${params.length}`); }
if (search) { params.push(`%${search}%`); conditions.push(`(t.title ILIKE $${params.length} OR t.path ILIKE $${params.length} OR COALESCE(t.student_name, '') ILIKE $${params.length} OR COALESCE(t.group_name, '') ILIKE $${params.length})`); }
if (student_name) { params.push(student_name); conditions.push(`t.student_name = $${params.length}`); }
if (group_id) { params.push(group_id); conditions.push(`t.group_id = $${params.length}`); }
if (student_id) {