fix: cambiar 'dueño' a 'responsable' y quitar comillas en descripciones

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
pull/1/head
borja 2 months ago
parent bd79454b01
commit 3b41c01360

@ -206,14 +206,14 @@ export class CommandService {
if (items.length === 0) { if (items.length === 0) {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: `No hay tareas sin dueño en ${groupName}.` message: `No hay tareas sin responsable en ${groupName}.`
}]; }];
} }
const rendered = items.map((t) => { const rendered = items.map((t) => {
const isOverdue = t.due_date ? t.due_date < todayYMD : false; const isOverdue = t.due_date ? t.due_date < todayYMD : false;
const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : ''; const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : '';
return `- ${t.id}) “*${t.description || '(sin descripción)'}*”${datePart}${ICONS.unassigned} sin dueño`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${ICONS.unassigned} sin responsable`;
}); });
const total = TaskService.countGroupUnassigned(context.groupId); const total = TaskService.countGroupUnassigned(context.groupId);
@ -223,7 +223,7 @@ export class CommandService {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: [`${groupName} — Sin dueño`, ...rendered].join('\n') message: [`${groupName} — Sin responsable`, ...rendered].join('\n')
}]; }];
} }
@ -258,11 +258,11 @@ export class CommandService {
); );
const owner = const owner =
(t.assignees?.length || 0) === 0 (t.assignees?.length || 0) === 0
? `${ICONS.unassigned} sin dueño` ? `${ICONS.unassigned} sin responsable`
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`; : `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
const isOverdue = t.due_date ? t.due_date < todayYMD : false; const isOverdue = t.due_date ? t.due_date < todayYMD : false;
const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : ''; const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : '';
return `- ${t.id}) “*${t.description || '(sin descripción)'}*”${datePart}${owner}`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${owner}`;
})); }));
sections.push(...rendered); sections.push(...rendered);
} }
@ -283,11 +283,11 @@ export class CommandService {
const groupName = GroupSyncService.activeGroupsCache.get(context.groupId) || context.groupId; const groupName = GroupSyncService.activeGroupsCache.get(context.groupId) || context.groupId;
const unassigned = TaskService.listGroupUnassigned(context.groupId, LIMIT); const unassigned = TaskService.listGroupUnassigned(context.groupId, LIMIT);
if (unassigned.length > 0) { if (unassigned.length > 0) {
sections.push(`${groupName} — Sin dueño`); sections.push(`${groupName} — Sin responsable`);
const renderedUnassigned = unassigned.map((t) => { const renderedUnassigned = unassigned.map((t) => {
const isOverdue = t.due_date ? t.due_date < todayYMD : false; const isOverdue = t.due_date ? t.due_date < todayYMD : false;
const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : ''; const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : '';
return `- ${t.id}) “*${t.description || '(sin descripción)'}*”${datePart}${ICONS.unassigned} sin dueño`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${ICONS.unassigned} sin responsable`;
}); });
sections.push(...renderedUnassigned); sections.push(...renderedUnassigned);
@ -296,12 +296,12 @@ export class CommandService {
sections.push(`… y ${totalUnassigned - unassigned.length} más`); sections.push(`… y ${totalUnassigned - unassigned.length} más`);
} }
} else { } else {
sections.push(`${groupName} — Sin dueño\n(no hay tareas sin dueño)`); sections.push(`${groupName} — Sin responsable\n(no hay tareas sin responsable)`);
} }
} }
} else { } else {
// En DM: nota instructiva // En DM: nota instructiva
sections.push(' Para ver tareas sin dueño de un grupo, usa “/t ver sin” desde ese grupo.'); sections.push(' Para ver tareas sin responsable de un grupo, usa “/t ver sin” desde ese grupo.');
} }
return [{ return [{
@ -340,11 +340,11 @@ export class CommandService {
); );
const owner = const owner =
(t.assignees?.length || 0) === 0 (t.assignees?.length || 0) === 0
? `${ICONS.unassigned} sin dueño` ? `${ICONS.unassigned} sin responsable`
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`; : `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
const isOverdue = t.due_date ? t.due_date < todayYMD : false; const isOverdue = t.due_date ? t.due_date < todayYMD : false;
const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : ''; const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : '';
return `- ${t.id}) “*${t.description || '(sin descripción)'}*”${datePart}${owner}`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${owner}`;
})); }));
const total = TaskService.countGroupPending(context.groupId); const total = TaskService.countGroupPending(context.groupId);
@ -391,11 +391,11 @@ export class CommandService {
); );
const owner = const owner =
(t.assignees?.length || 0) === 0 (t.assignees?.length || 0) === 0
? `${ICONS.unassigned} sin dueño` ? `${ICONS.unassigned} sin responsable`
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`; : `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
const isOverdue = t.due_date ? t.due_date < todayYMD : false; const isOverdue = t.due_date ? t.due_date < todayYMD : false;
const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : ''; const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : '';
return `- ${t.id}) “*${t.description || '(sin descripción)'}*”${datePart}${owner}`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${owner}`;
})); }));
sections.push(...rendered); sections.push(...rendered);
} }
@ -434,14 +434,14 @@ export class CommandService {
const due = res.task?.due_date ? ` — 📅 ${formatDDMM(res.task?.due_date)}` : ''; const due = res.task?.due_date ? ` — 📅 ${formatDDMM(res.task?.due_date)}` : '';
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: ` ${id} ya estaba completada — “*${res.task?.description || '(sin descripción)'}*”${due}` message: ` ${id} ya estaba completada — _${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
const due = res.task?.due_date ? ` — 📅 ${formatDDMM(res.task?.due_date)}` : ''; const due = res.task?.due_date ? ` — 📅 ${formatDDMM(res.task?.due_date)}` : '';
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: `${ICONS.complete} ${id} completada — “*${res.task?.description || '(sin descripción)'}*”${due}\nGracias, ${who}.` message: `${ICONS.complete} ${id} completada — _${res.task?.description || '(sin descripción)'}_${due}\nGracias, ${who}.`
}]; }];
} }
@ -468,19 +468,19 @@ export class CommandService {
if (res.status === 'completed') { if (res.status === 'completed') {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: ` ${id} ya estaba completada — “*${res.task?.description || '(sin descripción)'}*”${due}` message: ` ${id} ya estaba completada — _${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
if (res.status === 'already') { if (res.status === 'already') {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: ` ${id} ya la tenías — “*${res.task?.description || '(sin descripción)'}*”${due}` message: ` ${id} ya la tenías — _${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: `${ICONS.take} Has tomado ${id}“*${res.task?.description || '(sin descripción)'}*”${due}` message: `${ICONS.take} Has tomado ${id}_${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
@ -513,20 +513,20 @@ export class CommandService {
if (res.status === 'not_assigned') { if (res.status === 'not_assigned') {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: ` ${id} no la tenías asignada — “*${res.task?.description || '(sin descripción)'}*”${due}` message: ` ${id} no la tenías asignada — _${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
if (res.now_unassigned) { if (res.now_unassigned) {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: `${ICONS.unassigned} ${id} queda sin dueño — “*${res.task?.description || '(sin descripción)'}*”${due}` message: `${ICONS.unassigned} ${id} queda sin responsable — _${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: `${ICONS.unassign} Has soltado ${id}“*${res.task?.description || '(sin descripción)'}*”${due}` message: `${ICONS.unassign} Has soltado ${id}_${res.task?.description || '(sin descripción)'}_${due}`
}]; }];
} }
@ -661,12 +661,12 @@ export class CommandService {
const responses: CommandResponse[] = []; const responses: CommandResponse[] = [];
// 1) Ack al creador con formato compacto // 1) Ack al creador con formato compacto
const ackHeader = `${ICONS.create} ${taskId} “*${description || '(sin descripción)'}*”`; const ackHeader = `${ICONS.create} ${taskId} _${description || '(sin descripción)'}_`;
const ackLines: string[] = [ackHeader]; const ackLines: string[] = [ackHeader];
const dueFmt = formatDDMM(dueDate); const dueFmt = formatDDMM(dueDate);
if (dueFmt) ackLines.push(`${ICONS.date} ${dueFmt}`); if (dueFmt) ackLines.push(`${ICONS.date} ${dueFmt}`);
if (assignmentUserIds.length === 0) { if (assignmentUserIds.length === 0) {
ackLines.push(`${ICONS.unassigned} sin dueño${groupName ? ` (${groupName})` : ''}`); ackLines.push(`${ICONS.unassigned} sin responsable${groupName ? ` (${groupName})` : ''}`);
} else { } else {
const assigneesList = assignedDisplayNames.join(', '); const assigneesList = assignedDisplayNames.join(', ');
ackLines.push(`${assignmentUserIds.length > 1 ? '👥' : '👤'} ${assigneesList}`); ackLines.push(`${assignmentUserIds.length > 1 ? '👥' : '👤'} ${assigneesList}`);
@ -684,7 +684,7 @@ export class CommandService {
recipient: uid, recipient: uid,
message: [ message: [
`${ICONS.assignNotice} Tarea ${taskId}${formatDDMM(dueDate) ? `${ICONS.date} ${formatDDMM(dueDate)}` : ''}`, `${ICONS.assignNotice} Tarea ${taskId}${formatDDMM(dueDate) ? `${ICONS.date} ${formatDDMM(dueDate)}` : ''}`,
`“*${description || '(sin descripción)'}*”`, `_${description || '(sin descripción)'}_`,
groupName ? `Grupo: ${groupName}` : null, groupName ? `Grupo: ${groupName}` : null,
`Completar: /t x ${taskId}` `Completar: /t x ${taskId}`
].filter(Boolean).join('\n'), ].filter(Boolean).join('\n'),

@ -139,11 +139,11 @@ export class RemindersService {
); );
const owner = const owner =
(t.assignees?.length || 0) === 0 (t.assignees?.length || 0) === 0
? `${ICONS.unassigned} sin dueño` ? `${ICONS.unassigned} sin responsable`
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`; : `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
const isOverdue = t.due_date ? t.due_date < todayYMD : false; const isOverdue = t.due_date ? t.due_date < todayYMD : false;
const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : ''; const datePart = t.due_date ? `${isOverdue ? `${ICONS.warn} ` : ''}${ICONS.date} ${formatDDMM(t.due_date)}` : '';
return `- ${t.id}) “*${t.description || '(sin descripción)'}*”${datePart}${owner}`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${owner}`;
})); }));
sections.push(...rendered); sections.push(...rendered);
} }

