core icon indicating copy to clipboard operation
core copied to clipboard

Adding features to the "matchups" endpoint

Open booshack opened this issue 4 years ago • 6 comments

Hey there! Thought I would try my hand at adding some functionality to "matchups" today - specifically I planned on adding responses "games_played_with" and "wins_with" (the pre-existing ones becoming "_against"). But I've just seen that there was some attempt made to implement this earlier in the code, which has now been commented (endpoint with description: "Get hero matchups (teammates and opponents)").

Is there a reason this was abandoned that would cause it to be rejected in the future? As in...should I bother? These will probably be quite substantial projects for me as I am very green.

Also hoped to add parameters "time_period", "position"* (for both heroes), "same_lane"**. Same question about these? Would you consider implementing them?

*Accepts an integer 1-5 that represents the hero's rank among its teammates with respect to lasthits **Accepts True/False based on whether or not to look at matches where the two heroes laned in the same lane.

booshack avatar Jul 01 '22 13:07 booshack

Can you post a pointer to that code? Maybe there were performance issues or the feature was no longer needed

howardchung avatar Jul 01 '22 19:07 howardchung

Line 3380 in /routes/spec.js.

Will revisit this in a little while btw!

booshack avatar Jul 02 '22 11:07 booshack

https://github.com/odota/core/commit/f0a0245c22996ce4f73049f728b11981b074e48f

Looks like I removed it six years ago but I don't remember why--I think it added a lot of Redis memory usage since it creates many many keys due to the number of possible hero combinations

howardchung avatar Jul 05 '22 19:07 howardchung

It is possibly more feasible if we keep it pairs of heroes only and don't consider triads+

howardchung avatar Jul 05 '22 19:07 howardchung

Oh I see I see thanks, yeah duos is enough I think.

Have also just learnt that the current matchups endpoint (spec.js line 3679) only looks at pro matches - would an attempt to make it consider all matches (and then filter with parameter time_period) be rejected?

Also, on the point that I'm a newbie, I don't understand what in the code makes it only look at pro matches...it seems to manipulate data from tables matches and player_matches, which include all matches no? Still making sense of it all to be honest haha

booshack avatar Jul 05 '22 22:07 booshack

the SQL tables matches/player_matches only include pro matches due to capacity issues.

Pub matches are stored in Cassandra which has much more limited querying abilities.

howardchung avatar Jul 05 '22 22:07 howardchung