Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Blackterz2/Proyecto_5to_Semestre/llms.txt

Use this file to discover all available pages before exploring further.

Blackterz offers two complementary progress views built entirely from data already captured during normal training sessions. The weekly volume chart gives a macro view of training load over time, while the personal records (PRs) board surfaces the best performance ever logged per exercise. Both are derived from the sesion_series table and require no additional input from the user.

Weekly Volume Chart

The profile page renders a Chart.js 4 bar chart showing total training volume per ISO week for the last 8 weeks. Volume for each week is the sum of peso × repeticiones across all completed sets (completada = 1) in sessions that fall within that week.
1

Fetch session history

GET /api/sesiones returns the full history. Each session already includes volumen_total_kg — a pre-aggregated sum calculated server-side by the obtenerHistorialUsuario query.
2

Group by ISO week

The frontend calculates the Monday of each session’s week using:
const fechaLimpia = sesion.fecha.split('T')[0];
const fecha = new Date(fechaLimpia + 'T00:00:00');
const diaSemana = fecha.getDay() || 7; // Sunday becomes 7
const lunes = new Date(fecha);
lunes.setDate(fecha.getDate() - diaSemana + 1);
3

Sum volume per week

Sessions in the same ISO week accumulate into a single bucket. The result is a map of { 'YYYY-MM-DD': totalKg } keyed by each week’s Monday.
4

Render the last 8 weeks

The map is sorted chronologically and sliced to the 8 most recent weeks to keep the x-axis readable. A Chart.destroy() call precedes every re-render to prevent memory leaks.

Routine filter

A <select> dropdown above the chart lets users filter volume by routine. Selecting a specific routine re-groups the data to include only sessions linked to that routine. Selecting “Todas las rutinas” restores the aggregate view.
The chart receives the complete history array — not the current page of the paginated table. Pagination only affects the history table rows; the chart always reflects all available data.

Personal Records

GET /api/estadisticas/prs returns the maximum weight ever logged per exercise, considering only sets marked as completed (completada = 1).
curl http://localhost:3000/api/estadisticas/prs \
  -H "Authorization: Bearer <token>"
The model runs a single aggregation query across four joined tables:
SELECT
  e.id              AS ejercicio_id,
  e.nombre          AS ejercicio_nombre,
  MAX(ss.peso)      AS peso_maximo,
  MAX(ss.repeticiones) AS reps_maximas,
  COUNT(DISTINCT ss.sesion_ejercicio_id) AS veces_entrenado,
  COUNT(ss.id)      AS total_series_completadas
FROM sesiones_entrenamiento se
JOIN sesion_ejercicios sej ON sej.sesion_id = se.id
JOIN sesion_series ss     ON ss.sesion_ejercicio_id = sej.id
JOIN ejercicios e        ON e.id = sej.ejercicio_id
WHERE se.usuario_id = ? AND ss.completada = 1
GROUP BY e.id, e.nombre
ORDER BY peso_maximo DESC

Sample PR response

{
  "status": "ok",
  "data": [
    {
      "ejercicio_id": 8,
      "ejercicio_nombre": "Peso muerto",
      "peso_maximo": 120,
      "reps_maximas": 5,
      "veces_entrenado": 14,
      "total_series_completadas": 42
    },
    {
      "ejercicio_id": 4,
      "ejercicio_nombre": "Press de banca",
      "peso_maximo": 100,
      "reps_maximas": 8,
      "veces_entrenado": 22,
      "total_series_completadas": 66
    }
  ]
}

PR response fields

ejercicio_id
number
The exercise’s primary key.
ejercicio_nombre
string
The exercise’s Spanish display name.
peso_maximo
number
Highest weight (kg) ever logged in a completed set for this exercise.
reps_maximas
number
Highest repetition count ever logged in a completed set.
veces_entrenado
number
Number of distinct sessions in which this exercise appeared.
total_series_completadas
number
Total count of completed sets ever logged for this exercise.
If the authenticated user has no completed training sessions, the endpoint returns an empty array [] — never an error.

Session History Table

The profile view includes a paginated history table showing the 10 most recent sessions per page.
ColumnSource
Datesesiones_entrenamiento.fecha formatted as "15 de junio, 2026"
Routinerutinas.nombre via LEFT JOIN
Volumevolumen_total_kg (pre-aggregated)
Setstotal_series (completed sets count)
Durationduracion_minutos
Detail linkNavigates to session detail view

Progressive Overload

GET /api/sesiones/ultima/:rutina_id is the bridge between the history system and the active training flow. It returns the most recent session for a routine with sets grouped by exercise, enabling the frontend to show each set’s previous values as grey hints.
curl http://localhost:3000/api/sesiones/ultima/3 \
  -H "Authorization: Bearer <token>"
{
  "status": "ok",
  "data": {
    "sesionId": 17,
    "ejercicios": {
      "4": [
        { "peso": "60.00", "repeticiones": 10 },
        { "peso": "62.50", "repeticiones": 10 }
      ]
    }
  }
}
The workflow:
1

Load the routine

GET /api/rutinas/:id provides planned sets and reps.
2

Fetch the last session

GET /api/sesiones/ultima/:rutina_id retrieves actual weights and reps from the previous workout.
3

Inject hint values

inyectarAnteriorEnCards() adds a <span class="anterior-valor"> to each set row showing the previous values (e.g. 60kg × 10). These hints are purely visual — they do not pre-fill the inputs, encouraging the user to consciously decide whether to match or exceed last session.

Data Source

All statistics — weekly volume, personal records, session history totals — are derived exclusively from the sesion_series table. The relevant columns are:
ColumnTypeDescription
numero_serieINTSet number within the exercise (1-indexed)
repeticionesINTReps performed
pesoDECIMALWeight in kilograms
completadaBOOLEANWhether the user checked this set as done
Only rows where completada = 1 contribute to PRs and volumen_total_kg calculations. Unchecked sets are saved to the database but excluded from all statistics.
Weights are stored as logged by the user. There is no unit conversion — the app assumes all values are in kilograms. If a user logs bodyweight exercises with peso = 0, those sets appear in history but contribute zero volume and zero to PR calculations.

API Reference — Statistics

View the full schema for GET /api/estadisticas/prs.

API Reference — Sessions

View the full schema for GET /api/sesiones and GET /api/sesiones/ultima/:rutina_id.

Build docs developers (and LLMs) love