I used Sanity.io to create a way to manually track details of a game that my brother and I are playing and I plan to create a leaderboard of our versus stats and significant milestones.
I'm a bit new to Svelte but thought this would be a fun pet project to use for learning SvelteKit. Mostly everything is going well, but I find myself kinda stumped on how to efficiently capture "win streaks".
I'd like one section of the leaderboard to have the top 5 win streaks in descending order. For the match.js document type, relevant core fields are
- a datetime stamp when the match was played
- a document reference to player.js Doc type that stores our Names and player image. I'm pretty new to the GROQ query language. How can I write a query to capture a streak of sequential wins by the same player? How would I do that multiple times from throughout the data set of matches (we've played hundreds at this point...)
As I'm writing this post, I'm starting to wonder whether it would be wiser to try to create a read-only "Win Streak" document type in Sanity to capture that data as each new match is entered into the dataset.
I have tried reading the GROQ, Sanity, and Svelte documentation pages extensively as well as googling many ways of phrasing my use case for any code examples that would be similar to my intention, but haven't come across anything that gives me that lightbulb moment.
Any advice much appreciated!