Skip to content

Question objects (the 3rd)

Christopher Mark Fullarton requested to merge rangedQuestions into staging

Since the task of creating questions with an answeroption range is a quite complex task here comes the 3rd update which targets this feature. Although it does not yet implement it, major changes to the system how we currently create questions and answeroptions are implemented.

Changes

  • You'll need to set the question type via a select field in the /question route. The type of the question is no longer implicitly declared by the amount of correct answers
  • Validation is now done by the .isValid() methods of the QuestionGroup, Question and Answeroption instances
  • Validation is now live reactive. If you set up a single choice question and you do not have exactly one answeroption marked as correct the validation will fail instantly
  • No changes to the questionGroup collection and the answeroptions collection are populated to the server prior the /memberlist route. Any changes are made inside a Session variable which gets synchronized with the localstorage. If you reload the tab (F5) the Session variable gets automatically restored from the localstorage
  • The isCorrect value is now Boolean instead of a Number from 0 to 1.
  • The countdown value is now saved as seconds and not milliseconds.
  • The class instances are implementing the Meteor EJSON interface which allows them to be stored in the Session variable, be inserted into Minimongo (client side) or be passed to a Meteor method. Note that the Meteor method on the server side will automatically try to convert the instance to an object which will fail since we use getter and setter methods and we are hiding the instance variables. It is not possible to add these custom EJSON types to the server MongoDB aswell since the Meteor driver for MongoDB does not support the conversion to BJSON which ist the only language MongoDB understands. So a serialization is performed when adding the Session data to the collections (or anyway sending the instance to the server) which will transform it to regular JSON. The serialized object can be deserialized to the previos type by passing it to the constructor. Note that you need to check the type attribute before doing that since cross-type-instanciation is not supported. So it is not possible to instanciate a single choice question with a serialized multiple choice question object.
  • Since we're not DDoS'ing the server's questiongroup collection anymore while entering question text this update Fixes #175 (closed)
  • Fixes #198 (closed) because it was annoying
  • Fixes #192 (closed) because collections are no longer modified when deleting questions

ToDos

  • The api documentation for the new class instances in the github wiki.
  • The api documentation for the new class instances in the code.

Known issues

  • Markdown validation works so far but had to be doubled implemented due to a Meteor bug saying it could not find the module located in the question view.

  • The countdown for the members is currently not continued if they give a response and are routed back to /results

  • Leaderboard does not show those members which selected the correct answer

  • There is currently no parsing function so using old session data could create a black hole

  • The questionIndex is not updated when questions are removed

  • Translation for the select box

  • Wrong validation length in question route

  • Markdown-preview isn't working in question route

  • Markdown-toolbar in question route does not close on change question

  • Answer-options are validated on forward/backward button, not on typing

  • Can't see slider to change the countdown

  • I can start quizes with invalid questions. The forward button in the timer view should be disabled, if not all questions are valid.

  • If I tab in the answer options to create an additional answer option, the focus should be set in the new answer option, but it stays in the one before

  • The first answer option isn't validated correclty (no red border on empty input, valid on second character input, not on first)

  • Sometimes there are more incorrect validations

  • If I choose a single-choice-question and mark more than one answer option as correct, the question is invalid. We need a right border somewhere (maybe the dropdown-list to choose the question-type) to be informed that there is a invalid constellation. Another idea is to forbid to mark more than one answer-option as correct (and remove them completly on a polling). A pop-up- on leaving the answer-option-view and not saving the wrong constellation seems like a solution to me, too. But I would prefer to allow just what is valid - one correct answer option.

Merge request reports