My Pokédex (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Navi-27/Proyecto-UPC/llms.txt
Use this file to discover all available pages before exploring further.
GET /mi-pokedex) gives every registered user a personal, automatically maintained catalogue of every Pokémon they have ever viewed. There is no manual catch mechanic — the moment you visit a Pokémon’s detail page while logged in, that Pokémon is silently added to your history. The page displays your entire viewing history as a card grid, sorted with the most recently seen Pokémon at the top.
Authentication Requirement
This page is protected. If no active session is present (i.e.usuario_id is not in the Flask session), the route immediately redirects to /login:
History Entries
Each entry in your Pokédex history contains the following fields, sourced directly from thepokedex_usuario table:
| Field | Description |
|---|---|
pokemon_id | National Pokédex number, used to construct the sprite URL |
pokemon_nombre | Pokémon name slug (e.g. charizard), used to link back to the detail page |
fecha_visto | ISO 8601 timestamp of when the Pokémon was first viewed (e.g. 2024-03-15 10:42:07) |
fecha_visto[:10]) beneath each card for a clean display, while the full timestamp drives the sort order server-side.
How Viewing Is Recorded
Tracking happens automatically inside theGET /pokemon/<nombre> route. Every time a logged-in user opens a detail page, the handler calls:
registrar_visto() uses INSERT OR IGNORE against a UNIQUE constraint on (usuario_id, pokemon_id):
UNIQUE constraint on (usuario_id, pokemon_id), visiting the same Pokémon ten times still results in exactly one row per Pokémon — the fecha_visto timestamp is set on first insert and never updated. The total number of entries on your My Pokédex page equals the number of distinct Pokémon you have visited, not your total page view count.
Retrieving Your History
When the/mi-pokedex page loads, PokedexUsuario.obtener_vistos(usuario_id) fetches all rows for the current user, ordered by most recent visit:
mi-pokedex.html template as vistos. The template header shows your total count ({{ vistos | length }} Pokémon), and the card grid links each entry back to /pokemon/<pokemon_nombre> so you can revisit any Pokémon in one click.