|
|
|
|
@ -239,7 +239,7 @@ export class CommandService {
|
|
|
|
|
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 `- ${codeId(t.id)} _${t.description || '(sin descripción)'}_${datePart} — ${ICONS.unassigned} sin responsable`;
|
|
|
|
|
return `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart} — ${ICONS.unassigned} sin responsable`;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const total = TaskService.countGroupUnassigned(context.groupId);
|
|
|
|
|
@ -288,9 +288,15 @@ export class CommandService {
|
|
|
|
|
: `${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 `- ${codeId(t.id)} _${t.description || '(sin descripción)'}_${datePart} — ${owner}`;
|
|
|
|
|
return `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart} — ${owner}`;
|
|
|
|
|
}));
|
|
|
|
|
sections.push(...rendered);
|
|
|
|
|
sections.push('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Quitar línea en blanco final si procede
|
|
|
|
|
if (sections.length > 0 && sections[sections.length - 1] === '') {
|
|
|
|
|
sections.pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const totalMy = TaskService.countUserPending(context.sender);
|
|
|
|
|
@ -298,7 +304,7 @@ export class CommandService {
|
|
|
|
|
sections.push(`… y ${totalMy - myItems.length} más`);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
sections.push('No tienes tareas pendientes.');
|
|
|
|
|
sections.push(italic('No tienes tareas pendientes.'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// En contexto de grupo: mantener compatibilidad mostrando solo "sin responsable" del grupo actual
|
|
|
|
|
@ -309,11 +315,12 @@ export class CommandService {
|
|
|
|
|
const groupName = GroupSyncService.activeGroupsCache.get(context.groupId) || context.groupId;
|
|
|
|
|
const unassigned = TaskService.listGroupUnassigned(context.groupId, LIMIT);
|
|
|
|
|
if (unassigned.length > 0) {
|
|
|
|
|
if (sections.length && sections[sections.length - 1] !== '') sections.push('');
|
|
|
|
|
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 `- ${codeId(t.id)} _${t.description || '(sin descripción)'}_${datePart} — ${ICONS.unassigned} sin responsable`;
|
|
|
|
|
return `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart} — ${ICONS.unassigned} sin responsable`;
|
|
|
|
|
});
|
|
|
|
|
sections.push(...renderedUnassigned);
|
|
|
|
|
|
|
|
|
|
@ -337,11 +344,12 @@ export class CommandService {
|
|
|
|
|
gid;
|
|
|
|
|
|
|
|
|
|
if (unassigned.length > 0) {
|
|
|
|
|
if (sections.length && sections[sections.length - 1] !== '') sections.push('');
|
|
|
|
|
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 `- ${codeId(t.id)} _${t.description || '(sin descripción)'}_${datePart} — ${ICONS.unassigned} sin responsable`;
|
|
|
|
|
return `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart} — ${ICONS.unassigned} sin responsable`;
|
|
|
|
|
});
|
|
|
|
|
sections.push(...renderedUnassigned);
|
|
|
|
|
|
|
|
|
|
@ -407,7 +415,7 @@ export class CommandService {
|
|
|
|
|
: `${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 `- ${codeId(t.id)} _${t.description || '(sin descripción)'}_${datePart} — ${owner}`;
|
|
|
|
|
return `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart} — ${owner}`;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const total = TaskService.countGroupPending(context.groupId);
|
|
|
|
|
@ -426,7 +434,7 @@ export class CommandService {
|
|
|
|
|
if (items.length === 0) {
|
|
|
|
|
return [{
|
|
|
|
|
recipient: context.sender,
|
|
|
|
|
message: 'No tienes tareas pendientes.'
|
|
|
|
|
message: italic('No tienes tareas pendientes.')
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -458,9 +466,15 @@ export class CommandService {
|
|
|
|
|
: `${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 `- ${codeId(t.id)} _${t.description || '(sin descripción)'}_${datePart} — ${owner}`;
|
|
|
|
|
return `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart} — ${owner}`;
|
|
|
|
|
}));
|
|
|
|
|
sections.push(...rendered);
|
|
|
|
|
sections.push('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Quitar línea en blanco final si procede
|
|
|
|
|
if (sections.length > 0 && sections[sections.length - 1] === '') {
|
|
|
|
|
sections.pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (total > items.length) {
|
|
|
|
|
@ -511,14 +525,14 @@ export class CommandService {
|
|
|
|
|
const due = res.task?.due_date ? ` — ${ICONS.date} ${formatDDMM(res.task?.due_date)}` : '';
|
|
|
|
|
return [{
|
|
|
|
|
recipient: context.sender,
|
|
|
|
|
message: `ℹ️ ${codeId(id)} ya estaba completada — _${res.task?.description || '(sin descripción)'}_${due}`
|
|
|
|
|
message: `ℹ️ ${codeId(id)} ya estaba completada — ${res.task?.description || '(sin descripción)'}${due}`
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const due = res.task?.due_date ? ` — ${ICONS.date} ${formatDDMM(res.task?.due_date)}` : '';
|
|
|
|
|
return [{
|
|
|
|
|
recipient: context.sender,
|
|
|
|
|
message: `${ICONS.complete} ${codeId(id)} completada — _${res.task?.description || '(sin descripción)'}_${due}`
|
|
|
|
|
message: `${ICONS.complete} ${codeId(id)} completada — ${res.task?.description || '(sin descripción)'}${due}`
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -571,7 +585,7 @@ export class CommandService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const lines = [
|
|
|
|
|
`${ICONS.take} Has tomado ${codeId(id)}`,
|
|
|
|
|
italic(`${ICONS.take} Has tomado ${codeId(id)}`),
|
|
|
|
|
`${res.task?.description || '(sin descripción)'}`,
|
|
|
|
|
res.task?.due_date ? `${ICONS.date} ${formatDDMM(res.task?.due_date)}` : ''
|
|
|
|
|
].filter(Boolean);
|
|
|
|
|
@ -789,7 +803,7 @@ export class CommandService {
|
|
|
|
|
? `${ICONS.unassigned} sin responsable${groupName ? ` (${groupName})` : ''}`
|
|
|
|
|
: `${assignmentUserIds.length > 1 ? '👥' : '👤'} ${assignedDisplayNames.join(', ')}`;
|
|
|
|
|
const ackLines = [
|
|
|
|
|
`${ICONS.create} ${codeId(taskId)} _${description || '(sin descripción)'}_`,
|
|
|
|
|
`${ICONS.create} ${codeId(taskId)} ${description || '(sin descripción)'}`,
|
|
|
|
|
dueFmt ? `${ICONS.date} ${dueFmt}` : null,
|
|
|
|
|
ownerPart
|
|
|
|
|
].filter(Boolean);
|
|
|
|
|
|