diff --git a/apps/backend/src/modules/analytics/features/get-attendee-history/use-case.ts b/apps/backend/src/modules/analytics/features/get-attendee-history/use-case.ts
index 8001e47..827c85d 100644
--- a/apps/backend/src/modules/analytics/features/get-attendee-history/use-case.ts
+++ b/apps/backend/src/modules/analytics/features/get-attendee-history/use-case.ts
@@ -39,8 +39,21 @@ export class GetAttendeeHistory {
return err(notFoundResourceProblem('Attendee', attendeeId));
}
+ // Same effective join date as the risk rule (`toMemberAttendance`): an
+ // attendee loaded after their first classes were already recorded starts
+ // at that first class, not at `createdAt`. Otherwise this screen said
+ // "1 de 3 clases" while the group list said "1 de 5" for the same person.
+ const firstAttendance = await db.attendance.findFirst({
+ where: { attendeeId },
+ orderBy: { classSession: { startsAt: 'asc' } },
+ select: { classSession: { select: { startsAt: true } } },
+ });
+ const firstClassAt = firstAttendance?.classSession.startsAt;
+ const since =
+ firstClassAt && firstClassAt < attendee.createdAt ? firstClassAt : attendee.createdAt;
+
const sessions = await db.classSession.findMany({
- where: { groupId, startsAt: { gte: attendee.createdAt } },
+ where: { groupId, startsAt: { gte: since } },
orderBy: { startsAt: 'desc' },
take: HISTORY_SESSIONS_LIMIT,
select: { id: true, startsAt: true },
diff --git a/apps/backend/test/analytics.test.ts b/apps/backend/test/analytics.test.ts
index 0ec23a0..e1228b5 100644
--- a/apps/backend/test/analytics.test.ts
+++ b/apps/backend/test/analytics.test.ts
@@ -16,6 +16,7 @@ const db = {
},
attendance: {
findMany: mock(),
+ findFirst: mock(),
},
slotRelease: {
count: mock(),
@@ -251,6 +252,29 @@ describe('analytics routes', () => {
});
});
+ it('arranca en la primera clase registrada si es anterior al alta', async () => {
+ // Loaded on 1/10 with classes already marked since 20/9: the history
+ // starts at the first one, as the risk rule and the group list count it.
+ prisma.group.findUnique.mockResolvedValue(makeGroup());
+ prisma.attendee.findFirst.mockResolvedValue({
+ id: 'a-1',
+ fullName: 'Ana Pérez',
+ createdAt: new Date('2026-10-01T00:00:00.000Z'),
+ });
+ prisma.attendance.findFirst.mockResolvedValueOnce({
+ classSession: { startsAt: new Date('2026-09-20T10:00:00.000Z') },
+ });
+ prisma.classSession.findMany.mockResolvedValue([]);
+
+ await makeApp({ id: userId }).request('/groups/group-1/attendees/a-1/history');
+
+ expect(prisma.classSession.findMany).toHaveBeenCalledWith(
+ expect.objectContaining({
+ where: { groupId: 'group-1', startsAt: { gte: new Date('2026-09-20T10:00:00.000Z') } },
+ }),
+ );
+ });
+
it('devuelve 404 si el alumno no pertenece al grupo', async () => {
prisma.group.findUnique.mockResolvedValue(makeGroup());
prisma.attendee.findFirst.mockResolvedValue(null);
diff --git a/apps/web/src/components/layout/Header.tsx b/apps/web/src/components/layout/Header.tsx
index 2d61375..34bd745 100644
--- a/apps/web/src/components/layout/Header.tsx
+++ b/apps/web/src/components/layout/Header.tsx
@@ -18,7 +18,12 @@ export function Header() {
-
+ {/* On mobile the theme lives only in Ajustes → Apariencia: in the
+ header it took the space next to the avatar for something you
+ change once. On desktop there is room for the shortcut. */}
+
+
+
diff --git a/apps/web/src/features/groups/GroupForm.tsx b/apps/web/src/features/groups/GroupForm.tsx
index f482103..000ac88 100644
--- a/apps/web/src/features/groups/GroupForm.tsx
+++ b/apps/web/src/features/groups/GroupForm.tsx
@@ -1,4 +1,4 @@
-import { useForm } from 'react-hook-form'
+import { type DefaultValues, useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'
import type { BillingType, CountryCode, CreateFirstGroup, WeekDay } from '@gruperly/shared'
import { CreateFirstGroupSchema, DEFAULT_COUNTRY } from '@gruperly/shared'
@@ -30,12 +30,14 @@ export function GroupForm({
onSubmit,
onBack,
}: GroupFormProps) {
- const defaultValues: CreateFirstGroup = {
+ // The price starts empty on purpose: a pre-filled $0 got submitted as is and
+ // the group ended up unable to charge. The capacity starts at a typical
+ // class size instead of 1, which had to be overwritten every time.
+ const defaultValues: DefaultValues = {
name: '',
days: [],
time: '09:00',
- capacity: 1,
- price: 0,
+ capacity: 10,
billingType: 'MONTHLY',
dueDay: 1,
country,
@@ -77,6 +79,7 @@ export function GroupForm({
(null)
if (!group || !isGroupOwner) return null
const includedInPlan = hasPlanFeature(billingQuery.data, 'whatsappAutomations')
+ const activeCount = AUTOMATIONS.filter((automation) => group[automation.key]).length
+ const expanded = expandedByUser ?? activeCount > 0
+ const summary =
+ activeCount === 0 ? 'Apagados' : activeCount === 1 ? '1 activo' : `${activeCount} activos`
return (
-
+
)
}
diff --git a/apps/web/src/features/groups/detail/GroupHeader.tsx b/apps/web/src/features/groups/detail/GroupHeader.tsx
index 9716ece..d1a7279 100644
--- a/apps/web/src/features/groups/detail/GroupHeader.tsx
+++ b/apps/web/src/features/groups/detail/GroupHeader.tsx
@@ -88,11 +88,16 @@ export function GroupHeader({ onCharge }: { onCharge?: () => void }) {
{hasGroup ? (
- // A single row on mobile: the primary takes the leftover width and the two
- // supporting actions collapse into 44px icons. At sm+ they get their text
- // back because there is plenty of width and the label makes the
- // destination clearer.
-
+ // On mobile the primary takes its own row and the supporting actions go
+ // below as three equal buttons with their label: as bare 44px icons
+ // nobody could tell "Cobrar" from "Estadísticas". At sm+ everything goes
+ // back to a single row aligned to the right.
+
{!isEmptyGroup ? (
// One primary per screen: "Agregar" heads the hierarchy and the
// supporting actions sit beside it, in outline.
@@ -101,7 +106,7 @@ export function GroupHeader({ onCharge }: { onCharge?: () => void }) {
onClick={() =>
void navigate({ to: '/groups/$groupId/attendees/new', params: { groupId } })
}
- className="h-11 flex-1 justify-center sm:flex-none sm:w-auto"
+ className="col-span-3 h-11 justify-center sm:w-auto"
>
Agregar miembro
@@ -110,41 +115,29 @@ export function GroupHeader({ onCharge }: { onCharge?: () => void }) {
{!isEmptyGroup ? (
) : null}