Cambios incluidos: - INDICE-DIRECTIVAS-WORKSPACE.yml actualizado - Perfiles de agentes: PERFIL-ML.md, PERFIL-SECURITY.md - Directivas SIMCO actualizadas: - SIMCO-ASIGNACION-PERFILES.md - SIMCO-CCA-SUBAGENTE.md - SIMCO-CONTEXT-ENGINEERING.md - SIMCO-CONTEXT-RESOLUTION.md - SIMCO-DELEGACION-PARALELA.md - Inventarios actualizados: DEVENV-MASTER, DEVENV-PORTS - Documentos de analisis agregados: - Analisis y planes de fix student portal - Analisis scripts BD - Analisis achievements, duplicados, gamification - Auditoria documentacion gamilit - Backlog discrepancias NEXUS - Planes maestros de resolucion - Reportes de ejecucion agregados - Knowledge base gamilit README actualizado - Referencia submodulo gamilit actualizada (commit beb94f7) Validaciones: - Plan validado contra directivas SIMCO-GIT - Dependencias verificadas - Build gamilit: EXITOSO
102 lines
2.7 KiB
Markdown
102 lines
2.7 KiB
Markdown
# REFINAMIENTO DEL PLAN - ERRORES GAMIFICATION SUMMARY
|
|
|
|
**Fecha:** 2026-01-10
|
|
**Referencia:** VALIDACION-PLAN-GAMIFICATION-2026-01-10.md
|
|
**Estado:** REFINADO
|
|
|
|
---
|
|
|
|
## 1. PROBLEMA IDENTIFICADO
|
|
|
|
Se identificaron DOS causas del error:
|
|
|
|
| # | Causa | Prioridad | Tipo |
|
|
|---|-------|-----------|------|
|
|
| 1 | Profile seed `cccccccc-...` no existe en BD | ALTA | Datos faltantes |
|
|
| 2 | Código busca por `user_id` en vez de `id` | MEDIA | Bug latente |
|
|
|
|
---
|
|
|
|
## 2. PLAN DE EJECUCION REFINADO
|
|
|
|
### CORR-GAM-001: Crear profile de testing faltante
|
|
|
|
**Acción:** Insertar usuario student@gamilit.com directamente en BD
|
|
|
|
```sql
|
|
-- Insertar en auth_management.profiles
|
|
INSERT INTO auth_management.profiles (
|
|
id, tenant_id, user_id, email, display_name, full_name,
|
|
first_name, last_name, avatar_url, bio, phone, date_of_birth,
|
|
grade_level, student_id, school_id, role, status,
|
|
email_verified, phone_verified, preferences
|
|
) VALUES (
|
|
'cccccccc-cccc-cccc-cccc-cccccccccccc'::uuid,
|
|
'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid,
|
|
'cccccccc-cccc-cccc-cccc-cccccccccccc'::uuid,
|
|
'student@gamilit.com',
|
|
'Estudiante Testing',
|
|
'Estudiante de Testing GAMILIT',
|
|
'Estudiante',
|
|
'Testing',
|
|
'/avatars/student-testing.png',
|
|
'Usuario estudiante para testing y desarrollo.',
|
|
'55-0000-0003',
|
|
'2013-09-01'::date,
|
|
'5',
|
|
'EST-TEST-001',
|
|
NULL,
|
|
'student'::auth_management.gamilit_role,
|
|
'active'::auth_management.user_status,
|
|
true,
|
|
false,
|
|
'{"theme": "detective", "language": "es", "timezone": "America/Mexico_City", "sound_enabled": true, "notifications_enabled": true}'::jsonb
|
|
)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
```
|
|
|
|
### CORR-GAM-002: Corregir búsqueda en código (bug latente)
|
|
|
|
**Archivo:** `apps/backend/src/modules/gamification/services/user-stats.service.ts`
|
|
**Línea:** 52
|
|
|
|
**Cambio:**
|
|
```typescript
|
|
// ANTES:
|
|
where: { user_id: userId }
|
|
|
|
// DESPUÉS:
|
|
where: { id: userId } // CORR-GAM-002: Buscar por PK, no FK
|
|
```
|
|
|
|
---
|
|
|
|
## 3. ORDEN DE EJECUCION
|
|
|
|
1. ✅ Insertar profile de testing (CORR-GAM-001)
|
|
2. ✅ Corregir código backend (CORR-GAM-002)
|
|
3. ✅ Verificar compilación TypeScript
|
|
4. ✅ Probar endpoint /summary
|
|
|
|
---
|
|
|
|
## 4. CONVENTIONAL COMMITS
|
|
|
|
```
|
|
fix(gamification): insert missing test user and correct profile lookup
|
|
|
|
CORR-GAM-001: Insert student@gamilit.com profile into database
|
|
CORR-GAM-002: Fix validateProfileExists to search by profiles.id (PK)
|
|
instead of profiles.user_id (FK to auth.users)
|
|
|
|
This fixes Error 500 on GET /gamification/users/:userId/summary
|
|
and Error 404 on GET /gamification/users/:userId/achievements/summary
|
|
|
|
Refs: ANALISIS-ERRORES-GAMIFICATION-SUMMARY-2026-01-10.md
|
|
```
|
|
|
|
---
|
|
|
|
**Refinado por:** Claude (Arquitecto Técnico)
|
|
**Fecha:** 2026-01-10
|