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

OO-4207: Respect user visibility when get the fully assessed from passed

parent 79dd13db
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 18 deletions
...@@ -530,7 +530,7 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { ...@@ -530,7 +530,7 @@ public class CourseAssessmentManagerImpl implements AssessmentManager {
assessmentEntry = assessmentService.updateAssessmentEntry(assessmentEntry); assessmentEntry = assessmentService.updateAssessmentEntry(assessmentEntry);
DBFactory.getInstance().commit(); DBFactory.getInstance().commit();
nodeAccessService.onPassedUpdated(courseNode, userCourseEnv, passed, Role.auto); nodeAccessService.onPassedUpdated(courseNode, userCourseEnv, passed, assessmentEntry.getUserVisibility(), by);
nodeAccessService.onStatusUpdated(courseNode, userCourseEnv, assessmentEntry.getAssessmentStatus(), by); nodeAccessService.onStatusUpdated(courseNode, userCourseEnv, assessmentEntry.getAssessmentStatus(), by);
DBFactory.getInstance().commit(); DBFactory.getInstance().commit();
......
...@@ -105,7 +105,7 @@ public class ConditionNodeAccessProvider implements NodeAccessProvider { ...@@ -105,7 +105,7 @@ public class ConditionNodeAccessProvider implements NodeAccessProvider {
} }
@Override @Override
public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Role by) { public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Boolean userVisibility, Role by) {
// nothing to do // nothing to do
} }
......
...@@ -40,7 +40,7 @@ public interface LearningPathConfigs { ...@@ -40,7 +40,7 @@ public interface LearningPathConfigs {
public FullyAssessedResult isFullyAssessedOnConfirmation(); public FullyAssessedResult isFullyAssessedOnConfirmation();
public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed); public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed, Boolean userVisibility);
public FullyAssessedResult isFullyAssessedOnStatus(AssessmentEntryStatus status); public FullyAssessedResult isFullyAssessedOnStatus(AssessmentEntryStatus status);
......
...@@ -120,8 +120,9 @@ public class LearningPathNodeAccessProvider implements NodeAccessProvider { ...@@ -120,8 +120,9 @@ public class LearningPathNodeAccessProvider implements NodeAccessProvider {
} }
@Override @Override
public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Role by) { public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed,
FullyAssessedResult result = getConfigs(courseNode).isFullyAssessedOnPassed(passed); Boolean userVisibility, Role by) {
FullyAssessedResult result = getConfigs(courseNode).isFullyAssessedOnPassed(passed, userVisibility);
updateFullyAssessed(courseNode, userCourseEnv, by, result); updateFullyAssessed(courseNode, userCourseEnv, by, result);
} }
......
...@@ -98,10 +98,10 @@ public class ModuleLearningPathConfigs implements LearningPathConfigs { ...@@ -98,10 +98,10 @@ public class ModuleLearningPathConfigs implements LearningPathConfigs {
} }
@Override @Override
public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed) { public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed, Boolean userVisibility) {
String doneTriggerName = getDoneTriggerName(); String doneTriggerName = getDoneTriggerName();
if (CONFIG_VALUE_TRIGGER_PASSED.equals(doneTriggerName)) { if (CONFIG_VALUE_TRIGGER_PASSED.equals(doneTriggerName)) {
boolean fullyAssessed = Boolean.TRUE.equals(passed); boolean fullyAssessed = Boolean.TRUE.equals(passed) && Boolean.TRUE.equals(userVisibility);
return LearningPathConfigs.fullyAssessed(true, fullyAssessed, doneOnFullyAssessed); return LearningPathConfigs.fullyAssessed(true, fullyAssessed, doneOnFullyAssessed);
} }
return LearningPathConfigs.notFullyAssessed(); return LearningPathConfigs.notFullyAssessed();
...@@ -115,8 +115,8 @@ public class ModuleLearningPathConfigs implements LearningPathConfigs { ...@@ -115,8 +115,8 @@ public class ModuleLearningPathConfigs implements LearningPathConfigs {
public FullyAssessedResult isFullyAssessedOnStatus(AssessmentEntryStatus status) { public FullyAssessedResult isFullyAssessedOnStatus(AssessmentEntryStatus status) {
String doneTriggerName = getDoneTriggerName(); String doneTriggerName = getDoneTriggerName();
if (CONFIG_VALUE_TRIGGER_STATUS_DONE.equals(doneTriggerName)) { if (CONFIG_VALUE_TRIGGER_STATUS_DONE.equals(doneTriggerName)) {
boolean fulylAssessed = AssessmentEntryStatus.done.equals(status); boolean fullyAssessed = AssessmentEntryStatus.done.equals(status);
return LearningPathConfigs.fullyAssessed(true, fulylAssessed, false); return LearningPathConfigs.fullyAssessed(true, fullyAssessed, false);
} }
return LearningPathConfigs.notFullyAssessed(); return LearningPathConfigs.notFullyAssessed();
} }
......
...@@ -57,7 +57,7 @@ public class UnsupportedLearningPathConfigs implements LearningPathConfigs { ...@@ -57,7 +57,7 @@ public class UnsupportedLearningPathConfigs implements LearningPathConfigs {
} }
@Override @Override
public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed) { public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed, Boolean userVisibility) {
return LearningPathConfigs.notFullyAssessed(); return LearningPathConfigs.notFullyAssessed();
} }
......
...@@ -50,7 +50,7 @@ public interface NodeAccessProvider extends NodeAccessProviderIdentifier { ...@@ -50,7 +50,7 @@ public interface NodeAccessProvider extends NodeAccessProviderIdentifier {
public void onAssessmentConfirmed(CourseNode courseNode, UserCourseEnvironment userCourseEnv); public void onAssessmentConfirmed(CourseNode courseNode, UserCourseEnvironment userCourseEnv);
public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Role by); public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Boolean userVisibility, Role by);
public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, public void onStatusUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv,
AssessmentEntryStatus status, Role by); AssessmentEntryStatus status, Role by);
......
...@@ -91,9 +91,11 @@ public interface NodeAccessService { ...@@ -91,9 +91,11 @@ public interface NodeAccessService {
* @param courseNode * @param courseNode
* @param userCourseEnv * @param userCourseEnv
* @param passed * @param passed
* @param userVisibility
* @param by * @param by
*/ */
public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Role by); public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed,
Boolean userVisibility, Role by);
/** /**
* Hook after the completion and the run status is updated. * Hook after the completion and the run status is updated.
......
...@@ -104,9 +104,10 @@ public class NodeAccessServiceImpl implements NodeAccessService, NodeVisitedList ...@@ -104,9 +104,10 @@ public class NodeAccessServiceImpl implements NodeAccessService, NodeVisitedList
} }
@Override @Override
public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed, Role by) { public void onPassedUpdated(CourseNode courseNode, UserCourseEnvironment userCourseEnv, Boolean passed,
Boolean userVisibility, Role by) {
NodeAccessType type = NodeAccessType.of(userCourseEnv); NodeAccessType type = NodeAccessType.of(userCourseEnv);
getNodeAccessProvider(type).onPassedUpdated(courseNode, userCourseEnv, passed, by); getNodeAccessProvider(type).onPassedUpdated(courseNode, userCourseEnv, passed, userVisibility, by);
} }
@Override @Override
......
...@@ -178,7 +178,7 @@ public class ScormCourseNode extends AbstractAccessableCourseNode { ...@@ -178,7 +178,7 @@ public class ScormCourseNode extends AbstractAccessableCourseNode {
boolean hasPassed = new ScormAssessmentConfig(getModuleConfiguration()).hasPassed(); boolean hasPassed = new ScormAssessmentConfig(getModuleConfiguration()).hasPassed();
boolean isPassedTrigger = CoreSpringFactory.getImpl(ScormLearningPathNodeHandler.class) boolean isPassedTrigger = CoreSpringFactory.getImpl(ScormLearningPathNodeHandler.class)
.getConfigs(this) .getConfigs(this)
.isFullyAssessedOnPassed(null) .isFullyAssessedOnPassed(null, null)
.isFullyAssessed(); .isFullyAssessed();
return isPassedTrigger && !hasPassed; return isPassedTrigger && !hasPassed;
} }
......
...@@ -57,7 +57,7 @@ public class STLearningPathConfigs implements LearningPathConfigs { ...@@ -57,7 +57,7 @@ public class STLearningPathConfigs implements LearningPathConfigs {
} }
@Override @Override
public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed) { public FullyAssessedResult isFullyAssessedOnPassed(Boolean passed, Boolean userVisibility) {
return LearningPathConfigs.notFullyAssessed(); return LearningPathConfigs.notFullyAssessed();
} }
......
...@@ -234,9 +234,9 @@ public class LearningPathNodeAccessProviderTest { ...@@ -234,9 +234,9 @@ public class LearningPathNodeAccessProviderTest {
@Test @Test
public void shouldInvokePassedConfig() { public void shouldInvokePassedConfig() {
sut.onPassedUpdated(courseNodeMock, coachCourseEnv, null, null); sut.onPassedUpdated(courseNodeMock, coachCourseEnv, null, null, null);
verify(configMock).isFullyAssessedOnPassed(any()); verify(configMock).isFullyAssessedOnPassed(any(), null);
} }
@Test @Test
......
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