http://pastie.org/551660
I added a pastie of the current rake file task (yep still working on a procedural piece for ratings automation), along with the model (in full for schedules) etc. A brief idea of how it works and what I don't like about it... In order to obtain a ratings schedule of strength for each team, I need to find all of the ratings for each team they play... This is why scheduling is so important to my project.. So, I'm simply finding all opponents for each team, then finding all the ratings for each opponent, and at the moment just doing a simple sum. It will get a lot more difficult as I place it into my Standard deviation variance model but I can do it. I just don't like the "way" I'm doing it.. Look in the pastie code and there's a small notes section right after the rake file. There's one bit of code which looks enormously ugly and inefficient but it matches and works 100%! The cliche is if it's not broke don't fix it. But, even though it's not broke, it just doesn't feel rails like to me or ruby like to me. It feels hackish. This code here for instance: val += opp_off_tsos[opp_scheduled_ids[i+1][x]-1] .. what!!? Well break it down.. opp_off_tsos (translates to array for the rating itself) opp_scheduled_ids[i+1][x] (translates to the opponent_id) .... i+1 is because the 120.times starts with 0 and I need to start with 1.. .... x is a true 0 start because I used .each.. Why -1 at the end? Because the opp_off_tsos array was created with 120.times so it starts with 0 and I need to subtract one from the id to get it to match.. Again, it all works but as you can see, inefficient and ugly.. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

