|
|
|
|
@ -206,14 +206,14 @@ export class CommandService {
|
|
|
|
|
if (items.length === 0) {
|
|
|
|
|
return [{
|
|
|
|
|
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 isOverdue = t.due_date ? t.due_date < todayYMD : false;
|
|
|
|
|
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);
|
|
|
|
|
@ -223,7 +223,7 @@ export class CommandService {
|
|
|
|
|
|
|
|
|
|
return [{
|
|
|
|
|
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 =
|
|
|
|
|
(t.assignees?.length || 0) === 0
|
|
|
|
|
? `${ICONS.unassigned} sin dueño`
|
|
|
|
|
? `${ICONS.unassigned} sin responsable`
|
|
|
|
|
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
|
|
|
|
|
const isOverdue = t.due_date ? t.due_date < todayYMD : false;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
@ -283,11 +283,11 @@ export class CommandService {
|
|
|
|
|
const groupName = GroupSyncService.activeGroupsCache.get(context.groupId) || context.groupId;
|
|
|
|
|
const unassigned = TaskService.listGroupUnassigned(context.groupId, LIMIT);
|
|
|
|
|
if (unassigned.length > 0) {
|
|
|
|
|
sections.push(`${groupName} — Sin dueño`);
|
|
|
|
|
sections.push(`${groupName} — Sin responsable`);
|
|
|
|
|
const renderedUnassigned = unassigned.map((t) => {
|
|
|
|
|
const isOverdue = t.due_date ? t.due_date < todayYMD : false;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
@ -296,12 +296,12 @@ export class CommandService {
|
|
|
|
|
sections.push(`… y ${totalUnassigned - unassigned.length} más`);
|
|
|
|
|
}
|
|
|
|
|
} 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 {
|
|
|
|
|
// 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 [{
|
|
|
|
|
@ -340,11 +340,11 @@ export class CommandService {
|
|
|
|
|
);
|
|
|
|
|
const owner =
|
|
|
|
|
(t.assignees?.length || 0) === 0
|
|
|
|
|
? `${ICONS.unassigned} sin dueño`
|
|
|
|
|
? `${ICONS.unassigned} sin responsable`
|
|
|
|
|
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
|
|
|
|
|
const isOverdue = t.due_date ? t.due_date < todayYMD : false;
|
|
|
|
|
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);
|
|
|
|
|
@ -391,11 +391,11 @@ export class CommandService {
|
|
|
|
|
);
|
|
|
|
|
const owner =
|
|
|
|
|
(t.assignees?.length || 0) === 0
|
|
|
|
|
? `${ICONS.unassigned} sin dueño`
|
|
|
|
|
? `${ICONS.unassigned} sin responsable`
|
|
|
|
|
: `${t.assignees!.length > 1 ? '👥' : '👤'} ${names.join(', ')}`;
|
|
|
|
|
const isOverdue = t.due_date ? t.due_date < todayYMD : false;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
@ -434,14 +434,14 @@ export class CommandService {
|
|
|
|
|
const due = res.task?.due_date ? ` — 📅 ${formatDDMM(res.task?.due_date)}` : '';
|
|
|
|
|
return [{
|
|
|
|
|
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)}` : '';
|
|
|
|
|
return [{
|
|
|
|
|
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') {
|
|
|
|
|
return [{
|
|
|
|
|
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') {
|
|
|
|
|
return [{
|
|
|
|
|
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 [{
|
|
|
|
|
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') {
|
|
|
|
|
return [{
|
|
|
|
|
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) {
|
|
|
|
|
return [{
|
|
|
|
|
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 [{
|
|
|
|
|
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[] = [];
|
|
|
|
|
|
|
|
|
|
// 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 dueFmt = formatDDMM(dueDate);
|
|
|
|
|
if (dueFmt) ackLines.push(`${ICONS.date} ${dueFmt}`);
|
|
|
|
|
if (assignmentUserIds.length === 0) {
|
|
|
|
|
ackLines.push(`${ICONS.unassigned} sin dueño${groupName ? ` (${groupName})` : ''}`);
|
|
|
|
|
ackLines.push(`${ICONS.unassigned} sin responsable${groupName ? ` (${groupName})` : ''}`);
|
|
|
|
|
} else {
|
|
|
|
|
const assigneesList = assignedDisplayNames.join(', ');
|
|
|
|
|
ackLines.push(`${assignmentUserIds.length > 1 ? '👥' : '👤'} ${assigneesList}`);
|
|
|
|
|
@ -684,7 +684,7 @@ export class CommandService {
|
|
|
|
|
recipient: uid,
|
|
|
|
|
message: [
|
|
|
|
|
`${ICONS.assignNotice} Tarea ${taskId}${formatDDMM(dueDate) ? ` — ${ICONS.date} ${formatDDMM(dueDate)}` : ''}`,
|
|
|
|
|
`“*${description || '(sin descripción)'}*”`,
|
|
|
|
|
`_${description || '(sin descripción)'}_`,
|
|
|
|
|
groupName ? `Grupo: ${groupName}` : null,
|
|
|
|
|
`Completar: /t x ${taskId}`
|
|
|
|
|
].filter(Boolean).join('\n'),
|
|
|
|
|
|