diff --git a/src/main/java/org/olat/course/nodes/SurveyCourseNode.java b/src/main/java/org/olat/course/nodes/SurveyCourseNode.java index 6e4fbbf0e173f6e1f5520dbc2ecf19aa2e13a815..7aad74f31e191913865de726ad4d7704a0d2b631 100644 --- a/src/main/java/org/olat/course/nodes/SurveyCourseNode.java +++ b/src/main/java/org/olat/course/nodes/SurveyCourseNode.java @@ -142,9 +142,10 @@ public class SurveyCourseNode extends AbstractAccessableCourseNode { public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, ICourse course, UserCourseEnvironment euce) { updateModuleConfigDefaults(false); - TabbableController childTabCntrllr = new SurveyEditController(ureq, wControl, this, euce); + RepositoryEntry courseEntry = euce.getCourseEditorEnv().getCourseGroupManager().getCourseEntry(); + TabbableController childTabCtrl = new SurveyEditController(ureq, wControl, this, courseEntry); CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId()); - return new NodeEditController(ureq, wControl, course, chosenNode, euce, childTabCntrllr); + return new NodeEditController(ureq, wControl, course, chosenNode, euce, childTabCtrl); } @Override diff --git a/src/main/java/org/olat/course/nodes/survey/SurveyManager.java b/src/main/java/org/olat/course/nodes/survey/SurveyManager.java index 8b7971b137b1676776fee02292516d4056f2bc54..090a6817dc3e00ebf98bcfac1c8472759270c6dc 100644 --- a/src/main/java/org/olat/course/nodes/survey/SurveyManager.java +++ b/src/main/java/org/olat/course/nodes/survey/SurveyManager.java @@ -42,7 +42,7 @@ import org.olat.repository.RepositoryEntry; public interface SurveyManager { public EvaluationFormSurveyIdentifier getSurveyIdentifier(SurveyCourseNode surveyCourseNode, - UserCourseEnvironment userCourseEnv); + RepositoryEntry courseEntry); public EvaluationFormSurvey loadSurvey(EvaluationFormSurveyIdentifier surveyIdent); @@ -71,6 +71,6 @@ public interface SurveyManager { public long getCountOfSessions(EvaluationFormSurvey survey); - public void deleteAllData(EvaluationFormSurvey survey); + public void deleteAllData(EvaluationFormSurvey survey, SurveyCourseNode courseNode, UserCourseEnvironment userCourseEnv); } diff --git a/src/main/java/org/olat/course/nodes/survey/manager/SurveyManagerImpl.java b/src/main/java/org/olat/course/nodes/survey/manager/SurveyManagerImpl.java index 64d643b739ea05c374538293bc43b6cdc6080ad6..802b0e681fb6e758dddc28691235d6ff05e33fa1 100644 --- a/src/main/java/org/olat/course/nodes/survey/manager/SurveyManagerImpl.java +++ b/src/main/java/org/olat/course/nodes/survey/manager/SurveyManagerImpl.java @@ -22,15 +22,18 @@ package org.olat.course.nodes.survey.manager; import static org.olat.modules.forms.handler.EvaluationFormResource.FORM_XML_FILE; import java.io.File; +import java.util.List; import java.util.UUID; import org.olat.core.id.Identity; import org.olat.core.util.UserSession; +import org.olat.course.assessment.AssessmentManager; import org.olat.course.assessment.CourseAssessmentService; import org.olat.course.nodes.SurveyCourseNode; import org.olat.course.nodes.survey.SurveyManager; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.fileresource.FileResourceManager; +import org.olat.modules.assessment.AssessmentEntry; import org.olat.modules.assessment.Role; import org.olat.modules.assessment.model.AssessmentRunStatus; import org.olat.modules.ceditor.DataStorage; @@ -62,10 +65,9 @@ public class SurveyManagerImpl implements SurveyManager { @Override public EvaluationFormSurveyIdentifier getSurveyIdentifier(SurveyCourseNode surveyCourseNode, - UserCourseEnvironment userCourseEnv) { - RepositoryEntry ores = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry(); + RepositoryEntry courseEntry) { String subIdent = surveyCourseNode.getIdent(); - return EvaluationFormSurveyIdentifier.of(ores, subIdent); + return EvaluationFormSurveyIdentifier.of(courseEntry, subIdent); } @Override @@ -179,8 +181,20 @@ public class SurveyManagerImpl implements SurveyManager { } @Override - public void deleteAllData(EvaluationFormSurvey survey) { + public void deleteAllData(EvaluationFormSurvey survey, SurveyCourseNode courseNode, UserCourseEnvironment userCourseEnv) { evaluationFormManager.deleteAllData(survey); + + AssessmentManager assessmentManager = userCourseEnv.getCourseEnvironment().getAssessmentManager(); + List<AssessmentEntry> assessmentEntries = assessmentManager.getAssessmentEntries(courseNode); + for (AssessmentEntry assessmentEntry : assessmentEntries) { + assessmentEntry.setCurrentRunCompletion(null); + assessmentEntry.setCurrentRunStatus(null); + assessmentEntry.setCompletion(null); + assessmentEntry.setAssessmentStatus(null); + assessmentEntry.setFullyAssessed(null); + assessmentManager.updateAssessmentEntry(assessmentEntry); + } + } } diff --git a/src/main/java/org/olat/course/nodes/survey/ui/SurveyConfigController.java b/src/main/java/org/olat/course/nodes/survey/ui/SurveyConfigController.java index 47e7de0ff04e9da791ab36740781d974a4562762..619fb11d00cdac8cd6872713853fe9473d6ca546 100644 --- a/src/main/java/org/olat/course/nodes/survey/ui/SurveyConfigController.java +++ b/src/main/java/org/olat/course/nodes/survey/ui/SurveyConfigController.java @@ -43,7 +43,6 @@ import org.olat.core.util.StringHelper; import org.olat.course.editor.NodeEditController; import org.olat.course.nodes.SurveyCourseNode; import org.olat.course.nodes.survey.SurveyManager; -import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.modules.ModuleConfiguration; import org.olat.modules.ceditor.DataStorage; import org.olat.modules.forms.EvaluationFormSurvey; @@ -103,10 +102,10 @@ public class SurveyConfigController extends FormBasicController { private SurveyManager surveyManager; public SurveyConfigController(UserRequest ureq, WindowControl wControl, SurveyCourseNode surveyCourseNode, - UserCourseEnvironment userCourseEnv) { + RepositoryEntry courseEntry) { super(ureq, wControl); this.moduleConfiguration = surveyCourseNode.getModuleConfiguration(); - this.surveyIdent = surveyManager.getSurveyIdentifier(surveyCourseNode, userCourseEnv); + this.surveyIdent = surveyManager.getSurveyIdentifier(surveyCourseNode, courseEntry); this.survey = surveyManager.loadSurvey(surveyIdent); initForm(ureq); } diff --git a/src/main/java/org/olat/course/nodes/survey/ui/SurveyEditController.java b/src/main/java/org/olat/course/nodes/survey/ui/SurveyEditController.java index fb5765c2f179d25cb167f69e511b577414c9d720..b0b78bcf3be2dacd828412eac732b16ccd2576ab 100644 --- a/src/main/java/org/olat/course/nodes/survey/ui/SurveyEditController.java +++ b/src/main/java/org/olat/course/nodes/survey/ui/SurveyEditController.java @@ -28,7 +28,7 @@ import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController; import org.olat.course.nodes.SurveyCourseNode; -import org.olat.course.run.userview.UserCourseEnvironment; +import org.olat.repository.RepositoryEntry; /** * @@ -46,10 +46,10 @@ public class SurveyEditController extends ActivateableTabbableDefaultController private TabbedPane tabPane; public SurveyEditController(UserRequest ureq, WindowControl wControl, SurveyCourseNode surveyCourseNode, - UserCourseEnvironment userCourseEnv) { + RepositoryEntry courseEntry) { super(ureq, wControl); - surveyConfigController = new SurveyConfigController(ureq, wControl, surveyCourseNode, userCourseEnv); + surveyConfigController = new SurveyConfigController(ureq, wControl, surveyCourseNode, courseEntry); listenTo(surveyConfigController); } diff --git a/src/main/java/org/olat/course/nodes/survey/ui/SurveyRunController.java b/src/main/java/org/olat/course/nodes/survey/ui/SurveyRunController.java index a9ad7fcbfe74c2c649f1fdd82aefc340b71cbbed..7ca2b3e4e0f5dc0869dab318385077cf4489e2ab 100644 --- a/src/main/java/org/olat/course/nodes/survey/ui/SurveyRunController.java +++ b/src/main/java/org/olat/course/nodes/survey/ui/SurveyRunController.java @@ -41,6 +41,7 @@ import org.olat.modules.forms.EvaluationFormSession; import org.olat.modules.forms.EvaluationFormSurvey; import org.olat.modules.forms.EvaluationFormSurveyIdentifier; import org.olat.modules.forms.ui.EvaluationFormExecutionController; +import org.olat.repository.RepositoryEntry; import org.springframework.beans.factory.annotation.Autowired; /** @@ -73,7 +74,8 @@ public class SurveyRunController extends BasicController { super(ureq, wControl); this.userCourseEnv = userCourseEnv; this.courseNode = courseNode; - this.surveyIdent = surveyManager.getSurveyIdentifier(courseNode, userCourseEnv); + RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry(); + this.surveyIdent = surveyManager.getSurveyIdentifier(courseNode, courseEntry); this.secCallback = secCallback; mainVC = createVelocityContainer("run"); @@ -172,7 +174,7 @@ public class SurveyRunController extends BasicController { } private void doDeleteAllData(UserRequest ureq) { - surveyManager.deleteAllData(survey); + surveyManager.deleteAllData(survey, courseNode, userCourseEnv); initVelocityContainer(ureq); }