TechHui

Hawaiʻi's Technology Community

We (Ahloy Chang, Yu Xian He, Layne Katsumoto, and Yan Liang) are a group of Honolulu Community College students creating a web application which lets our faculty easily create Flash-based tutorials to use in their classes. Both the application's user interface and the tutorials the application creates will be built using Adobe Flex. The information used to create the tutorials will be stored in a database controlled by Rails. We have found some problems in the database design and would like input from the community on how to solve our problem and on our project in general.

Our application's database keeps track of users and their tutorials. Each user can have several tutorials, and a tutorial can have several pages. Each page can have several elements inside it. An element can contain either a text paragraph, HTML code, a multiple choice question, or a reference to an image. The database structure looks something like this:


Each choice for a question will consist of an answer (the answer displayed in the multiple-choice question) and a reply to that answer (whether or not the answer is correct, and possibly why the answer is not correct in the case of a wrong answer). Reply and answer would be fields in a choices table.

So, the current questions we have are:

1. What is the best way to handle the relationship between an element and each of the
four possible types (question, text, htmlText, image) that can be stored in that
element?

2. Is there a good way to allow for changing the order of pages and/or elements?

3. Is there a way to avoid using an element class and still keep track of the order of the
elements on a page?

4. We know that we could define an Element class and have the Question class, the
TextElement class, the HtmlElement class, and the Image class inherit from the
Element class. Would there be an advantage to going this route?


Here's some examples of the finished tutorials: http://home.honolulu.hawaii.edu/~vern/tutorials.html

Views: 36

Replies to This Discussion

Hi (the above students are my students),

We think we have part of this model set up correctly. For example:
class User < ActiveRecord::Base
has_many :tutorials, :dependent => :destroy
end
class Tutorial < ActiveRecord::Base
belongs_to :user
has_many :pages, :dependent => :destroy
end
class Page < ActiveRecord::Base
belongs_to :tutorial
has_many :elements
end

If we set up the Page class as shown above, we can keep the correct order of the elements easily. However, this makes it so that there are extra fields like choices even for elements (like Text, HTMLText, Image) that don't have choices as in a multiple choice question.

Is there a way to set up a Page object so that it has many questions, has many textElements, has many htmlElements, and has many images (eliminating the need for an Element class)?

What would be the best way to relate these classes? Any guidance or direction as to where to look would be appreciated.

Thanks,

Vern

RSS

Sponsors

web design, web development, localization

© 2024   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service