Skip to content

fix(api): handle null kill counts with COALESCE in ranking query (#84) - #97

Closed
Rodrigoue9 wants to merge 1 commit into
Bitcoindefi:mainfrom
Rodrigoue9:fix/bounty-84
Closed

fix(api): handle null kill counts with COALESCE in ranking query (#84)#97
Rodrigoue9 wants to merge 1 commit into
Bitcoindefi:mainfrom
Rodrigoue9:fix/bounty-84

Conversation

@Rodrigoue9

Copy link
Copy Markdown

Title

fix(api): ensure ranking query handles null kill counts and returns empty array on clean databases (#84)

Description

  • Updates listCharacterRanking query in api/src/repositories/characters.ts to wrap ciudadanos_matados and criminales_matados in COALESCE(..., 0).
  • Prevents null arithmetic errors and guarantees the /ranking endpoint returns HTTP 200 with an empty list ({ characters: [] }) on clean database setups.

Closes #84

@gitar-bot

gitar-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Wraps kill count fields in COALESCE to prevent null arithmetic errors and guarantee an empty array response on clean databases. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@leocagli

Copy link
Copy Markdown
Collaborator

Cierro esta porque la #84 ya quedo resuelta en main. El diagnostico era correcto.

Que paso

La #84 junto tres PRs: #97, #114 y #126. Las tres apuntan al mismo lugar, el COALESCE sobre los contadores de bajas nulos en la consulta de ranking, que es lo que hacia devolver 500 al endpoint en una base limpia.

Se mergeo #114, de @trexfr-ops, porque la issue estaba asignada a esa persona y porque ademas del COALESCE traia el arreglo de la #82 (el orden de clan_members en schema.sql), la migracion envuelta en una transaccion con ROLLBACK, y el log del stack antes de devolver el 500. Las dos issues se cerraron juntas.

Contexto que no se veia desde afuera

Los PRs de fork quedan en action_required y el workflow no corre hasta que alguien lo aprueba; nadie lo estaba haciendo, asi que el CI de esta PR nunca dijo nada. Y main estaba en rojo desde que se agrego el workflow, por dos archivos de seed que faltaban. Se arreglo hoy (#109).

Gracias por el laburo. Hay issues abiertas sin asignar: comenta con un plan concreto y te la asigno.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

El endpoint de ranking devuelve 500 en un entorno limpio

2 participants