3. Grading and feedback

Previous: 2. Create the Java parts | Next: 4. Testing

Recall that grading and feedback is controlled by the \prggrading command. Its synopsis is as follows:


EXIT_VALUE is the exit value of the evaluator, GRADE a number between 0 and 1 specifying the ratio of the total point number the user should get, and FEEDBACK_LSP_KEY the LSP key of the feedback text. There are already some \prggrading commands in the template. You can (and usually should) remove, change, or add commands. For this tutorial, we only add a command, so that the corresponding section in the Tex source looks like:


There is already a LSP sheet associated with the GenericProgramCorrector which defines a couple of LSP keys. Among them are "praise-user-answer" and "code-caused-runtime-error". Thus, there is nothing to do for use with these two keys. But "array-may-be-empty" and "code-does-not-calculate-minimum" are undefined yet. To define them, we create a new LSP sheet.

Go to the checkin tree and navigate to the section where the new LSP sheet should be created. In this tutorial, we choose content/test/lsp_sheets. Right-click on the section and open the new-document wizard ("New > Mumie Document or Course"). Choose "Other Mumie document" and "Language Sensitive Phrases", and enter a name for the LSP sheet. We choose "minimum_in_array". The window should look like the following:

Click "Next". In the dialog showing up now, select "Empty LSP Sheets for all languages" and click "Finish". MIAU creates a new LSP sheet document and opens it in a special editor. Click on "Add Phrase" to create a new phrase. Set the key to "array-may-be-empty" and leave the type "Variable" unchanged. Though we haven't internationalized the problem yet, the LSP editor requires translations for all languages defined for the package. Thus, we enter translations for English and German ("Add/Remove Languages"), because the package "mumie_test_entities" supports these two languages.
Create another new phrase for the key "code-does-not-calculate-minimum" in the same way. The editor should now look like:

Save the LSP sheet and refresh the checkin tree ("Extras > Refresh Checkin Tree").

Finally, we have to register the new LSP sheet as a component of the problem. To this end, return to the TeX source, and select the "Meta information" tab of the editor. Click the "Add" button in the "Components" section. a popup dialog appears where you can select documents in the checkin tree. Navigate to the section "content/test/lsp_sheets" and select "lsp_minimum_in_array":

Click "Ok". The LSP sheet reference should now appear in the "Components" section:

Now our program problem is finished. Save the Tex source and compile it. It should compile without errors.

Note for customising feedback

It is possible to replace or supplement the text specified by the \prggrading command by a custom text. To this end, we import the class net.mumie.srv.corrutil.CorrUtil in the evaluator:

import net.mumie.srv.corrutil.CorrUtil;

Since CorrUtil provides static methods and constants that may be useful in the evaluator, it's also possible to do a static import of all fields and methods:

import static net.mumie.srv.corrutil.CorrUtil.*;

The following methods of CorrUtil act on the grading:

public static final void explanation (String content)

public static final void explanationI18N (String templateName, String... params)

public static final void explanationI18N (String templateName, int... params)

public static final void explanationMode (String mode)

The explanation method sets its argument as the custom feedback text. The argument may contain markup (don't forget to always escape the XML speacial characters '<', '>', '&', '"' by '<', '>', '&'). The two explanationI18N methods create an internationalized custom feedback text. The text is specified by an LSP XML template. The name and the parameters of the template are specified by templateName and params, respectively.

The explanationMode method controls whether the custom feedback is displayed before or after the default feedback, or if the former replaces the latter. Its argument, mode, can take the following values:

  • "before" : The custom feedback is displayed before the default one
  • "after" : The custom feedback is displayed after the default one
  • "replace" : The custom feedback replaces the default one

The default is "replace". The CorrUtil class provides static constants

public static final String REPLACE = "replace";

public static final String BEFORE = "before";

public static final String AFTER = "after";

for that values.

In the next part of the tutorial, we learn how to test the problem.

Previous: 2. Create the Java parts | Next: 4. Testing

create_program_problem_11_lsp_sheet_wizzard.png (40.8 KB) Marek Grudzinski, 04/07/2013 11:55 AM

create_program_problem_12_lsp_sheet.png (130 KB) Marek Grudzinski, 04/07/2013 11:55 AM

create_program_problem_13_metainfos_add_lsp_sheet.png (34.9 KB) Marek Grudzinski, 04/07/2013 11:55 AM

create_program_problem_14_metainfos_with_lsp_sheet.png (154 KB) Marek Grudzinski, 04/07/2013 11:55 AM

Create_program_problem_11_lsp_sheet_wizzard Create_program_problem_12_lsp_sheet Create_program_problem_13_metainfos_add_lsp_sheet Create_program_problem_14_metainfos_with_lsp_sheet
Add picture from clipboard (Maximum size: 500 MB)