@ -834,7 +834,7 @@ describe('WebhookServer', () => {
expect(r.recipient.endsWith('@g.us')).toBe(false); expect(r.recipient.endsWith('@g.us')).toBe(false);
} }
const msg = out.map(x => x.message).join('\n'); const msg = out.map(x => x.message).join('\n');
expect(msg).toContain('sin dueño'); expect(msg).toContain('sin responsable');
expect(msg).toContain('… y 2 más'); expect(msg).toContain('… y 2 más');
}); });
@ -903,7 +903,7 @@ describe('WebhookServer', () => {
expect(out.length).toBeGreaterThan(0); expect(out.length).toBeGreaterThan(0);
const msg = out.map(x => x.message).join('\n'); const msg = out.map(x => x.message).join('\n');
expect(msg).toContain('Tus tareas'); expect(msg).toContain('Tus tareas');
expect(msg).toContain('sin dueño'); expect(msg).toContain('sin responsable');
expect(msg).toContain('… y 2 más'); expect(msg).toContain('… y 2 más');
}); });
@ -933,7 +933,7 @@ describe('WebhookServer', () => {
expect(out.length).toBeGreaterThan(0); expect(out.length).toBeGreaterThan(0);
const msg = out.map(x => x.message).join('\n'); const msg = out.map(x => x.message).join('\n');
expect(msg).toContain('Tus tareas'); expect(msg).toContain('Tus tareas');
expect(msg).toContain(' Para ver tareas sin dueño'); expect(msg).toContain(' Para ver tareas sin responsable');
}); });
}); });
}); });

@ -89,7 +89,7 @@ describe('CommandService - /t tomar y /t soltar', () => {
it('soltar: si queda sin dueño, mensaje adecuado', async () => { it('soltar: si queda sin dueño, mensaje adecuado', async () => {
const taskId = createTask('Desc soltar', '999', '2025-09-12', ['111']); const taskId = createTask('Desc soltar', '999', '2025-09-12', ['111']);
const res = await CommandService.handle(ctx('111', `/t soltar ${taskId}`)); const res = await CommandService.handle(ctx('111', `/t soltar ${taskId}`));
expect(res[0].message).toContain('queda sin dueño'); expect(res[0].message).toContain('queda sin responsable');
expect(res[0].message).toContain(String(taskId)); expect(res[0].message).toContain(String(taskId));
}); });

Loading…
Cancel
Save