Hi.
Just a simple common task: create highscore table for today's best, this week's best etc. What's the obvious logic:
Table highscores:
int score;
DateTime date;
String username;
I've created Index:
date descending;
score descending;
And want to loadRange with starter object "NOW" and stopper object "NOW-WEEK". Yeah, it's ok, it's all loaded but... Result sorting must depend on score, not on date! I guess for now there is no method to select property for final sorting? And what I have to do - is to sort results from my own code? What if I used "limit" parameter? Really high scores from just a bit earlier than a week ago might not get into results. Loading without limits... there may be a lot of values for a month, for example.
What's the other option? Having 4 different highscore tables: Highscores_Today, Highscores_Week, .._month, _all_the_time, inserting score to all of them and cleaning up these tables with each query as far as no "automatic culling" exists?
Another option: having field "period" in "Highscores" table, including that in index and setting indexPath to what i need. But the big problem is to update this field on each record in table.
So what's the best way?