Compare commits

...

1 Commits

Author SHA1 Message Date
Дмитрий ddad894404 fix(сделки): в колонке «Конкурент» показываем только бренд (без описания)
Имя конкурента в БД хранится как «Бренд, описание…» (напр. «AutoMoney,
микрокредитная компания»). Показывали полностью — описание, которое просили
убрать, возвращалось. Теперь берём часть до первой запятой (полное имя — в title).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 08:17:20 +03:00
2 changed files with 33 additions and 1 deletions
@@ -36,6 +36,14 @@ function sourceSignalLabel(deal: MockDeal): string {
return t ? (SIGNAL_LABELS[t] ?? '') : '';
}
// «Конкурент» — только бренд, без описания: имя конкурента хранится как
// «Бренд, описание…», в колонке показываем часть до первой запятой.
function competitorShort(name: string | null | undefined): string {
if (!name) return '';
const i = name.indexOf(',');
return (i === -1 ? name : name.slice(0, i)).trim();
}
function formatDateTime(iso: string | null | undefined): string {
if (!iso) return '—';
const d = new Date(iso);
@@ -85,8 +93,9 @@ function rowProps(deal: MockDeal): Record<string, unknown> {
v-if="item.competitorId"
class="cell-link"
:to="{ name: 'autopodbor', query: { competitor: String(item.competitorId) } }"
:title="item.competitorName ?? undefined"
@click.stop
>{{ item.competitorName }}</router-link
>{{ competitorShort(item.competitorName) }}</router-link
>
<span v-else class="text-medium-emphasis">—</span>
</template>
+23
View File
@@ -128,6 +128,29 @@ describe('DealsTable', () => {
expect(links[1].props('to')).toMatchObject({ name: 'autopodbor', query: { competitor: '3', project: '5' } });
});
it('«Конкурент» показывает только бренд, без описания (до первой запятой)', () => {
const deal: MockDeal = {
id: 13,
name: 'z',
phone: 'z',
statusSlug: 'new',
project: 'X',
manager: { initials: '—', name: '—' },
cost: 0,
receivedMinutesAgo: 1,
competitorId: 7,
competitorName: 'Сфера займа24, микрокредитная компания',
sourceIdentifier: '79029826282',
sourceSignalType: 'call',
sourceProjectId: 9,
sourceIsActive: true,
sourceExtraCount: 0,
};
const w = mountTable([deal]);
expect(w.text()).toContain('Сфера займа24');
expect(w.text()).not.toContain('микрокредитная компания');
});
it('показывает « · +N» при нескольких источниках проекта', () => {
const deal: MockDeal = {
id: 11,