The reports page gives administrators a snapshot of platform-wide engagement and product performance. Located atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
admin/reportes.html, it is powered by the iniciarReportes() function in admin.js, which runs automatically when the admin router detects reportes.html in the current URL.
Data Source
All analytics on this page derive from a single API call toGET /api/productos. This endpoint already returns each product’s computed calificacion (average rating) and numResenas (total review count) by joining the Productos and Resenas tables server-side. No additional endpoints are needed.
Once the response is received, the function filters the full product list to only those with at least one review:
evaluados array.
Products with zero reviews are excluded from all analytics widgets and ranking lists. They do not affect the platform average, review count, or any product rankings.
Analytics Widgets
Total Reviews
The sum of
numResenas across all evaluated products. Displayed in the #rep-total DOM element. Represents the total number of reviews ever submitted and not deleted across the entire platform.Platform Average
A weighted average rating calculated as
Σ(calificacion × numResenas) / totalResenas, displayed as X.X / 5.0 in #rep-promedio. Products with more reviews carry proportionally more weight in this score.Most Popular Product
The single product with the highest
numResenas value among evaluated products. Its name appears in #rep-pop-nombre and its total review count in #rep-pop-votos as N evaluaciones.Rankings
Two sorted lists — top 3 best-rated (sorted by
calificacion DESC) and top 3 lowest-rated (sorted by calificacion ASC). Each entry shows the product image, name, review count, and star score.Weighted Average Calculation
The platform average is computed using a weighted mean so that a product rated 5.0 by one user does not unfairly outrank a product rated 4.8 by hundreds of users. Theevaluados.forEach loop accumulates the totals and simultaneously tracks the most popular product:
masPopular is initialized to evaluados[0] (the first reviewed product) and updated whenever a product with a higher numResenas is encountered. The result is the single product with the most reviews.
Product Rankings
Rankings are derived from theevaluados array using Array.sort() on a spread copy to avoid mutating the original:
#rep-lista-mejores or #rep-lista-peores and displays:
| Field | Source |
|---|---|
| Product image | p.imagen (45×45px, rounded) |
| Product name | p.nombre |
| Review count | p.numResenas (shown as N reseñas registradas) |
| Star score | p.calificacion.toFixed(1) |
var(--primary-orange)). Lowest-rated scores are highlighted in red (#d93025).