From 239b6268dacf42e8c233a2c1333aadbc31efe4ff Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Fri, 26 Jun 2020 07:48:04 +0200 Subject: [PATCH] OO-4763: fix different for query and parameters --- .../ui/tool/IdentityListCourseNodeController.java | 11 +++++++++-- .../ims/qti21/manager/AssessmentTestSessionDAO.java | 2 +- .../ims/qti21/manager/archive/QTI21ArchiveFormat.java | 7 ++----- .../olat/ims/qti21/ui/QTI21ResetDataController.java | 4 ++++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/olat/course/assessment/ui/tool/IdentityListCourseNodeController.java b/src/main/java/org/olat/course/assessment/ui/tool/IdentityListCourseNodeController.java index 8726b8259cf..ac3e13dab44 100644 --- a/src/main/java/org/olat/course/assessment/ui/tool/IdentityListCourseNodeController.java +++ b/src/main/java/org/olat/course/assessment/ui/tool/IdentityListCourseNodeController.java @@ -31,6 +31,7 @@ import org.olat.basesecurity.BaseSecurityModule; import org.olat.basesecurity.Group; import org.olat.basesecurity.IdentityRef; import org.olat.basesecurity.model.IdentityRefImpl; +import org.olat.core.commons.persistence.DB; import org.olat.core.commons.persistence.SortKey; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; @@ -131,9 +132,11 @@ public class IdentityListCourseNodeController extends FormBasicController private final List<UserPropertyHandler> userPropertyHandlers; protected final AssessmentToolSecurityCallback assessmentCallback; - private Link nextLink, previousLink; + private Link nextLink; + private Link previousLink; protected FlexiTableElement tableEl; - private FormLink bulkDoneButton, bulkVisibleButton; + private FormLink bulkDoneButton; + private FormLink bulkVisibleButton; protected final TooledStackedPanel stackPanel; private final AssessmentToolContainer toolContainer; protected IdentityListCourseNodeTableModel usersTableModel; @@ -145,6 +148,8 @@ public class IdentityListCourseNodeController extends FormBasicController private CloseableCalloutWindowController toolsCalloutCtrl; private ConfirmUserVisibilityController changeUserVisibilityCtrl; + @Autowired + private DB dbInstance; @Autowired private UserManager userManager; @Autowired @@ -848,6 +853,7 @@ public class IdentityListCourseNodeController extends FormBasicController scoreEval.getAssessmentStatus(), visibility, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID()); assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach); + dbInstance.commitAndCloseSession(); } loadModel(ureq); } @@ -870,6 +876,7 @@ public class IdentityListCourseNodeController extends FormBasicController for(AssessedIdentityElementRow row:rows) { Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey()); doSetDone(assessedIdentity, assessableCourseNode, course); + dbInstance.commitAndCloseSession(); } loadModel(ureq); } diff --git a/src/main/java/org/olat/ims/qti21/manager/AssessmentTestSessionDAO.java b/src/main/java/org/olat/ims/qti21/manager/AssessmentTestSessionDAO.java index 4e1a9654dc2..66f461ab479 100644 --- a/src/main/java/org/olat/ims/qti21/manager/AssessmentTestSessionDAO.java +++ b/src/main/java/org/olat/ims/qti21/manager/AssessmentTestSessionDAO.java @@ -698,7 +698,7 @@ public class AssessmentTestSessionDAO { sb.append(" and membership.role='").append(GroupRoles.participant.name()).append("'"); } sb.append(" )"); - } else if(searchParams.getLimitToIdentities() != null) { + } else if(searchParams.getLimitToIdentities() != null && !searchParams.getLimitToIdentities().isEmpty()) { sb.append(" testSession.identity.key in (select membership.identity.key from bgroupmember as membership, repoentrytogroup as rel") .append(" where rel.entry.key=:repoEntryKey and rel.group.key=membership.group.key and membership.identity.key in (:limitIdentityKeys)") .append(" and membership.role='").append(GroupRoles.participant.name()).append("'") diff --git a/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java b/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java index 73ff2bf9432..ba27c05f335 100644 --- a/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java +++ b/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java @@ -474,11 +474,8 @@ public class QTI21ArchiveFormat { AssessmentItemSession itemSession = response.getAssessmentItemSession(); sessionResponses.addResponse(itemSession, response); } - writeDataRow(i + 1, sessionResponses, exportSheet, workbook); - - if(i % 25 == 0) { - DBFactory.getInstance().commitAndCloseSession(); - } + writeDataRow(i + 1, sessionResponses, exportSheet, workbook); + DBFactory.getInstance().commitAndCloseSession(); } } diff --git a/src/main/java/org/olat/ims/qti21/ui/QTI21ResetDataController.java b/src/main/java/org/olat/ims/qti21/ui/QTI21ResetDataController.java index ad503883370..aad336ceadc 100644 --- a/src/main/java/org/olat/ims/qti21/ui/QTI21ResetDataController.java +++ b/src/main/java/org/olat/ims/qti21/ui/QTI21ResetDataController.java @@ -31,6 +31,7 @@ import java.util.zip.ZipOutputStream; import org.olat.basesecurity.GroupRoles; import org.olat.core.commons.modules.bc.FolderConfig; +import org.olat.core.commons.persistence.DB; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement; @@ -86,6 +87,8 @@ public class QTI21ResetDataController extends FormBasicController { private CourseEnvironment courseEnv; private RepositoryEntry assessedEntry; + @Autowired + private DB dbInstance; @Autowired private QTI21Service qtiService; @Autowired @@ -209,6 +212,7 @@ public class QTI21ResetDataController extends FormBasicController { UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, courseEnv); testCourseNode.updateUserScoreEvaluation(scoreEval, uce, getIdentity(), false, Role.coach); testCourseNode.updateCurrentCompletion(uce, getIdentity(), null, AssessmentRunStatus.notStarted, Role.coach); + dbInstance.commitAndCloseSession(); } } else if(assessedEntry != null) { archiveData(assessedEntry); -- GitLab