Class Generator
Inheritance
Inherited Members
Namespace: Appearition.Assessment
Assembly: Appearition.SDK.dll
Syntax
public class Generator
Fields
View SourceRelatedNodePropertyKeyIsHighlighted
Declaration
public const string RelatedNodePropertyKeyIsHighlighted = "IsHighlighted"
Field Value
Type | Description |
---|---|
System.String |
RelatedNodePropertyKeyIsTransparent
Declaration
public const string RelatedNodePropertyKeyIsTransparent = "IsTransparent"
Field Value
Type | Description |
---|---|
System.String |
Methods
View SourceGenerateAssessment(String, Int64)
Builds the set of questions to present and collect answers for the given assessment and user.
Declaration
public AssessmentSubmissionData GenerateAssessment(string username, long assessmentId)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | |
System.Int64 | assessmentId | ListAssessmentOptions() |
Returns
Type | Description |
---|---|
AssessmentSubmissionData | The ViewModel which will contain all of the questions in correct order and the view model which needs to be sent up to the server at the end when we submit the assessment. The ViewModel will have fields already populated from the assessment (i.e. assessment name, target proficiency level, and max achievable score). It will also have the student username set (the one passed in as the parameter) . The other fields need to be populated by you (the conusumer of this method): Start Date and Time, End Date and time, the overall achieved score (which you will calculate as the questions are answered and scores awarded for each correct answer) and finally, at the end of the assessment you will need to populate the Achieved Score Percentage). There is one final field: MessageShow. This field will hold the actual message you will show the student once they have completed the assessment. The choice of message to show is actually also contained for you within this view model (see the AssessmentScores). Assessment scores are important because depending on the final percentage achieved by the student, a different message will be shown. The "AssessmentScores" is a collected of score ranges with a message text. Once at the end, after you have calculated the final percentage (i.e. (Max Achievable Score / Achieved Score) * (100/1) ), you will look up the "AssessmentScores" collection and pick up the MessageToShow field. But wait there is one more thing before you show that message to the studuent. Message texts may contain special variables in the format of "[[some variable]]". This is form of templated message whereby the variables must be replaced with actual values before we show it to the student. So, what are these variables and how do you replace them? Well the answer is easy really... you don't have to worry about it... the magic is taken care of by the method ParseText(String, IList<AssessmentSubmissionQuestionRelatedNode>, IList<AssessmentSubmissionQuestionOption>, AssessmentSubmissionCategory, AssessmentSubmissionQuestionAttempt, AssessmentSubmissionData). Simply call this method, pass in the message and the variables it needs and it will return you a formatted string. The header will contain a collection of categories (i.e. StudentAssessmentCategories). Questions are grouped according to Category and Proficiency level. As such, we want to collect and record scores at this level. Therefore, for each "StudentAssessmentCategory" you will find "Max Achievable Score" and "Achieved Score". The max score will be prefilled for you, but you will need to populate the "Achieved Score" value. This will simply be a sum of scores from each question under this "StudentAssessmentCategory". This now brings me to the set of questions. There is a collection named "StudentAssessmentQuestions" and this holds all of the questions, it correct order, with all of the information you will need to render options, show the relevant parts of the 3D model. It also has instructions on how to score the student for each attempt they make. Finally, each question has also has a specific message to show if you get it right or wrong. The message lives in the "QuestionProperties" collection, where the ProperyKey you need to look for is "CorrectMessage" or "IncorrectMessage". The text for these messages are in the ProperyValue field and once again, you will need to parse this text through the ParseText(String, IList<AssessmentSubmissionQuestionRelatedNode>, IList<AssessmentSubmissionQuestionOption>, AssessmentSubmissionCategory, AssessmentSubmissionQuestionAttempt, AssessmentSubmissionData) method to replace any variables with appropriate values GeneratorException |
Init(IEnumerable<LearnNode>, IEnumerable<Assessment>, IEnumerable<Question>, Boolean)
Initialises the Generator engine in preparation for ListAssessmentOptions() and then GenerateAssessment(String, Int64). Note: the generator is created as a singleton.
Declaration
public static Generator Init(IEnumerable<LearnNode> nodesFlattenedCollection, IEnumerable<Assessment> assessments, IEnumerable<Question> questionTemplates, bool singleton = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<LearnNode> | nodesFlattenedCollection | We want a collection of nodes which are not in hierarchical order |
System.Collections.Generic.IEnumerable<Assessment> | assessments | collection of assessments which have been sent down from the server |
System.Collections.Generic.IEnumerable<Question> | questionTemplates | collection of questions and question templates sent down from the server |
System.Boolean | singleton | The generator can be initialised as a singleton class or instance. Default is FALSE |
Returns
Type | Description |
---|---|
Generator |
ListAssessmentOptions()
Call this method to get a list of Assessments to present on the screen along with the proficiency levels that are applicable to that assessment.
Declaration
public IEnumerable<AssessmentOptionViewModel> ListAssessmentOptions()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<AssessmentOptionViewModel> | A view model that holds the name of the assessment to display on screen and the list of proficiency levels available for selection. For each level, there is a unique Assessment ID which is needed for the GenerateAssessment(String, Int64) method. |
ParseText(String, IList<AssessmentSubmissionQuestionRelatedNode>, IList<AssessmentSubmissionQuestionOption>, AssessmentSubmissionCategory, AssessmentSubmissionQuestionAttempt, AssessmentSubmissionData)
Call this method to replace any "variables" within the text with actual values from the given parameter sets. A "variable" will take the format of "[[some_variable_name]]"". This method knows what all these variables are and how to replace them.
Declaration
public string ParseText(string text, IList<AssessmentSubmissionQuestionRelatedNode> relatedNodes, IList<AssessmentSubmissionQuestionOption> questionOptions, AssessmentSubmissionCategory assessmentCategory, AssessmentSubmissionQuestionAttempt answerAttempt, AssessmentSubmissionData studentAssessment = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The message which has variables that needs to be translated. If there are no variables, then simply the same string will be echoed back. |
System.Collections.Generic.IList<AssessmentSubmissionQuestionRelatedNode> | relatedNodes | A collection of nodes which have been presented to the user as part of the questions. |
System.Collections.Generic.IList<AssessmentSubmissionQuestionOption> | questionOptions | A collection of options which have been presented to the user as part of the questions where one or some are correct. |
AssessmentSubmissionCategory | assessmentCategory | Contains the category and proficiency level of the current question being asked. |
AssessmentSubmissionQuestionAttempt | answerAttempt | This holds the answer which has been given by the student. It may have the node that we selected and/or the text answer chosen |
AssessmentSubmissionData | studentAssessment | This is the overall view model that the generator has created and returned and should be used for updating as the student progresses through the questions. At the end of all the quiz, this will be populated with the final score and message. Note, the message shown at the end of quiz should be parsed through this method as some of the text may have variables so that the final score and other values can be set from the assessment. Hence in that case, make sure you have updated as much as you can, including final score, before invoking this method to parse the message shown to the student. |
Returns
Type | Description |
---|---|
System.String |