diff --git a/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java b/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java index e8f406821e642fd75a5911fe536be65675bd4170..a902e852c13d401885c1ff91c3ed1af4dab40c15 100644 --- a/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java +++ b/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java @@ -229,7 +229,8 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT if(ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) { ModuleConfiguration config = getModuleConfiguration(); 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; } else { AssessmentTest assessmentTest = loadAssessmentTest(testEntry); @@ -369,7 +370,7 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT boolean hasTestReference = getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY) != null; 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 * and bang you enter this if. */ @@ -479,7 +480,7 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements QT try { RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, false); 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; } diff --git a/src/main/java/org/olat/course/nodes/iq/ExtraTimeCellRenderer.java b/src/main/java/org/olat/course/nodes/iq/ExtraTimeCellRenderer.java index 8537ef32fabf5ac18a0484a7d0a9532786702b3f..8577b5e8aa636426f712f7a0005d7a36a26427dc 100644 --- a/src/main/java/org/olat/course/nodes/iq/ExtraTimeCellRenderer.java +++ b/src/main/java/org/olat/course/nodes/iq/ExtraTimeCellRenderer.java @@ -39,11 +39,13 @@ import org.olat.core.util.Formatter; */ public class ExtraTimeCellRenderer implements FlexiCellRenderer { + private final Date endDate; private final boolean renderDueDate; private final int timeLimitInSeconds; 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.timeLimitInSeconds = timeLimitInSeconds; formatter = Formatter.getInstance(locale); @@ -59,6 +61,16 @@ public class ExtraTimeCellRenderer implements FlexiCellRenderer { if(renderDueDate) { if(infos.getStart() != null) { 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) { totalTime += extraTimeInSeconds; } diff --git a/src/main/java/org/olat/course/nodes/iq/IQIdentityListCourseNodeController.java b/src/main/java/org/olat/course/nodes/iq/IQIdentityListCourseNodeController.java index 613980b09086b7d940b31029ee6ae692ef224f4f..fb1b5501796bc94917146ad4d2b09529fe1e2772 100644 --- a/src/main/java/org/olat/course/nodes/iq/IQIdentityListCourseNodeController.java +++ b/src/main/java/org/olat/course/nodes/iq/IQIdentityListCourseNodeController.java @@ -160,7 +160,8 @@ public class IQIdentityListCourseNodeController extends IdentityListCourseNodeCo if(testCourseNode != null && testCourseNode.hasQTI21TimeLimit(qtiTestEntry)) { int timeLimitInSeconds = testCourseNode.getQTI21TimeLimitMaxInSeconds(qtiTestEntry); 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"; columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(header, IdentityCourseElementCols.details.ordinal(), renderer)); } @@ -336,6 +337,8 @@ public class IQIdentityListCourseNodeController extends IdentityListCourseNodeCo doUpdateCourseNode(catse.getTestSessions(), catse.getAssessmentTest(), catse.getStatus()); loadModel(ureq); fireEvent(ureq, Event.CHANGED_EVENT); + } else if(event == Event.DONE_EVENT) { + loadModel(ureq); } } super.event(ureq, source, event); diff --git a/src/main/java/org/olat/course/nodes/iq/QTI21EditForm.java b/src/main/java/org/olat/course/nodes/iq/QTI21EditForm.java index e389eb100e52f35cfe123b35f6a0e25b541516b3..50661c598432a89942086bfcebffbc1b91d33f80 100644 --- a/src/main/java/org/olat/course/nodes/iq/QTI21EditForm.java +++ b/src/main/java/org/olat/course/nodes/iq/QTI21EditForm.java @@ -90,6 +90,7 @@ public class QTI21EditForm extends FormBasicController { private MultipleSelectionElement showResultsOnFinishEl; private MultipleSelectionElement assessmentResultsOnFinishEl; private FormLayoutContainer reportLayout; + private FormLayoutContainer testLayout; private final boolean needManualCorrection; private final ModuleConfiguration modConfig; @@ -117,7 +118,7 @@ public class QTI21EditForm extends FormBasicController { @Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { - FormLayoutContainer testLayout = FormLayoutContainer.createDefaultFormLayout("testInfos", getTranslator()); + testLayout = FormLayoutContainer.createDefaultFormLayout("testInfos", getTranslator()); testLayout.setRootForm(mainForm); formLayout.add(testLayout); initFormAssessmentInfos(testLayout); @@ -276,7 +277,7 @@ public class QTI21EditForm extends FormBasicController { if(confirmTestDateCtrl == source) { if(DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) { update(); - reportLayout.setDirty(true); + testLayout.setDirty(true); } else { testDateDependentEl.uncheckAll(); }