Created
December 19, 2011 20:02
-
-
Save lcowell/1498634 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # we can name each result set eg. top_male_times_this_season | |
| result | |
| | name | | |
| # it's unlikely that we're going to reuse results, so we should scope them by the result they belong to | |
| results | |
| | age | time | gender | result_id | | |
| | 23 | 55:11 | M | 1 | | |
| | 49 | 1:27:51 | F | 2 | | |
| # with this organization it will be easy to do the following: | |
| result = Result.load(:top, Trail.current) # load the top saved query for the current season | |
| result = Result.load(:top_all_time, Trail.grind) # load the top saved query for the summer season | |
| result.each_gender do |gender| | |
| gender.grinders.each do |grinder| | |
| grinder.name | |
| grinder.time | |
| end | |
| end | |
| result.each_gender do |gender| | |
| gender.each_age_group do |age_group| | |
| age_group.best | |
| age_group.average | |
| age_group.grinders(3) do |grinder| | |
| grinder.name | |
| grinder.time | |
| end | |
| end | |
| end | |
| result = Result.load(:most_grinds_all_time) | |
| result.genders do |gender| | |
| gender.grinders do |grinder| | |
| grinder.name | |
| grinder.grinds | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment