-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/quiz module #142
base: develop
Are you sure you want to change the base?
Feature/quiz module #142
Conversation
0000f5c
to
3bf6929
Compare
3bf6929
to
5c935a1
Compare
Just a quick look through the code brings up a few ideas. The quiz functionality might be implemented using Aldeed AutoForm / SimpleSchema. The Quiz questions/question types would each be defined via a simple schema that would look something like this: QuizSchema = new SimpleSchema({
quizType: {
type: String,
allowedValues: ['multi-choice', 'freeform', ...]
// Extend this list as new question types are added
},
multiChoice: {
type: Object
optional: true,
customValidation: function () {
// field is required only if quizType is set to 'multi-choice'
}
},
"multiChoice.question" { // Question text to display to the user
type: String
}
"multiChoice.choice": {
type: [Object], // brackets here mean the question can have multiple choice
},
"multiChoice.choice.text": {
type: String // Text to show user, i.e. answer text
},
"multiChoice.choice.isCorrectAnswer": {
type: Boolean // It may be possible to have multiple correct answers
}
}); This approach can help us to quickly have a form-based user interface for creating quizzes. The multi-choice approach can be made flexible to allow multiple correct answers, meaning the user has to select all correct answers for success. This schema can be extended to include other question types. |
i had a quick chat with @zeala . She's going to try to use autoform next week. |
Great :-) I am available for pair-programming this week. @zeala, please let me know what day/time works, if you are interested in pair programming. |
|
||
QuizOptions = {}; | ||
|
||
QuizOptions.MULTIPLE_CHOICE_SINGLE_ANSWER = "Multiple Choice - single answer"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this can probably be done at the schema level.
Lets break this feature effort into multiple parts:
The code in this branch is really complicated, and could be greatly simplified by focusing on the collection, schema, and autoform for quiz definition. |
Also, please refer to the initial schema suggestion (with some modification): QuizQuestions = new Mongo.Collection("quizQuestions");
QuizQuestions.schema = new SimpleSchema({
questionType: {
type: String,
allowedValues: ['multipleChoice', 'freeform', ...]
// Extend this list as new question types are added
},
multiChoice: {
type: Object
optional: true,
customValidation: function () {
// field is required only if quizType is set to 'multipleChoice'
// Get value of questionType field
let questionType = this.field("questionType").value
if (questionType === "multipleChoice") {
return true; // field is required
} else {
return false; // field is not required
}
}
},
"multiChoice.question" { // Question text to display to the user
type: String
}
"multiChoice.choice": {
type: [Object], // brackets here mean the question can have multiple choice
},
"multiChoice.choice.text": {
type: String // Text to show user, i.e. answer text
},
"multiChoice.choice.isCorrectAnswer": {
type: Boolean // It may be possible to have multiple correct answers
}
}); With this schema, we can define new question types easily. We can then use AutoForm <!-- Create new quiz form, add question section -->
{{# if afFieldValueIs name="questionType" value="multipleChoice" }}
<!-- Show the multiple choice question field -->
{{> afQuickField name="multipleChoice" }}
{{/ if }} |
I think we can shrink this PR to closer to 500 lines of code, with re-design. The current state of the code can be preserved in this branch, if you simply create a new feature branch. E.g. |
Hi,
I've started implementing the Quiz functionality. It's far from ready, but maybe you can have a quick review to see if this is on the right track.
Thanks.