See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Education test website Q&A - how?

General Tech Learning Aids/Tools

Max. 2000 characters



( 4 months ago )

I've had a potential job come through that I want to run on Craft, but I'm a bit sketchy about one particularly bit. The site is going to include educational modules and tests for each. Test results will be stored in their profile which can be reviewed the admins. I know how to create a new entry for each test submission, but the thing I'm not sure about is this:

How can I store whether a question was answered correctly or not? Is there a way to display a score based on the test result?

As always, I'm not a plugin developer... if this can be done with template logic that would be perfect.



( 4 months ago )

This is a very broad question, and I'm not sure you're going to get a very good answer without being more specific. Whether or not this is possible without the aid of a plugin would entirely depend on how you designed the system, and what the needs are. I can certainly imagine ways to accomplish this without the use of a plugin. With that said, I also think that you could probably make for a much more robust system with a better user experience with the aid of some simple plugins. But I also wouldn't let plugins scare you. Writing a plugin is surprisingly easy (depending on the complexity of course). As a front-end developer myself, I have written several with little difficulty, so I can attest to this. I would focus on designing a system that makes the most sense from a user perspective and then build it accordingly, even if that means learning to write some simple plugins.

As a starting point (without plugins) you might try and approach the problem this way.

  • Create a channel (or structure if multiple tests are used; using a test/question hierarchy) to store question entries, which would include the question, possible answers, and the correct answer (i.e. structure with handle 'tests' or 'modules' or whatever you want to call it).
  • Create a channel for user submitted answers with the user's answer and related fields to store a reference to the original question, and the user that submitted the answer (i.e. channel with handle 'testResults' or whatever you want to call it).
  • Create a form that presents a question (from the 'tests' structure) and the possible answers (as a radio button for example if multiple choice) that gets submitted to the 'testResults' channel.
  • Include hidden fields on the form with the question id, and user id, to populate the corresponding related 'entries' and related 'users' fields in the 'testResults' entry.
  • In the form success redirect you can load the form submission as well as the original question/answer, compare them and display if they are correct or not.
  • In the user profile template, you can then load all test entries (questions) and testResult entries (answers) for that user and compare them to display both whether specific questions were answered correctly and their overall test score.

Note that the data is not stored as part of the user profile per se; rather the user is only associated to the data via a related user field. And if you always look up the questions and answers and compare them to get the score then there would be no real need for a plugin. Where you might want a plugin is if you want to store the test results independently, or their overall progress, or other summary data, etc. But like I said above, writing a plugin to do this is not that complicated.

This assumes of course that the admin would view the user's profile and Q&A via the front-end. This is also by no means the only way, just an example of how it might be done.

what's your interest