Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add highest/lowest mmr matches #712

Merged
merged 6 commits into from
Feb 17, 2017
Merged

add highest/lowest mmr matches #712

merged 6 commits into from
Feb 17, 2017

Conversation

howardchung
Copy link
Member

  • splits matches list into 3 tabs: pro, high mmr, low mmr

@blukai
Copy link
Member

blukai commented Feb 16, 2017

Is there easy way to get heroes for matches? Would be cool.

@howardchung
Copy link
Member Author

Like the hero IDs of the heroes in the match?

@blukai
Copy link
Member

blukai commented Feb 16, 2017

Yes

@howardchung
Copy link
Member Author

howardchung commented Feb 16, 2017

We could change the ingestion to store the hero_ids in new columns (one per team), but that requires a core/schema change.

I'm not sure if it's possible to use some joins or something to fetch the hero IDs into the match row.

@howardchung
Copy link
Member Author

@howardchung
Copy link
Member Author

The above isn't working well since the joins to the tables with the radiant/dire team hero_ids is not subject to the WHERE clause of the main query, so it's assembling the subqueries for the entire table of public_player_matches.

@howardchung
Copy link
Member Author

Actually, the following seems to work, although it's kinda messy:

          WITH match_ids AS (SELECT match_id FROM public_matches
          WHERE start_time > ?
          ORDER BY avg_mmr ${order}
          LIMIT 100)
          SELECT * FROM
          (SELECT * FROM public_matches
          WHERE match_id IN (SELECT match_id FROM match_ids)) matches
          JOIN 
          (SELECT match_id, string_agg(hero_id::text, ',') radiant_team FROM public_player_matches WHERE match_id IN (SELECT match_id FROM match_ids) AND player_slot <= 127 GROUP BY match_id) radiant_team
          USING(match_id)
          JOIN
          (SELECT match_id, string_agg(hero_id::text, ',') dire_team FROM public_player_matches WHERE match_id IN (SELECT match_id FROM match_ids) AND player_slot > 127 GROUP BY match_id) dire_team
          USING(match_id)

@howardchung howardchung merged commit 2d75a85 into master Feb 17, 2017
@howardchung howardchung deleted the public_matches branch February 17, 2017 06:06
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.

3 participants