fix(leads): give a new form lead the same owner as its first call

When a form has no round-robin assignees, the lead now follows the person the automation assigns to the first call.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-29 19:30:13 +03:30
co-authored by Cursor
parent b9bb2ff9fa
commit 99d686fefb
5 changed files with 78 additions and 1 deletions
@@ -10,6 +10,7 @@ import {
type AutomationStep,
} from '@mento/shared';
import {
claimLeadAssignee,
formatFormAnswers,
pickRoundRobin,
renderAutomationTemplate,
@@ -136,6 +137,13 @@ describe('اتوماسیون شاخه‌ای فرم', () => {
);
});
it('مسئول سرنخ فقط از اولین فعالیت دارای مسئول پر می‌شود', () => {
assert.equal(claimLeadAssignee(false, null), null);
assert.equal(claimLeadAssignee(false, ' '), null);
assert.equal(claimLeadAssignee(false, 'romina'), 'romina');
assert.equal(claimLeadAssignee(true, 'fatemeh'), null);
});
it('تقسیم نوبتی مساوی و پایدار', () => {
const team = ['u3', 'u1', 'u2'];
const picks = [1, 2, 3, 4, 5, 6].map((n) => pickRoundRobin(team, n));