Skip to content

show scored soldier positions#14

Open
Fierillo wants to merge 1 commit into
lacrypta:mainfrom
Fierillo:main
Open

show scored soldier positions#14
Fierillo wants to merge 1 commit into
lacrypta:mainfrom
Fierillo:main

Conversation

@Fierillo
Copy link
Copy Markdown
Contributor

@Fierillo Fierillo commented May 27, 2026

improve visualization of scores in soldier table

Summary by CodeRabbit

Release Notes

  • Features
    • Redesigned soldier achievement display: Replaced medals column with positions-based rankings clearly showing hackathon competition placements and overall standings
    • Enhanced position metrics with per-hackathon scoring labels, improved sorting mechanisms, and clearer visual identification of top 6 finishers and their scoring contributions
    • Optimized tooltip styling for position scoring with improved text wrapping, reduced minimum width, detailed point attribution rows, and total points calculation displays

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@Fierillo is attempting to deploy a commit to the La Crypta Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

📝 Walkthrough

Walkthrough

The PR refactors soldiers scoring display to replace medal counts with a positions-based breakdown grouped by hackathon. Position entries are computed, labeled, sorted, and rendered as chips with detailed tooltips. Related labels and styling are updated for consistency across the soldiers table and detail page.

Changes

Positions Scoring Display

Layer / File(s) Summary
Position scoring types and helpers
app/soldados/SoldiersTable.tsx
Imports HACKATHON_LABELS and defines ScoredPositionEntry type, scoredPositionEntries() helper to filter/map/sort projects by position and hackathon with point computation, positionLabel() for human-readable position text, and hackathonLabel() for hackathon name resolution.
Positions column rendering
app/soldados/SoldiersTable.tsx
Table header "Medallas" column is renamed to "Puestos". Row rendering computes scored position entries, shows em dash when none exist, renders position/hackathon chips for each entry, and builds tooltip rows with total points for "Puestos puntuables".
Tooltip styling and label refinements
app/soldados/SoldiersTable.tsx, app/soldados/[slug]/page.tsx
StatTooltip container adjusts minimum width and enables text wrapping via whitespace-normal. Score breakdown tooltip label changes from "Posiciones" to "Puestos". Detail page score cell subtitle changes from "podio" to "top 6".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • lacrypta/lacrypta-dev#10: Updates positions-scoring constants and tooltip calculation logic that underpin the positions breakdown display refactored in this PR.

Poem

🐰 Medals fade, positions shine bright,
Hackathons grouped in organized light,
Chips and tooltips tell the tale,
Of top six finishers, none shall fail!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'show scored soldier positions' directly reflects the main change: replacing the 'Medallas' column with a 'Puestos' column focused on displaying scored positions from hackathon projects.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/soldados/SoldiersTable.tsx (1)

255-255: ⚡ Quick win

Use entry.points instead of redundant POSITION_POINTS[position] lookup.

The entry object already contains points: p.positionPoints (computed on line 81), so accessing POSITION_POINTS[position] is redundant and less robust.

♻️ Proposed fix
-                      left: `${positionLabel(position)} · ${hackathonLabel} · ${POSITION_POINTS[position]} pts`,
+                      left: `${positionLabel(position)} · ${hackathonLabel} · ${entry.points} pts`,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/soldados/SoldiersTable.tsx` at line 255, Replace the redundant constant
lookup with the computed value on the entry object: in SoldiersTable (the
template building the left label that currently uses positionLabel(position) ·
hackathonLabel · POSITION_POINTS[position] pts), use entry.points instead of
POSITION_POINTS[position]; update the interpolation that composes the left
string so it references entry.points (which is set from p.positionPoints) to
make the display robust and avoid duplicated logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/soldados/`[slug]/page.tsx:
- Around line 212-215: Update the label text in the detail page component so it
matches the table terminology: change the label prop currently set to
"Posiciones" to "Puestos" where the component renders label="Posiciones" (in
app/soldados/[slug]/page.tsx) and ensure it still displays the same value using
soldier.scoreBreakdown.positions; this keeps the UI consistent with
SoldiersTable.tsx which uses "Puestos".

