Skip to content
Snippets Groups Projects
Commit 547a31aa authored by uhensler's avatar uhensler
Browse files

OO-3116: Usage of the question item should be editable

parent 066c183a
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,7 @@ public class QuestionMetadataEditController extends FormBasicController { ...@@ -70,6 +70,7 @@ public class QuestionMetadataEditController extends FormBasicController {
private TextElement stdevDifficultyEl; private TextElement stdevDifficultyEl;
private TextElement differentiationEl; private TextElement differentiationEl;
private TextElement numAnswerAltEl; private TextElement numAnswerAltEl;
private TextElement usageEl;
private FormLayoutContainer buttonsCont; private FormLayoutContainer buttonsCont;
private QuestionItem item; private QuestionItem item;
...@@ -149,7 +150,9 @@ public class QuestionMetadataEditController extends FormBasicController { ...@@ -149,7 +150,9 @@ public class QuestionMetadataEditController extends FormBasicController {
numAnswerAltEl = uifactory.addTextElement("question.numOfAnswerAlternatives", "question.numOfAnswerAlternatives", 24, numAnswerAlt, formLayout); numAnswerAltEl = uifactory.addTextElement("question.numOfAnswerAlternatives", "question.numOfAnswerAlternatives", 24, numAnswerAlt, formLayout);
numAnswerAltEl.setDisplaySize(4); numAnswerAltEl.setDisplaySize(4);
uifactory.addStaticTextElement("question.usage", Integer.toString(item.getUsage()), formLayout); String numUsage = item.getUsage() < 0 ? "" : Integer.toString(item.getUsage());
usageEl = uifactory.addTextElement("question.usage", "question.usage", 24, numUsage, formLayout);
usageEl.setDisplaySize(4);
buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonsCont.setRootForm(mainForm); buttonsCont.setRootForm(mainForm);
...@@ -169,6 +172,7 @@ public class QuestionMetadataEditController extends FormBasicController { ...@@ -169,6 +172,7 @@ public class QuestionMetadataEditController extends FormBasicController {
stdevDifficultyEl.setEnabled(canEditMetadata); stdevDifficultyEl.setEnabled(canEditMetadata);
differentiationEl.setEnabled(canEditMetadata); differentiationEl.setEnabled(canEditMetadata);
numAnswerAltEl.setEnabled(canEditMetadata); numAnswerAltEl.setEnabled(canEditMetadata);
usageEl.setEnabled(canEditMetadata);
buttonsCont.setVisible(canEditMetadata); buttonsCont.setVisible(canEditMetadata);
} }
...@@ -225,6 +229,9 @@ public class QuestionMetadataEditController extends FormBasicController { ...@@ -225,6 +229,9 @@ public class QuestionMetadataEditController extends FormBasicController {
int numOfAnswerAlternatives = toInt(numAnswerAltEl.getValue()); int numOfAnswerAlternatives = toInt(numAnswerAltEl.getValue());
itemImpl.setNumOfAnswerAlternatives(numOfAnswerAlternatives); itemImpl.setNumOfAnswerAlternatives(numOfAnswerAlternatives);
int numUsage = toInt(usageEl.getValue());
itemImpl.setUsage(numUsage);
item = qpoolService.updateItem(itemImpl); item = qpoolService.updateItem(itemImpl);
builder.withAfter(item); builder.withAfter(item);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment