fix: adaptar formato de respuestas al modo compacto

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

@ -238,17 +238,17 @@ export class CommandService {
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 `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart}${ICONS.unassigned} sin responsable`; 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);
if (total > items.length) { if (total > items.length) {
rendered.push(italic(`… y ${total - items.length} más`)); rendered.push(`… y ${total - items.length} más`);
} }
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: [bold(`${groupName} — Sin responsable`), ...rendered].join('\n') message: [`${groupName} — Sin responsable`, ...rendered].join('\n')
}]; }];
} }
@ -276,7 +276,7 @@ export class CommandService {
(groupId && GroupSyncService.activeGroupsCache.get(groupId)) || (groupId && GroupSyncService.activeGroupsCache.get(groupId)) ||
(groupId && groupId !== '(sin grupo)' ? groupId : 'Sin grupo'); (groupId && groupId !== '(sin grupo)' ? groupId : 'Sin grupo');
sections.push(bold(groupName)); sections.push(groupName);
const rendered = await Promise.all(arr.map(async (t) => { const rendered = await Promise.all(arr.map(async (t) => {
const names = await Promise.all( const names = await Promise.all(
(t.assignees || []).map(async (uid) => (await ContactsService.getDisplayName(uid)) || uid) (t.assignees || []).map(async (uid) => (await ContactsService.getDisplayName(uid)) || uid)
@ -287,14 +287,14 @@ export class CommandService {
: `${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 `- ${codeId(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);
} }
const totalMy = TaskService.countUserPending(context.sender); const totalMy = TaskService.countUserPending(context.sender);
if (totalMy > myItems.length) { if (totalMy > myItems.length) {
sections.push(italic(`… y ${totalMy - myItems.length} más`)); sections.push(`… y ${totalMy - myItems.length} más`);
} }
} else { } else {
sections.push('No tienes tareas pendientes.'); sections.push('No tienes tareas pendientes.');
@ -308,17 +308,17 @@ 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(bold(`${groupName} — Sin responsable`)); 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 `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart}${ICONS.unassigned} sin responsable`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${ICONS.unassigned} sin responsable`;
}); });
sections.push(...renderedUnassigned); sections.push(...renderedUnassigned);
const totalUnassigned = TaskService.countGroupUnassigned(context.groupId); const totalUnassigned = TaskService.countGroupUnassigned(context.groupId);
if (totalUnassigned > unassigned.length) { if (totalUnassigned > unassigned.length) {
sections.push(italic(`… y ${totalUnassigned - unassigned.length} más`)); sections.push(`… y ${totalUnassigned - unassigned.length} más`);
} }
} else { } else {
sections.push(`${groupName} — Sin responsable\n(no hay tareas sin responsable)`); sections.push(`${groupName} — Sin responsable\n(no hay tareas sin responsable)`);
@ -336,17 +336,17 @@ export class CommandService {
gid; gid;
if (unassigned.length > 0) { if (unassigned.length > 0) {
sections.push(bold(`${groupName} — Sin responsable`)); 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 `- ${codeId(t.id)} ${t.description || '(sin descripción)'}${datePart}${ICONS.unassigned} sin responsable`; return `- ${t.id}) _${t.description || '(sin descripción)'}_${datePart}${ICONS.unassigned} sin responsable`;
}); });
sections.push(...renderedUnassigned); sections.push(...renderedUnassigned);
const totalUnassigned = TaskService.countGroupUnassigned(gid); const totalUnassigned = TaskService.countGroupUnassigned(gid);
if (totalUnassigned > unassigned.length) { if (totalUnassigned > unassigned.length) {
sections.push(italic(`… y ${totalUnassigned - unassigned.length} más`)); sections.push(`… y ${totalUnassigned - unassigned.length} más`);
} }
} }
} }
@ -406,7 +406,7 @@ export class CommandService {
: `${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 `- ${codeId(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);
@ -416,7 +416,7 @@ export class CommandService {
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: [bold(groupName), ...rendered].join('\n') message: [groupName, ...rendered].join('\n')
}]; }];
} }
@ -446,7 +446,7 @@ export class CommandService {
(groupId && GroupSyncService.activeGroupsCache.get(groupId)) || (groupId && GroupSyncService.activeGroupsCache.get(groupId)) ||
(groupId && groupId !== '(sin grupo)' ? groupId : 'Sin grupo'); (groupId && groupId !== '(sin grupo)' ? groupId : 'Sin grupo');
sections.push(bold(groupName)); sections.push(groupName);
const rendered = await Promise.all(arr.map(async (t) => { const rendered = await Promise.all(arr.map(async (t) => {
const names = await Promise.all( const names = await Promise.all(
(t.assignees || []).map(async (uid) => (await ContactsService.getDisplayName(uid)) || uid) (t.assignees || []).map(async (uid) => (await ContactsService.getDisplayName(uid)) || uid)
@ -457,13 +457,13 @@ export class CommandService {
: `${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 `- ${codeId(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);
} }
if (total > items.length) { if (total > items.length) {
sections.push(italic(`… y ${total - items.length} más`)); sections.push(`… y ${total - items.length} más`);
} }
return [{ return [{
@ -514,16 +514,10 @@ export class CommandService {
}]; }];
} }
const dueLine = res.task?.due_date ? `${ICONS.date} ${formatDDMM(res.task?.due_date)}` : ''; const due = res.task?.due_date ? `${ICONS.date} ${formatDDMM(res.task?.due_date)}` : '';
const lines = [
`${ICONS.complete} ${codeId(id)} completada`,
`${res.task?.description || '(sin descripción)'}`,
dueLine,
italic(`Gracias, ${who}.`)
].filter(Boolean);
return [{ return [{
recipient: context.sender, recipient: context.sender,
message: lines.join('\n') message: `${ICONS.complete} ${codeId(id)} completada — ${res.task?.description || '(sin descripción)'}${due}`
}]; }];
} }

Loading…
Cancel
Save