But I guess such thinking on my part is futile. So let me lay it all
out for you.
My tables:

courses                -- this is here to provide in ID and a course
name for display.
   course_id
   course_name

categories             -- another look up table for category names
   category_id
   category_name

So right now I can look up course names and categories in, say
dropdowns, but I really have
no place to store *which* categories are for *which* courses.  So....

weights
   course_id
   category_id
   number                    (number of grades in this category)
   weight                     (weight for entire category)

At this point I can pick and store the grading categories for a course
along with how many
grades will be stored for what category and the percentage of the
total grade for the course
that grades in this category represent.  But I still have no storage
for the actual grades.
But I can't have grades yet -- because I have no students...

students
   student_id
   first_name
   last_name
   email
   user_name
   password

now I can store grades

grades
   course_id
   student_id
   category_id
   date_assigned
   number_grade

at the some point you need to sum up all the grades in a particular
category, then multiply
the total of the category by the weight for the category:

category_totals
   course_id
   student_id
   category_id
   category_raw_total
   category_total_x_weight

then finally, by summing the category_total_x_weight for a particular
course, and student,
you get the final grade.

final_grades
   course_id
   student_id
   final_grade

*Soooooo!  That is my whole database setup.

I hate to ask, but could someone tell me how to set up my models?
I have these huge gaps in my understanding.

For instance, I can see that weights "belongs to" courses and
categories.

So I should have something like this for Weight model:
<?
   class Weight extends AppModel {
      var $name = 'Weight';
      var $belongsTo = array (
         'Course'   => array('className' => 'Course',   'foreignKey'
=> 'course_id',
            'conditions' =>null, 'fields'=>null),
         'Category' => array('className' => 'Category', 'foreignKey'
=> 'category_id',
            'conditions' =>null, 'fields' =>null)
      )
   }
?>

But then do I need to establish or describe some kind of relationship
going the other way for
Course and Category?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to