Education test website Q&A - how?

General Tech Learning Aids/Tools 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years 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.

profilepic.png
manpreet 2 years 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.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.