Hi Rob,
Here are my assumptions:
I utilize Rake Tasks in the same way as one would a cron job - to
perform a procedural task on “something” once per week. The rake tasks
I create will be manually run at the start but in the end, I will have
cron jobs run each of the rake tasks that I create one to three times
per week.
What do my rake tasks do?
-
Rake task one reaches out to a number of official ncaa sites,
parses/scrapes all of the data for the given week and uploads that data
into 37 statistical tables.
-
Rake task two (the one I’m working on now which is still incomplete)
compiles a ratings strength number for each team listed in each
statistical table (37 tables), categorizing the data by offense,
defense, special teams, and turnover margin. This data is then saved
into their respective “ratings” tables (offense, defense, special teams,
turnover margin).
-
Rake task three (is not designed yet but will go through the user
tables and purge membership accounts based on a weekly subscription
format.
These are the only 3 rake tasks I plan on using with my site for now.
About Design:
I’m really not asking for design help. I know how I personally see it
and how it “should” work. I’m asking if it can be done in the way I’ve
designed it. So far, all of the rake tasks I’ve created work perfectly
for what I’ve designed them to do thus far. You are correct in that I
have not supplied a lot of code with respect to rake task #2. The fact
is, I cannot supply more than the mechanics of it. The ratings system
is a private system that includes a lot of math functionality and is the
core reason why my site works so well.
Quoting Kenneth Massey (One of the BCS computer gurus from an email he
wrote to me):
=========================
Joel,
Thanks for sending me info about your system. I have added it here:
http://www.masseyratings.com/cf/compare.htm
under “Dezenzio TSRS”. It doesn’t correlate well with the other
rankings, but that’s actually a good thing - because your ranking system
is unique.
I like your idea of adjusting the raw statistical numbers to account for
strength of sched, and using st. dev. to normalize them is good.
Kenneth
I’ve worked really hard (over two years) to create the TSRS ratings
system and so I have to protect how it’s calculated and the way it
checks/offsets for variance.
So, I can only supply the “mechanics” of how I’m performing the task at
hand. There’s really no reason to show more than what I have.
I’ve isolated my question to the following:
(My Question)
Given 14 variables containing a foreign key value (team_id) that are
matched/paired with 14 variables containing a ratings number (PPCS), how
do I save the data I’ve already compiled inside of a rake task to the
table object that is currently open?
My assumption on the process would most likely be something similar to:
Create a constant for the table fields I want to update the values for:
TSOS_OFFENSE = [:team_id, :to_ppcs, :ro_ppcs, :po_ppcs, :so_ppcs,
etc…]
This would house the team_id foreign key and the columns that I want to
update.
update_tsos_offense.rows.each do |row|
values = {:compiled_on => Date.today.strftime(‘%Y-%m-%d’)}
constant.each_with_index do |field, i|
values[field] = row[i]
end
model.create values
end
update_tsos_offense is the name of the variable that opened the
Model.new object in my rake task.
Compiled on is a set date field that I use to write out the exact date
without time for each of the rows I add to my tables. I do this so that
I can allow people to use a calendar widget I created on my site to find
exact date matches…
Would something like this work? Or, do I need to tailor it some more?
Please keep in mind that I’m still new to rails and so I’m trying to be
as informative as I can. I do provide a lot of information. If it’s
the wrong kind of information then please enlighten me as to what
information I should be adding to provide better results for my
question.