Skip to content
Snippets Groups Projects
Commit b0ade80f authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_14.2' into OpenOLAT_15.0

parents ecec638c b5b051ef
No related branches found
No related tags found
No related merge requests found
...@@ -229,7 +229,8 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT ...@@ -229,7 +229,8 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT
if(ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) { if(ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
ModuleConfiguration config = getModuleConfiguration(); ModuleConfiguration config = getModuleConfiguration();
boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false); boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
if(!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) { if(!configRef && (config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0
|| config.getDateValue(IQEditController.CONFIG_KEY_RESULTS_END_TEST_DATE) != null)) {
timeLimit = true; timeLimit = true;
} else { } else {
AssessmentTest assessmentTest = loadAssessmentTest(testEntry); AssessmentTest assessmentTest = loadAssessmentTest(testEntry);
...@@ -369,7 +370,7 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT ...@@ -369,7 +370,7 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT
boolean hasTestReference = getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY) != null; boolean hasTestReference = getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY) != null;
if (hasTestReference) { if (hasTestReference) {
/* /*
* COnfiugre an IQxxx BB with a repo entry, do not publish * Configure an IQxxx BB with a repo entry, do not publish
* this BB, mark IQxxx as deleted, remove repo entry, undelete BB IQxxx * this BB, mark IQxxx as deleted, remove repo entry, undelete BB IQxxx
* and bang you enter this if. * and bang you enter this if.
*/ */
...@@ -479,7 +480,7 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT ...@@ -479,7 +480,7 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT
try { try {
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, false); RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, false);
if(re == null) { if(re == null) {
log.error("Cannot archive course node. Missing repository entry with soft key: ", repositorySoftKey); log.error("Cannot archive course node. Missing repository entry with soft key: {}", repositorySoftKey);
return false; return false;
} }
......
...@@ -39,11 +39,13 @@ import org.olat.core.util.Formatter; ...@@ -39,11 +39,13 @@ import org.olat.core.util.Formatter;
*/ */
public class ExtraTimeCellRenderer implements FlexiCellRenderer { public class ExtraTimeCellRenderer implements FlexiCellRenderer {
private final Date endDate;
private final boolean renderDueDate; private final boolean renderDueDate;
private final int timeLimitInSeconds; private final int timeLimitInSeconds;
private final Formatter formatter; private final Formatter formatter;
public ExtraTimeCellRenderer(boolean renderDueDate, int timeLimitInSeconds, Locale locale) { public ExtraTimeCellRenderer(boolean renderDueDate, int timeLimitInSeconds, Date endDate, Locale locale) {
this.endDate = endDate;
this.renderDueDate = renderDueDate; this.renderDueDate = renderDueDate;
this.timeLimitInSeconds = timeLimitInSeconds; this.timeLimitInSeconds = timeLimitInSeconds;
formatter = Formatter.getInstance(locale); formatter = Formatter.getInstance(locale);
...@@ -59,6 +61,16 @@ public class ExtraTimeCellRenderer implements FlexiCellRenderer { ...@@ -59,6 +61,16 @@ public class ExtraTimeCellRenderer implements FlexiCellRenderer {
if(renderDueDate) { if(renderDueDate) {
if(infos.getStart() != null) { if(infos.getStart() != null) {
int totalTime = timeLimitInSeconds; int totalTime = timeLimitInSeconds;
if(endDate != null) {
long leadingTimeInMilliSeconds = endDate.getTime() - infos.getStart().getTime();
int leadingTime = Math.round(leadingTimeInMilliSeconds / 1000f);
if(timeLimitInSeconds > 0) {
totalTime = Math.min(totalTime, leadingTime);
} else {
totalTime = leadingTime;
}
}
if(extraTimeInSeconds != null) { if(extraTimeInSeconds != null) {
totalTime += extraTimeInSeconds; totalTime += extraTimeInSeconds;
} }
......
...@@ -160,7 +160,8 @@ public class IQIdentityListCourseNodeController extends IdentityListCourseNodeCo ...@@ -160,7 +160,8 @@ public class IQIdentityListCourseNodeController extends IdentityListCourseNodeCo
if(testCourseNode != null && testCourseNode.hasQTI21TimeLimit(qtiTestEntry)) { if(testCourseNode != null && testCourseNode.hasQTI21TimeLimit(qtiTestEntry)) {
int timeLimitInSeconds = testCourseNode.getQTI21TimeLimitMaxInSeconds(qtiTestEntry); int timeLimitInSeconds = testCourseNode.getQTI21TimeLimitMaxInSeconds(qtiTestEntry);
boolean suspendEnabled = isSuspendEnable(); boolean suspendEnabled = isSuspendEnable();
FlexiCellRenderer renderer = new ExtraTimeCellRenderer(!suspendEnabled, timeLimitInSeconds, getLocale()); Date endDate = testCourseNode.getModuleConfiguration().getDateValue(IQEditController.CONFIG_KEY_RESULTS_END_TEST_DATE);
FlexiCellRenderer renderer = new ExtraTimeCellRenderer(!suspendEnabled, timeLimitInSeconds, endDate, getLocale());
String header = suspendEnabled ? "table.header.extra.time" : "table.header.end.date"; String header = suspendEnabled ? "table.header.extra.time" : "table.header.end.date";
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(header, IdentityCourseElementCols.details.ordinal(), renderer)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(header, IdentityCourseElementCols.details.ordinal(), renderer));
} }
...@@ -336,6 +337,8 @@ public class IQIdentityListCourseNodeController extends IdentityListCourseNodeCo ...@@ -336,6 +337,8 @@ public class IQIdentityListCourseNodeController extends IdentityListCourseNodeCo
doUpdateCourseNode(catse.getTestSessions(), catse.getAssessmentTest(), catse.getStatus()); doUpdateCourseNode(catse.getTestSessions(), catse.getAssessmentTest(), catse.getStatus());
loadModel(ureq); loadModel(ureq);
fireEvent(ureq, Event.CHANGED_EVENT); fireEvent(ureq, Event.CHANGED_EVENT);
} else if(event == Event.DONE_EVENT) {
loadModel(ureq);
} }
} }
super.event(ureq, source, event); super.event(ureq, source, event);
......
...@@ -90,6 +90,7 @@ public class QTI21EditForm extends FormBasicController { ...@@ -90,6 +90,7 @@ public class QTI21EditForm extends FormBasicController {
private MultipleSelectionElement showResultsOnFinishEl; private MultipleSelectionElement showResultsOnFinishEl;
private MultipleSelectionElement assessmentResultsOnFinishEl; private MultipleSelectionElement assessmentResultsOnFinishEl;
private FormLayoutContainer reportLayout; private FormLayoutContainer reportLayout;
private FormLayoutContainer testLayout;
private final boolean needManualCorrection; private final boolean needManualCorrection;
private final ModuleConfiguration modConfig; private final ModuleConfiguration modConfig;
...@@ -117,7 +118,7 @@ public class QTI21EditForm extends FormBasicController { ...@@ -117,7 +118,7 @@ public class QTI21EditForm extends FormBasicController {
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FormLayoutContainer testLayout = FormLayoutContainer.createDefaultFormLayout("testInfos", getTranslator()); testLayout = FormLayoutContainer.createDefaultFormLayout("testInfos", getTranslator());
testLayout.setRootForm(mainForm); testLayout.setRootForm(mainForm);
formLayout.add(testLayout); formLayout.add(testLayout);
initFormAssessmentInfos(testLayout); initFormAssessmentInfos(testLayout);
...@@ -276,7 +277,7 @@ public class QTI21EditForm extends FormBasicController { ...@@ -276,7 +277,7 @@ public class QTI21EditForm extends FormBasicController {
if(confirmTestDateCtrl == source) { if(confirmTestDateCtrl == source) {
if(DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) { if(DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
update(); update();
reportLayout.setDirty(true); testLayout.setDirty(true);
} else { } else {
testDateDependentEl.uncheckAll(); testDateDependentEl.uncheckAll();
} }
......
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