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

OO-4241: Reset assessment entries when resetting a survey course element

parent 7c0620e6
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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);
}
......@@ -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);
}
}
}
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
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