Отбор работ подрядчика: совпадение по началу слова (wall не находит Drywall)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,12 +138,12 @@ export function pgResolveStore(db: Queryable): ResolveStore {
|
||||
return rows.map((r) => ({ jobId: String(r.job_id), name: String(r.name) }));
|
||||
},
|
||||
async vendorAssignments(jobId, terms) {
|
||||
const like = terms.map((t) => `%${t.replace(/[%_\\]/g, "")}%`);
|
||||
const like = terms.map((t) => `\\m${t.replace(/[^a-z0-9а-яё]/g, "")}`); // начало слова: "wall" не находит "Drywall"
|
||||
const { rows } = await db.query(
|
||||
`select t.id as task_id, t.name as task_name, a.membership_id
|
||||
from jt_task t join jt_task_assignment a on a.task_id = t.id join jt_membership m on m.id = a.membership_id and m.role = 'Vendor'
|
||||
where t.job_id = $1 and not t.is_deleted and not t.is_todo and not t.is_group and coalesce(t.progress, 0) < 1
|
||||
and ($2::text[] = '{}' or t.name ilike any($2::text[]))
|
||||
and ($2::text[] = '{}' or t.name ~* any($2::text[]))
|
||||
order by t.start_date nulls last, t.name`,
|
||||
[jobId, like],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user