I am currently working on a custom "quiz" like module in Drupal 7. The way it works is as follows: a site administrator creates a bunch of reading assignments, and associated questions that go with those readings (the reading might be a downloadable PDF, or a link to some online content). I currently have an entity called "reading" which has a title, description, media type field (pdf or link), and a group of question text fields, where the admin can create an arbitrary number of questions. Thus, a constructed reading entity might look like this:
========= READING ENTITY =========== Title: Some Great Paper Description: This great paper was written by Joe Schmo, and it is great. Media Type: PDF File Field: /path/to/the/uploaded/file.pdf Questions: What did Joe mean by 'Persistence is necessary?' How would you apply these ideas to your life?
Now, I am trying to create the "Assignment" entity. This is an entity that an instructor would create by picking a reading from the pool of reading entities an administrator has created. The assigned reading entity would look very similar to the reading entity, however it would have some additional fields. For example, it would need an indicator that the student has submitted the answers, and a grade field for the instructor. It would also need fields for instructor notes, and student answers. Since there needs to be an attached answer and notes field for each of the questions, I also created an "AssignmentQA" entity.
Finally, there is a requirement that if an instructor creates an assignment, and later on an administrator updates the "Reading" entity (Say, changes questions, or the pdf file to be downloaded, etc..) that this change is NOT seen in already created assignments. Thus, everything would need to be cloned. I see the Assignment and AssignmentQA entities associated with the above reading as looking like this:
============== ASSIGNMENT ENTITY =============== Title: Some Great Paper <--- cloned from the Reading entity Description: This great paper... <--- cloned from the Reading entity Media Type: PDF <--- cloned from the reading entity File Field: /path/to... <--- cloned from the reading entity Instructor: User reference to the instructor Student: User reference to the student Status: [Assigned, Completed, or Graded] Notes: General notes from the instructor to the student... QAs: reference field to QA1 reference field to QA2 ============== ASSIGNMENTQA ENTITIES ============== ID: QA1 Question: What did Joe mean by 'Persistence is necessary?' <--- Copied from Reading's Q1 Answer: The student's answer to this question. Notes: Instructor's notes on this particular answer ID: QA2 Question: How would you apply these ideas to your life? <--- Copied from Reading's Q2 Answer: The student's answer to this question. Notes: Instructor's notes on this particular answer.
Of course those IDs for the AssignmentQA entities are pseudo-code used for clarity.
So with all that being said..
- Does this sound like a reasonable approach?
- Is there a better way to think about this/do this?
- If it is reasonable, is there a way to pass a reading entity to the Assignment Entity so that I can properly construct an assignment from the reading data?
- And, how do I go about cloning the pdf file field, such that the pdf file can't be deleted from the server if it is updated, but the old version has already been assigned to someone? (e.g.- I'd like to use the updated PDF for any new assignments created, but keep the old one around for old assignments).