Feedback Plugin, Guide for Further Development
Project: TIMCAN
Document creator: Kimmo Urtamo
Created: 16.5.2019
Modified: 6.6.2019
For further queries: tim@jyu.fi
1. Purpose and content of the guide
The document describes the functionality and structure of the feedback plugin developed by the TIMCAN project. The feedback plugin is a plugin that works together with the drag&drop and dropdown plugins. The plugins together allow the creation of tests making use of adaptive feedback, which guides learners towards learning the concepts being studied. The feedback plugin can control certain aspects of the other plugins and also handles the flow of a task from the beginning to the end.
The purpose of the document is to provide an understanding of the implementation solutions in the plugin, supporting the understanding of the source code and comments in it.
2. Structure and location of the plugin in TIM
The code of the feedback plugin in TIM is mostly located in the files:
timApp/modules/feedback/css/feedback.css,timApp/modules/feedback/css/hideanswerbrowser.cssandtimApp/modules/feedback/css/viewhide.csshide elements on the page.timApp/modules/feedback/js/feedback.tscontains the code for the front-end andtimApp/modules/feedback/feedback.pycontains the code for the back-end.
Other notable files are
timApp/static/scripts/tim/document/viewctrl.tswhich contains theITimComponentinterface andtimApp/static/scripts/tim/plugin/util.tswhich contains the functions usable by all TIM plugins.
Some smaller changes were made to the following files to hide elements from learners with only view rights in a TIM document that has a feedback plugin in it.
timApp/document/docsettings.pycontains general settings for TIM documents,timApp/static/scripts/tim/document/editing/editing.tshandles document editing for TIM,timApp/static/scripts/tim/document/notes.tscontrols the comments in the right side of the document,timApp/templates/base.htmlis the base HTML of a TIM document,timApp/item/routes.pycontains routes for TIM items andtimApp/templates/view_html.htmlis a template for the document view.
The file timApp/plugin/containerLink.py was modified to turn some of the YAML fields of the feedback plugins to automatically use markdown without the need to specify markdown with the md: notation.
3. Description of the functionality
Almost every detail regarding the creation of an adaptive feedback task is defined in the YAML of the feedback plugin including
- all of the question items in the task,
- the names of the plugins for the question items located in the TIM document as well as the content in the plugins,
- what kind of feedback is provided on each selection and
- whether the selection was correct.
Most of the functionality in a task is done through the feedback plugin and depends on the document having a feedback plugin and the document settings being correct.
An answer is saved by calling the answer-route of the plugin. This saves the following information to the database:
- whether the answer was correct or not,
- the answer the learner provided,
- the correct answer to the question item and
- the feedback the learner was provided.
The flow of completing a task is the following:
- When a learner starts a task the feedback plugin is in the
instructionmode, waiting for the learner to read the instructions and click the Begin button. - After the learner clicks the Begin button the plugin changes to the
question itemmode, where it waits for the learner to select an answer to a question item presented to them. - After the learner clicks the OK button the plugin compares the learners answer to the correct answer, shows feedback to the learner, saves the selections in the question items to the database and moves to the
feedbackmode. - When the learner clicks the Continue button after reading the feedback, the plugin saves the feedback to the database along with the correct answer and the learners answer to the question item.
- Next the plugin checks if any of the stopping conditions to end the task are met. If they are, the task has ended and the plugin moves to the
end taskmode. Otherwise the plugin moves back to thequestion itemmode in step 2 and presents another question item to the learner. This continues until there are no more question items to be presented. At that point the plugin moves automatically from the feedback mode to theend taskmode. - The plugin is in the
end taskmode and guides the learner forward.
Selkeyttäisin ensimmäistä virkettä vaihtamalla järjestystä, sillä siinä on pitkähkö lista asioita ennen kuin kerrotaan mihin ne liittyvät.
—Muutettu.
—4. Feedback route file feedback.py
The following routes are used in the feedback plugin:
answerhandles the saving of an answer.reqscontains the templates for quick creation of a task.
5. AngularJS component feedback.ts
The file feedback.ts contains
- the code controlling the flow of a task,
- providing feedback to the learner,
- setting or getting the content in the plugins of the question items in the task and
- dynamic hiding of elements in the document.
The file also includes AngularJS framework's HTML template of the plugin and the FeedbackController.
5.1 The most relevant attributes in the feedback controller
The most relevant attributes in the feedback controller are:
correctsInRowis the number of correct answers the learner needs to get in a row to move on from a task. It is 1 by default.nextTaskis the information the learner is presented when they reach the end of a task. For example, a link to the next task may be added. It has markdown enabled by default.practiseIDis the id of the practice question item in a task. It is not mandatory, but if it is defined the practice item needs to be answered to be able to move to the actual task.questionItemsis an array ofQuestionItemobjects. It has markdown enabled by default. AQuestionItemcontains the following attributes:areais the HTML class of the TIM area the question item is in, if it is inside a TIM area. It is not a mandatory attribute. At the writing of this document it is not recommended to use it, because the task already is inside a TIM area and TIM currently does not support areas inside areas.dragSourceis the name of the drag&drop plugin the words are dragged from to the plugin in the question item. It is only required, if the words in the drag source need to be reset during a task.choicesis an array ofChoiceobjects. It has markdown enabled by default. AChoicecontains the following attributes:correctimplies that the match is the correct answer to the question item. It isfalseby default.levelsis a string array containing the different levels of feedback for the question item. It has markdown enabled by default.matchis either a string array or aMatchElementArrayobject. Support for the use ofMatchElementArraysin tasks does not currently exist.
pluginNamesis a string array of the names of the plugins in the question items.wordsis an array of string arrays that defines what is the content in the plugins defined in thepluginNamesarray.
showAnswersmakes it possible to cycle through previous answers in the View page of the document. By default it is disabled and the answers are only visible in the Answer page.shuffledefines whether the question items of the task should be presented in a random order or not. It istrueby default.stateis the state of the plugin and is used in presenting and browsing previous answers.
Typo kohdassa practiceID: “pracice”, ylimääräinen väli area-kohdan lopussa.
—Muutettu.
—5.2 The most relevant methods in the feedback controller
The most relevant methods in the feedback controller are:
$onInitinitiates the plugin. It contains setting of attributes and calling of methods that should be done in the beginning.$doCheckperiodically checks if the task creator has the TIM edit mode on, in which case all of the elements in the page relevant to the task are turned visible. When the test creator turns the edit mode off, the elements that were hidden before the mode was turned on are hidden again.addToCtrladds the plugin to the view controller so other plugins in the view controller can interact with it.changeVisibilitydoes most of the work for turning elements in the document hidden or visible. There are also a few support functions that can be called to turn different kinds of elements in the document hidden or visible.check*functions are used to check that the YAML of the feedback plugin is written so that the task works.compareChoicescompares the answer the learner chose to the answer choices in the question item.getAnswerFromPluginsgets the answer to the current question item from the plugins in the question item and saves information about it to various variables for later use.getCorrectValuesreturns the correct answers to the plugins in the current question item.getSentenceforms a sentence from the text and plugin names the method is provided. Currently the method is used to form the learners answer by replacing the plugin names by the learners selections or to form the correct answer to the question item by replacing the plugin names with the correct selections to the plugins in the question item.handleAnswercontrols the state the task is in and calls all the relevant functions to hide elements, control plugins and present feedback to the learner.printFeedbackhandles the presentation of feedback to the learner.replacePlaceHolderhandles the replacement of placeholders set in the YAML code by the test creator with the actual words in the question item.savePluginsfunction calls all of the plugins in the current question item and tells them to save their current state.setPluginWordscalls all the plugins from all the question items and sets the words in them to the ones defined in thewordsattribute.
"-check*-functions" kohta on edellisen perässä eikä omana lista-alkionaan. Sitä ennen ylimääräinen väli ennen pistettä.
—Muutettu.
—6. Ideas for further development
The feedback plugin was developed primarily for the Centre for Applied Language Studies and generality was a secondary concern. For that reason refactoring of the code may be necessary to support plugin types other than the two developed in the project. The suggested improvements to the feedback plugin are the following:
- Support for new plugin types and plugins setting their own content should be added to make the feedback plugin more generally usable.
- The way answers are checked needs to be made more secure to make the feedback plugin more appealing in less supervised exams or similar situations.
- More information to be shown to the learner might be useful. For example, one might want to dynamically show the feedback level they currently are in.
- By adding cumulative points to the feedback plugin a task could be used in school assignments or similar excercises.
- By allowing the definition of points to individual question items one could award answering harder questions correctly with more points.
- The
setPluginWordsfunction is called too many times unnecessarily. This should be optimized. - The correct answer to the current question item should be transferred to the plugins in the question item when setting their words. This way the drag&drop plugin can check that the words aren't shuffled to the correct order.
To be able to use a task as a general question type modifying how a task works could be begun by:
- Skipping of the Begin button should be allowed.
- It should be possible to remove the question item hiding.
- the possibility to inform the learner in which task they are currently in should be added.
Separating the instructions and the practice item should be considered, but that might require adding another mode to the handleAnswer method and other changes will probably be needed as well.
If a drag&drop task has drag&drop plugins with droppable pieces that have different amount of words in them, using placeholders to get the pieces is currently possible by using the |part[i]| placeholder. This makes it difficult to reference parts of the answer if there is a lot of text and plugins in the question item. The reason is that every droppable piece counts as one part. The solution works fine if the question items are similar to the ones in ICAnDoiT with only one drag&drop plugin. However, one should consider implementing a placeholder just for the drag&drop pieces if it doesn't decrease the usability too much.
7. Relevant material
Apart from the document, maintainers might find useful information from the following material:
- User Manual for Creating Adaptive Feedback Test in the TIM
https://tim.jyu.fi/view/ kurssit/tie/proj/2019/timcan/kayttoohjeet/instructionsand - source code in GitLab
https://gitlab.com/jatakuiv/tim.
These are the current permissions for this document; please modify if needed. You can always modify these permissions from the manage page.