Feature Request: Commander in Deck API Query

 avatar
{"ops":[{"insert":"So I guess this is a bit of a weird request but still - I'm working on an application that attempts a market-basket analysis on decks that a user has built and recommends commanders based on that - the application is fully functional (as far as my testing goes), but at present it's really inefficient - \nSo it starts by grabbing all commander decks for a user - lets say 100 -> it then grabs a group of decks that also have that commander with \n"},{"attributes":{"color":"#6a8759"},"insert":"/api/decks/cards/?deckFormat=3&commanders=x"},{"insert":"\nit then gets the users who made those decks, and grabs their deck lists\n"},{"attributes":{"color":"#6a8759"},"insert":"/api/decks/cards/?deckFormat=3&owner=y"},{"insert":"\nat the moment, it then has to query each individual deck that it gets for that user (which is 100s of extra queries per user, per commander...) just to get the commander for that deck.\nI'm just curious if there already is a query for, or if it would be possible to implement one, so that when I run the second query, (owner=y) it would have a \"commander\" field in the deck data that is returned. I'd prefer not to fully release a software that is going to slam your servers thousands of times if it is possible to get that number down below 100.\n\nfor the file in question, see "},{"attributes":{"link":"https://github.com/sigiltenebrae/CommanderDash3/blob/master/src/app/deck-recs/deck-recs.component.ts "},"insert":"here"},{"insert":"\n(the app is open source but not yet deployable).\n"}]}
Edited 9/5/2022, 2:15:53 PM
0
 avatar
{"ops":[{"insert":"So let me get this right, you're looking to grab all commander decks for a user for a given commander right? Why not just include all of that in a single query to begin with?\n\n"},{"attributes":{"background":"#202124","color":"#cdcdcd"},"insert":"/api/decks/cards/?commanders=Kaalia of the Vast&orderBy=-updatedAt&owner=michael&ownerexact=true"},{"attributes":{"blockquote":true},"insert":"\n"},{"insert":"\nThat request returns all of my decks that also have Kaalia as the commander. Or am I misunderstanding something here?\n"}]}
0
 avatar
{"ops":[{"insert":"Basically, I'm saying \"If I like Kaalia, what do other people who like Kaalia like?\" - so I grab a list of all decks that have Kaalia as commander, get the users who built those decks, and then I want a list of all commanders built by those users.\n"}]}
Edited 9/5/2022, 3:09:52 PM
0
Support us on Patreon to remove ads