fix: ajustar ver todos para mostrar sin responsable por grupo

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

@ -275,16 +275,13 @@ export class CommandService {
sections.push('No tienes tareas pendientes.'); sections.push('No tienes tareas pendientes.');
} }
// Añadir "sin responsable" de grupos donde el usuario es miembro activo y snapshot fresca // En contexto de grupo: mantener compatibilidad mostrando solo "sin responsable" del grupo actual
const memberGroups = GroupSyncService.getFreshMemberGroupsForUser(context.sender); if (isGroupId(context.groupId)) {
if (memberGroups.length > 0) { if (!GroupSyncService.isGroupActive(context.groupId)) {
const perGroup = TaskService.listUnassignedByGroups(memberGroups, LIMIT); sections.push('⚠️ Este grupo no está activo.');
for (const gid of perGroup.keys()) { } else {
const unassigned = perGroup.get(gid)!; const groupName = GroupSyncService.activeGroupsCache.get(context.groupId) || context.groupId;
const groupName = const unassigned = TaskService.listGroupUnassigned(context.groupId, LIMIT);
(gid && GroupSyncService.activeGroupsCache.get(gid)) ||
gid;
if (unassigned.length > 0) { if (unassigned.length > 0) {
sections.push(`${groupName} — Sin responsable`); sections.push(`${groupName} — Sin responsable`);
const renderedUnassigned = unassigned.map((t) => { const renderedUnassigned = unassigned.map((t) => {
@ -294,15 +291,44 @@ export class CommandService {
}); });
sections.push(...renderedUnassigned); sections.push(...renderedUnassigned);
const totalUnassigned = TaskService.countGroupUnassigned(gid); const totalUnassigned = TaskService.countGroupUnassigned(context.groupId);
if (totalUnassigned > unassigned.length) { if (totalUnassigned > unassigned.length) {
sections.push(`… y ${totalUnassigned - unassigned.length} más`); sections.push(`… y ${totalUnassigned - unassigned.length} más`);
} }
} else {
sections.push(`${groupName} — Sin responsable\n(no hay tareas sin responsable)`);
} }
} }
} else { } else {
// Si no hay snapshot fresca de membresía, mantenemos una nota instructiva mínima // En DM: usar membresía real (snapshot fresca) para incluir "sin responsable" por grupo
sections.push(' Para ver tareas sin responsable de un grupo, usa “/t ver sin” desde ese grupo.'); const memberGroups = GroupSyncService.getFreshMemberGroupsForUser(context.sender);
if (memberGroups.length > 0) {
const perGroup = TaskService.listUnassignedByGroups(memberGroups, LIMIT);
for (const gid of perGroup.keys()) {
const unassigned = perGroup.get(gid)!;
const groupName =
(gid && GroupSyncService.activeGroupsCache.get(gid)) ||
gid;
if (unassigned.length > 0) {
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 responsable`;
});
sections.push(...renderedUnassigned);
const totalUnassigned = TaskService.countGroupUnassigned(gid);
if (totalUnassigned > unassigned.length) {
sections.push(`… y ${totalUnassigned - unassigned.length} más`);
}
}
}
} else {
// Si no hay snapshot fresca de membresía, mantenemos una nota instructiva mínima
sections.push(' Para ver tareas sin responsable de un grupo, usa “/t ver sin” desde ese grupo.');
}
} }
return [{ return [{

Loading…
Cancel
Save