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

OO-4825: deactivate and reassign assignments during invalidation process

parent 21ea5c8f
No related branches found
No related tags found
No related merge requests found
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.iq; package org.olat.course.nodes.iq;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
......
...@@ -159,7 +159,7 @@ public class ConfirmAssessmentTestSessionInvalidationController extends FormBasi ...@@ -159,7 +159,7 @@ public class ConfirmAssessmentTestSessionInvalidationController extends FormBasi
if(gradingService.isGradingEnabled(session.getTestEntry(), null)) { if(gradingService.isGradingEnabled(session.getTestEntry(), null)) {
AssessmentEntry assessmentEntry = courseAssessmentService.getAssessmentEntry(courseNode, assessedUserCourseEnv); AssessmentEntry assessmentEntry = courseAssessmentService.getAssessmentEntry(courseNode, assessedUserCourseEnv);
GradingAssignment assignment = gradingService.getGradingAssignment(session.getTestEntry(), assessmentEntry); GradingAssignment assignment = gradingService.getGradingAssignment(session.getTestEntry(), assessmentEntry);
if(assignment != null && session.getKey().equals(assessmentEntry.getAssessmentId()) && gradingService.hasRecordedTime(assignment)) { if(assignment != null && session.getKey().equals(assessmentEntry.getAssessmentId())) {
return assignment; return assignment;
} }
} }
...@@ -193,8 +193,10 @@ public class ConfirmAssessmentTestSessionInvalidationController extends FormBasi ...@@ -193,8 +193,10 @@ public class ConfirmAssessmentTestSessionInvalidationController extends FormBasi
session.setCancelled(true); session.setCancelled(true);
session = qtiService.updateAssessmentTestSession(session); session = qtiService.updateAssessmentTestSession(session);
dbInstance.commit(); dbInstance.commit();
AssessmentTestSession promotedSession = null;
if(updateEntryResults) { if(updateEntryResults) {
AssessmentTestSession promotedSession = getNextLastSession(); promotedSession = getNextLastSession();
if(promotedSession != null) { if(promotedSession != null) {
if(courseNode == null) { if(courseNode == null) {
qtiService.updateAssessmentEntry(promotedSession); qtiService.updateAssessmentEntry(promotedSession);
...@@ -209,7 +211,11 @@ public class ConfirmAssessmentTestSessionInvalidationController extends FormBasi ...@@ -209,7 +211,11 @@ public class ConfirmAssessmentTestSessionInvalidationController extends FormBasi
if(assignmentStatus == GradingAssignmentStatus.assigned if(assignmentStatus == GradingAssignmentStatus.assigned
|| assignmentStatus == GradingAssignmentStatus.inProcess || assignmentStatus == GradingAssignmentStatus.inProcess
|| assignmentStatus == GradingAssignmentStatus.done) { || assignmentStatus == GradingAssignmentStatus.done) {
gradingService.reopenAssignment(runningAssignment); if(promotedSession != null) {
gradingService.reopenAssignment(runningAssignment);
} else {
gradingService.deactivateAssignment(runningAssignment);
}
} }
} }
......
...@@ -137,13 +137,13 @@ public class ConfirmAssessmentTestSessionRevalidationController extends FormBasi ...@@ -137,13 +137,13 @@ public class ConfirmAssessmentTestSessionRevalidationController extends FormBasi
@Override @Override
protected void formOK(UserRequest ureq) { protected void formOK(UserRequest ureq) {
doInvalidateSession(ureq, canUpdateAssessmentEntry); doValidateSession(ureq, canUpdateAssessmentEntry);
} }
@Override @Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if(revalidateButton == source) { if(revalidateButton == source) {
doInvalidateSession(ureq, false); doValidateSession(ureq, false);
} }
super.formInnerEvent(ureq, source, event); super.formInnerEvent(ureq, source, event);
} }
...@@ -159,17 +159,18 @@ public class ConfirmAssessmentTestSessionRevalidationController extends FormBasi ...@@ -159,17 +159,18 @@ public class ConfirmAssessmentTestSessionRevalidationController extends FormBasi
if(gradingService.isGradingEnabled(session.getTestEntry(), null)) { if(gradingService.isGradingEnabled(session.getTestEntry(), null)) {
AssessmentEntry assessmentEntry = courseAssessmentService.getAssessmentEntry(courseNode, assessedUserCourseEnv); AssessmentEntry assessmentEntry = courseAssessmentService.getAssessmentEntry(courseNode, assessedUserCourseEnv);
GradingAssignment assignment = gradingService.getGradingAssignment(session.getTestEntry(), assessmentEntry); GradingAssignment assignment = gradingService.getGradingAssignment(session.getTestEntry(), assessmentEntry);
if(assignment != null && session.getKey().equals(assessmentEntry.getAssessmentId()) && gradingService.hasRecordedTime(assignment)) { if(assignment != null && session.getKey().equals(assessmentEntry.getAssessmentId())) {
return assignment; return assignment;
} }
} }
return null; return null;
} }
private void doInvalidateSession(UserRequest ureq, boolean updateEntryResults) { private void doValidateSession(UserRequest ureq, boolean updateEntryResults) {
session.setCancelled(false); session.setCancelled(false);
session = qtiService.updateAssessmentTestSession(session); session = qtiService.updateAssessmentTestSession(session);
dbInstance.commit(); dbInstance.commit();
if(updateEntryResults) { if(updateEntryResults) {
if(courseNode == null) { if(courseNode == null) {
qtiService.updateAssessmentEntry(session); qtiService.updateAssessmentEntry(session);
...@@ -184,6 +185,13 @@ public class ConfirmAssessmentTestSessionRevalidationController extends FormBasi ...@@ -184,6 +185,13 @@ public class ConfirmAssessmentTestSessionRevalidationController extends FormBasi
|| assignmentStatus == GradingAssignmentStatus.inProcess || assignmentStatus == GradingAssignmentStatus.inProcess
|| assignmentStatus == GradingAssignmentStatus.done) { || assignmentStatus == GradingAssignmentStatus.done) {
gradingService.reopenAssignment(runningAssignment); gradingService.reopenAssignment(runningAssignment);
} else if(assignmentStatus == GradingAssignmentStatus.deactivated
|| assignmentStatus == GradingAssignmentStatus.unassigned) {
dbInstance.commit();// if the assessment was updated before
AssessmentEntry assessmentEntry = gradingService
.loadFullAssessmentEntry(runningAssignment.getAssessmentEntry());
RepositoryEntry referenceEntry = session.getTestEntry();
gradingService.assignGrader(referenceEntry, assessmentEntry, true);
} }
} }
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.ims.qti21.ui; package org.olat.ims.qti21.ui;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
......
...@@ -294,7 +294,7 @@ upload.explanation=Datei auf lokalem Computer f\u00FCr \u00DCbertragung w\u00E4h ...@@ -294,7 +294,7 @@ upload.explanation=Datei auf lokalem Computer f\u00FCr \u00DCbertragung w\u00E4h
validate.xml.signature=Testquittung validieren validate.xml.signature=Testquittung validieren
validate.xml.signature.file=XML Datei validate.xml.signature.file=XML Datei
validate.xml.signature.ok=Testquittung und Datei konnte erfolgreich validiert werden. validate.xml.signature.ok=Testquittung und Datei konnte erfolgreich validiert werden.
warning.assignment.done=Die Korrektur dieses Tests ist bereits abgeschlossen. Wird diese Test-Session als ung\u00FCltig markiert (annulliert) wird, so gehen alle bestehenden Korrekturen verloren. warning.assignment.done=Die Korrektur dieses Tests ist bereits abgeschlossen. Wird diese Test-Session als ung\u00FCltig markiert (annulliert), so gehen alle bestehenden Korrekturen verloren.
warning.assignment.inProcess=Dieser Test befindet sich bereits in Korrektur. Wird diese Test-Session als ung\u00FCltig markiert (annulliert), so gehen alle Korrekturen verloren. warning.assignment.inProcess=Dieser Test befindet sich bereits in Korrektur. Wird diese Test-Session als ung\u00FCltig markiert (annulliert), so gehen alle Korrekturen verloren.
warning.download.log=Es gibt leider kein Logdatei f\u00FCr diesen Test. warning.download.log=Es gibt leider kein Logdatei f\u00FCr diesen Test.
warning.reset.assessmenttest.data=Die Test-Resultate wurden von einem Administrator oder Kursbesitzer zur\u00FCckgesetzt. Sie k\u00F6nnen den Test nicht fortsetzen und m\u00FCssen ihn erneut starten. warning.reset.assessmenttest.data=Die Test-Resultate wurden von einem Administrator oder Kursbesitzer zur\u00FCckgesetzt. Sie k\u00F6nnen den Test nicht fortsetzen und m\u00FCssen ihn erneut starten.
......
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