Commit Graph
10 Commits
Author SHA1 Message Date
darroyo e0ac9e844f feat(calculadora): complete cost-split coverage in all modes
CI / Build Native (push) Successful in 6m56s
- Ranking de rentabilidad: add 3 columns (C. Cristales / C. Ore / C. Fee)
  alongside the existing Costo column. Update rankingFiltrado() to include
  the 3 sub-costs in its map output.
- Totales Presupuesto (3 sub-vistas: simple/maximizado/mezcla): add
  Distribución del costo block with bar + legend under existing 3 cards.
- Totales Objetivo: extend objetivoTotales() to aggregate sub-costs, then
  add the same distribution block.
- Totales Plan cristales: same distribution block (planTotalesCristales
  already aggregated sub-costs).
- Add 3 generic helpers pctCOf/pctOOf/pctFOf that take a totals object
  (handles both 'costoTotal' and 'costo' field names).
- Fix x-show condition for Presupuesto distribution: use .costo (the field
  actually returned by planTotalesPresupuesto) instead of .costoTotal.

Verified in browser across all 5 distribution points; percentages sum to
100% and math matches per-row calculations.
2026-08-21 10:00:11 -04:00
darroyo d73f946cb2 feat(calculadora): cost split breakdown + plan por cristales mode
CI / Build Native (push) Has been cancelled
- Add costoCristales/costoOre/costoDwarven fields to calc.js results and
  RunItem/RunIn/RunSummary/HistoryStats records (no DB migration needed —
  items stored as JSON in TEXT column).
- Show 4 explicit columns (C. Cristales / C. Ore / C. Fee / Costo total)
  in all calculator tables: Cristales mode, Presupuesto (simple/maximizado/
  mezcla), and Objetivo. Totales globales now includes a 3-segment
  distribution bar with %.
- Historial: 3 new stats cards + global distribution bar; per-run modal
  shows breakdown + bar; per-item table has 3 sub-columns; CSV export
  extended. CSS: cost-split-bar, cost-split-segment-{cristales,ore,fee},
  cost-legend-dot.
- New 'Plan por cristales' mode (4th): single-grade + quantity input with
  greedy max-ROI/cristal algorithm and shared cost split columns.
  Verificado end-to-end en navegador.
2026-08-20 19:15:42 -04:00
darroyo 34e524616d chore: commit all missing files from Qute/Alpine migration
CI / Build Native (push) Successful in 7m9s
This commit adds all the files that were created during the frontend
migration (Qute templates + Alpine.js) but were never committed to git.

Includes:
- TemplateData.java (shared Qute page helpers)
- Static resources: app.js, defaults.js, calc.js, alpine.min.js, pico.min.css, favicon.svg
- Qute templates: changePassword, formulas, insumos, login, register, usuarios
- Partial templates: header.html, layout/base.html
- Modified: MustChangePasswordFilter.java (added login/register paths)
- Modified: AppState.java (added price fields)
- Modified: format.js (simplified number formatting)
- Modified: application.properties (static resources comment)
- Modified: calculadora.html (Qute/Alpine rewrite)
2026-08-18 10:26:10 -04:00
darroyo 661ac4d953 feat: add personajes page with level tracking and fix timer reactivity
CI / Build Native (push) Failing after 58s
- New /personajes page with CRUD for characters (name, class, level)
- Level editable inline, deletable (blocked if has active sales)
- ventas.html now loads characters list as datalist suggestions
- Fix timer: add reactive 'now' property so countdown updates
- Fix script loading: add defaults.js + app.js to ventas/personajes
- Fix table auto-reload: use loadCharacters()/loadSales() after mutations
- Timer now uses setTimeout recursion + visibilitychange handler
2026-08-18 10:09:10 -04:00
darroyo af323da3d3 feat: add character sales tracking with 12h countdown timer
CI / Build Native (push) Failing after 1m11s
- New page /ventas to track characters selling items
- Default 12h duration per character sale
- Real-time countdown with color-coded badges (green/yellow/red/gray)
- Sound alert toggle when sales expire
- CRUD API: GET/POST/DELETE /api/sales
- Flyway migration V2 for character_sales table
- Private per-user (same user sees only their own characters)
- Expired sales remain visible with 'Expirado' badge until manually deleted
2026-08-18 09:22:41 -04:00
darroyo cebd2c0365 fix: filter snapshot prices to only show items used in run
CI / Build Native (push) Failing after 47s
- Add filteredSnapshotCristales/Ores/Venta getters that filter based on modalDetails.items
- Cristales: only show grados that appear in items
- Ores: only show Soul/Spirit Ore based on item tipos
- Venta: only show tipo-grado combos in items
- Backward compatible: old runs with 15 items show full snapshot
2026-08-15 23:24:48 -04:00
darroyo 05db929da1 fix: only save items with cristalesDisponibles > 0
CI / Build Native (push) Failing after 43s
- saveRun(): filter items where cristalesDisponibles > 0 before persisting
- allItems(): show only saved items in modal (no padding with zeros)
2026-08-15 23:19:24 -04:00
darroyo e913b5ceb0 fix(historial): clamp sparkline bar height between 15-90% to prevent overflow
CI / Build Native (push) Failing after 39s
When range=0 (1 run or all same profit), use absolute scale with clamped heightPct
2026-08-15 23:11:45 -04:00
darroyo 4b564d9fae fix(historial): use SS/SPS/BSS abbreviations for shot types
CI / Build Native (push) Failing after 44s
- Replace broken chained replace() with tipoShort() helper
- SS = Soulshot, SPS = Spiritshot, BSS = Blessed Spiritshot
- Add tooltip (:title) on chips for full name on hover
- CSS: add cursor:help, font-weight:600, letter-spacing
2026-08-15 23:05:44 -04:00
darroyo 54fd68aa08 feat(historial): comprehensive enrichment of history page
CI / Build Native (push) Failing after 1m21s
Backend:
- RunSummary: add profitMarginPct, costPerShot, profitPerShot, itemCount, tiposUsados, wasProfitable
- HistoryStats: add avgProfitMarginPct, avgCostPerShot, avgProfitPerShot, totalOreUsed, totalItems, tiposBreakdown
- HistoryService: compute all new fields, parse items for best/worst run

Frontend (historial.html):
- 8 stats cards instead of 5: +Margen promedio, +Total invertido, +Shots, +Costo/shot
- SVG sparkline showing last 10 runs profit trend
- Ganancia por tipo breakdown with horizontal bars
- Table: sortable columns (click headers), new cols: Margen%, Costo/shot, Items chips, delta vs avg
- Sortable by: Fecha, Label, Costo, Venta, Ganancia, Margen
- Modal: badge Profit/Loss, 8 metric cards, snapshot of prices at save time, comparison vs current prices
- Export buttons: CSV (resumen) + JSON (completo con items y snapshot)

Format.js:
- Add fmtPercent() with es-CL locale

CSS:
- Add sparkline, tipos-breakdown, sortable columns, delta badges, metric cards, diff badges, modal-lg
2026-08-15 21:30:01 -04:00