Skip to content

feat: add Pred.gg coach data foundation - #252

Open
saggacce wants to merge 24 commits into
mainfrom
feat/predgg-coach-data-foundation
Open

feat: add Pred.gg coach data foundation#252
saggacce wants to merge 24 commits into
mainfrom
feat/predgg-coach-data-foundation

Conversation

@saggacce

Copy link
Copy Markdown
Owner

Amplía OAuth y telemetría de Pred.gg, modela ancestros y catálogos versionados, añade contexto de champion pool, coach de builds y benchmarks globales con degradación por permisos. Incluye migraciones aditivas, documentación y pruebas. Verificado con 137 tests, build web y datos reales de staging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20e37aeac1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1137 to +1141
const [itemsAlreadySynced, perksAlreadySynced] = await Promise.all([
db.gameItemVersion.count({ where: { versionId: version.id } }),
db.gamePerkVersion.count({ where: { versionId: version.id } }),
]);
if (itemsAlreadySynced > 0 || perksAlreadySynced > 0) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retry partially written catalogs

If syncGameCatalog fails after writing even one item or perk, its non-transactional writes remain in the database; the next tracked-catalog run then sees either count above zero and skips the version permanently. This leaves catalog data incomplete after a transient API or database error, so the skip should depend on a completion marker or verified complete datasets rather than itemsAlreadySynced > 0 || perksAlreadySynced > 0.

Useful? React with 👍 / 👎.

Comment on lines +184 to +187
const candidates = await db.gameItemVersion.findMany({
where: {
versionId: catalogVersionId, isHidden: false, rarity: 'EPIC', slotType: 'PASSIVE',
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Select legendary items for completed-build suggestions

The item catalog defines LEGENDARY as the completed-item rarity, and this feature's documentation says suggestions are limited to legendary visible items, but this query selects EPIC. Whenever a build signal requests alternatives, the coach therefore recommends components or misses the intended completed items; filter candidates by LEGENDARY instead.

Useful? React with 👍 / 👎.

Comment on lines +76 to +78
for (const row of selected) {
const won = row.match.winningTeam === row.team;
add(heroes, row.heroSlug, won, row.kills, row.deaths, row.assists);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude matches whose winner is unknown

For in-progress or incompletely synced matches, winningTeam is explicitly nullable, but this comparison converts every null value into won = false. Those matches are then counted as losses for the player's hero, every enemy matchup, and every ally synergy, which can incorrectly determine the displayed strongest and hardest matchups; omit them from win-rate calculations until a winner is known.

Useful? React with 👍 / 👎.

<div style={{ marginTop: '0.8rem', padding: '0.8rem', borderRadius: 8, background: 'rgba(34,211,238,0.04)', border: '1px solid rgba(34,211,238,0.16)' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', gap: '0.6rem', flexWrap: 'wrap' }}>
<strong style={{ fontSize: '0.78rem' }}>Comparación con jugadores de Pred.gg</strong>
{benchmark.benchmark.rating?.percentile != null && <span style={{ color: 'var(--accent-cyan)', fontSize: '0.67rem', fontWeight: 700 }}>Top {(benchmark.benchmark.rating.percentile * 100).toFixed(1)}% en Pred.gg</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.

P2 Badge Invert the rating percentile when labeling Top

Pred.gg's rating percentile represents the population below the player, so a value such as 0.42 corresponds to top 58%, as the existing scouting page already computes with 100 - percentile * 100. This new card instead displays top 42%, reversing the user's rank for every non-median percentile.

Useful? React with 👍 / 👎.

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