Hi. I’m hoping someone can help me with this. (Please)
Some background. My application is to help people complete a course
(sort
of).
The course consists of different
Programs that have many
Categories that have many
Tasks
Up to there Im mostly ok. All the things listed above are set values
except
the tasks.
For each category there is a list of Tasks. This list may have 12
tasks,
with the posibility of the user making task 13 up themselves. They
choose 8
to complete.
So most of the tasks are hard coded for the program and category.
Now to the question…
How do I allow a user to make up task 13?
Where do I keep the information for the tasks selected, and also one
record
per task that collected some information about it for that user?
I’m not even sure how to design the database with this one…
I’m sorry I can’t… I’m not sure even where to start.
The programs, categories, and most of the tasks are entered into the db
by
the admin. Users don’t have to worry about them, just be able to select
them and have them assigned to them with some other information.
They do have to be able to enter task 13 that is associated with them
and a
cateogy.
I’m not even sure what method I would put onto the user to find their
tasks. Maybe something like
@user.program(‘SomeProgram’).category(‘someCategory’).tasks.each do
something
Just to try a different angle.
I have a set list of items (sort of) that are assigned to many people to
complete. Each list has a number of items to complete. ie. any 6 to
complete. The user can then select which items from that list that they
want to complete. Each person can have their own individual attributes
assiged to each item( ie comments, dates etc). Each list belongs to a
category, and may have one user defined item in it along with the set
items
depending on the program and category the list is in. This is all part
of a
program. Different programs can have categories that are named the same
as
categories in other programs, but has it’s own list items.
OK… if you can’t post a sample schema, how about a concrete example of
a user,
in a program with multiple categories and tasks? Doesn’t need to be
fancy, or
even real data, just a sample of what the existing system looks like.
Is this data being managed at the moment? Are there any clues in the
current
system for how a given set of data lives, or is associated? Particularly
to a user.
It also might be a better idea to tackle this problem bottom-up, rather
than
top-down. Figure out how you need to represent the tasks and then put
categories
on top of that, and then put programs on top of that…
It looks like what is important is linking students to tasks with
has_and_belongs_to_many
CREATE TABLE students_tasks …
It looks like you will have models for Program, Category, Task, and
Student.
In the Program model, you could have a class method that receives a
student
and checks that the student has satisfied the requirements of each
Category
and therefore the program. if each category returns true then this
method
returns true
In the Category model, a class method that receives a student and checks
that the student has satified all the requirements of the Category.
In the Student model, have an instance method in that calls Program’s
class
method I mentioned above.
Maybe that is good or maybe it is just drivel I typed. But I hope it
helps.
Where do I store the answers to the tasks though. The tasks need an
entry
in the db to say what they are (lets me print out the questions). Then
each
student needs to log in and provide an answer to each task/question.
Where
does that go?
does that go?
What is an answer to a task? Is a task a question or something that must
be
completed? I think if it is a question then the answer goes in the
students_tasks table as an extra feild. That way the answer for a
particular
student and a particular task is identifiable.