In `@app/soldados/SoldiersTable.tsx`:
- Around line 264-272: The position chip keys can collide because
`${projectId}-${position}` lacks hackathon context; update the entries.map key
to include hackathonId (e.g., `${projectId}-${hackathonId}-${position}`) so each
chip is unique across hackathons—locate the entries.map rendering in
SoldiersTable.tsx and modify the key accordingly while leaving
positionLabel(position) and other props unchanged.

---

Nitpick comments:
In `@app/soldados/SoldiersTable.tsx`:
- Line 255: Replace the redundant constant lookup with the computed value on the
entry object: in SoldiersTable (the template building the left label that
currently uses positionLabel(position) · hackathonLabel ·
POSITION_POINTS[position] pts), use entry.points instead of
POSITION_POINTS[position]; update the interpolation that composes the left
string so it references entry.points (which is set from p.positionPoints) to
make the display robust and avoid duplicated logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4855a70e-1379-45b3-8728-8d0928b5fd3f

📥 Commits

Reviewing files that changed from the base of the PR and between da62bd4 and 9ff76b5.

📒 Files selected for processing (2)
  • app/soldados/SoldiersTable.tsx
  • app/soldados/[slug]/page.tsx

Comment on lines 212 to 215
label="Posiciones"
value={`+${soldier.scoreBreakdown.positions}`}
sub="podio"
sub="top 6"
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistent terminology: "Posiciones" vs "Puestos".

The soldiers table now uses "Puestos" (SoldiersTable.tsx lines 125, 276, 502), but this detail page still uses "Posiciones" as the label. Consider using "Puestos" here as well for consistency across the UI.

📝 Proposed fix for consistency
          <ScoreCell
-            label="Posiciones"
+            label="Puestos"
            value={`+${soldier.scoreBreakdown.positions}`}
            sub="top 6"
          />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
label="Posiciones"
value={`+${soldier.scoreBreakdown.positions}`}
sub="podio"
sub="top 6"
/>
label="Puestos"
value={`+${soldier.scoreBreakdown.positions}`}
sub="top 6"
/>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/soldados/`[slug]/page.tsx around lines 212 - 215, Update the label text
in the detail page component so it matches the table terminology: change the
label prop currently set to "Posiciones" to "Puestos" where the component
renders label="Posiciones" (in app/soldados/[slug]/page.tsx) and ensure it still
displays the same value using soldier.scoreBreakdown.positions; this keeps the
UI consistent with SoldiersTable.tsx which uses "Puestos".

Comment on lines +264 to +272
{entries.map(({ position, hackathonLabel, projectId }) => (
<span
key={`${projectId}-${position}`}
title={hackathonLabel}
className="inline-flex items-center gap-1 rounded-full border border-border bg-white/[0.03] px-2 py-0.5 text-foreground-muted"
>
<span>{positionLabel(position)}</span>
</span>
)}
))}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix potential key collision in position chips.

The key ${projectId}-${position} could collide if the same project appears in multiple hackathons with the same position. Include hackathonId in the key for uniqueness.

🔑 Proposed fix
                          {entries.map(({ position, hackathonLabel, projectId }) => (
+                          {entries.map(({ position, hackathonLabel, projectId, hackathonId }) => (
                            <span
-                              key={`${projectId}-${position}`}
+                              key={`${projectId}-${hackathonId ?? 'none'}-${position}`}
                              title={hackathonLabel}
                              className="inline-flex items-center gap-1 rounded-full border border-border bg-white/[0.03] px-2 py-0.5 text-foreground-muted"
                            >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/soldados/SoldiersTable.tsx` around lines 264 - 272, The position chip
keys can collide because `${projectId}-${position}` lacks hackathon context;
update the entries.map key to include hackathonId (e.g.,
`${projectId}-${hackathonId}-${position}`) so each chip is unique across
hackathons—locate the entries.map rendering in SoldiersTable.tsx and modify the
key accordingly while leaving positionLabel(position) and other props unchanged.

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.

1 participant