Search in sources :

Example 1 with AssessmentToolSecurityCallback

use of org.olat.modules.assessment.ui.AssessmentToolSecurityCallback in project OpenOLAT by OpenOLAT.

the class BinderRuntimeController method doAssessmentTool.

private Activateable2 doAssessmentTool(UserRequest ureq) {
    OLATResourceable ores = OresHelper.createOLATResourceableType("TestStatistics");
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl swControl = addToHistory(ureq, ores, null);
    if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
        AssessmentToolSecurityCallback secCallback = new AssessmentToolSecurityCallback(reSecurity.isEntryAdmin(), reSecurity.isEntryAdmin(), reSecurity.isCourseCoach(), reSecurity.isGroupCoach(), null);
        AssessableResource el = getAssessableElement();
        AssessmentToolController ctrl = new AssessmentToolController(ureq, swControl, toolbarPanel, getRepositoryEntry(), el, secCallback);
        listenTo(ctrl);
        assessmentToolCtrl = pushController(ureq, "Statistics", ctrl);
        currentToolCtr = assessmentToolCtrl;
        setActiveTool(assessmentLink);
        enableRuntimeNavBar(false);
        return assessmentToolCtrl;
    }
    return null;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) AssessableResource(org.olat.modules.assessment.ui.AssessableResource) WindowControl(org.olat.core.gui.control.WindowControl) AssessmentToolController(org.olat.modules.assessment.ui.AssessmentToolController)

Example 2 with AssessmentToolSecurityCallback

use of org.olat.modules.assessment.ui.AssessmentToolSecurityCallback in project OpenOLAT by OpenOLAT.

the class CourseRuntimeController method doAssessmentTool.

private Activateable2 doAssessmentTool(UserRequest ureq) {
    if (delayedClose == Delayed.assessmentTool || requestForClose(ureq)) {
        OLATResourceable ores = OresHelper.createOLATResourceableType("assessmentToolv2");
        ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
        WindowControl swControl = addToHistory(ureq, ores, null);
        boolean admin = reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_ASSESSMENT);
        boolean nonMembers = reSecurity.isEntryAdmin();
        boolean repositoryEntryMembers = reSecurity.isCourseCoach();
        boolean businessGoupMembers = reSecurity.isGroupCoach();
        List<BusinessGroup> coachedGroups = null;
        if (businessGoupMembers) {
            coachedGroups = getUserCourseEnvironment().getCoachedGroups();
        }
        AssessmentToolSecurityCallback secCallBack = new AssessmentToolSecurityCallback(admin, nonMembers, repositoryEntryMembers, businessGoupMembers, coachedGroups);
        removeCustomCSS();
        AssessmentToolController ctrl = new AssessmentToolController(ureq, swControl, toolbarPanel, getRepositoryEntry(), getUserCourseEnvironment(), secCallBack);
        ctrl.activate(ureq, null, null);
        listenTo(ctrl);
        assessmentToolCtr = pushController(ureq, translate("command.openassessment"), ctrl);
        assessmentToolCtr.assessmentModeMessage();
        currentToolCtr = assessmentToolCtr;
        setActiveTool(assessmentLink);
        ctrl.initToolbar();
        return assessmentToolCtr;
    } else {
        delayedClose = Delayed.assessmentTool;
    }
    return null;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) BusinessGroup(org.olat.group.BusinessGroup) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) AssessmentToolController(org.olat.course.assessment.ui.tool.AssessmentToolController)

Example 3 with AssessmentToolSecurityCallback

use of org.olat.modules.assessment.ui.AssessmentToolSecurityCallback in project openolat by klemens.

the class BinderRuntimeController method doAssessmentTool.

private Activateable2 doAssessmentTool(UserRequest ureq) {
    OLATResourceable ores = OresHelper.createOLATResourceableType("TestStatistics");
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl swControl = addToHistory(ureq, ores, null);
    if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
        AssessmentToolSecurityCallback secCallback = new AssessmentToolSecurityCallback(reSecurity.isEntryAdmin(), reSecurity.isEntryAdmin(), reSecurity.isCourseCoach(), reSecurity.isGroupCoach(), null);
        AssessableResource el = getAssessableElement();
        AssessmentToolController ctrl = new AssessmentToolController(ureq, swControl, toolbarPanel, getRepositoryEntry(), el, secCallback);
        listenTo(ctrl);
        assessmentToolCtrl = pushController(ureq, "Statistics", ctrl);
        currentToolCtr = assessmentToolCtrl;
        setActiveTool(assessmentLink);
        enableRuntimeNavBar(false);
        return assessmentToolCtrl;
    }
    return null;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) AssessableResource(org.olat.modules.assessment.ui.AssessableResource) WindowControl(org.olat.core.gui.control.WindowControl) AssessmentToolController(org.olat.modules.assessment.ui.AssessmentToolController)

Example 4 with AssessmentToolSecurityCallback

use of org.olat.modules.assessment.ui.AssessmentToolSecurityCallback in project openolat by klemens.

the class AssessmentToolManagerTest method assessmentTool_coach.

@Test
public void assessmentTool_coach() {
    // course
    Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-author-1");
    ICourse course = CoursesWebService.createEmptyCourse(author, "course-assessment-tool", "course long name", null);
    // members as participant and coach
    Identity assessedIdentity1 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-1");
    Identity assessedIdentity2 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-2");
    Identity assessedIdentity3 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-3");
    Identity assessedIdentity4 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-4");
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-coach-1");
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    RepositoryEntry refEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    String subIdent = UUID.randomUUID().toString();
    BusinessGroup group1 = businessGroupDao.createAndPersist(null, "assessment-tool-bg-1", "assessment-tool-bg-1-desc", -1, -1, false, false, false, false, false);
    businessGroupRelationDao.addRelationToResource(group1, entry);
    BusinessGroup group2 = businessGroupDao.createAndPersist(null, "assessment-tool-bg-2", "assessment-tool-bg-2-desc", -1, -1, false, false, false, false, false);
    businessGroupRelationDao.addRelationToResource(group2, entry);
    businessGroupRelationDao.addRole(assessedIdentity1, group1, GroupRoles.participant.name());
    businessGroupRelationDao.addRole(assessedIdentity2, group1, GroupRoles.participant.name());
    businessGroupRelationDao.addRole(assessedIdentity3, group2, GroupRoles.participant.name());
    businessGroupRelationDao.addRole(coach, group1, GroupRoles.coach.name());
    dbInstance.commitAndCloseSession();
    // some datas
    assessmentEntryDao.createAssessmentEntry(assessedIdentity1, null, entry, subIdent, refEntry, 3.0f, Boolean.FALSE, null, null);
    assessmentEntryDao.createAssessmentEntry(assessedIdentity2, null, entry, subIdent, refEntry, 5.0f, Boolean.TRUE, null, null);
    assessmentEntryDao.createAssessmentEntry(assessedIdentity3, null, entry, subIdent, refEntry, 8.0f, Boolean.TRUE, null, null);
    assessmentEntryDao.createAssessmentEntry(assessedIdentity4, null, entry, subIdent, refEntry, 9.0f, Boolean.TRUE, null, null);
    assessmentEntryDao.createAssessmentEntry(null, UUID.randomUUID().toString(), entry, subIdent, refEntry);
    dbInstance.commitAndCloseSession();
    // coach of group 1 with id 1 and id2
    List<BusinessGroup> coachedGroups = Collections.singletonList(group1);
    AssessmentToolSecurityCallback assessmentCallback = new AssessmentToolSecurityCallback(false, false, false, true, coachedGroups);
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(entry, subIdent, refEntry, assessmentCallback);
    // statistics
    AssessmentStatistics statistics = assessmentToolManager.getStatistics(coach, params);
    Assert.assertEquals(4.0d, statistics.getAverageScore().doubleValue(), 0.0001);
    Assert.assertEquals(1, statistics.getCountFailed());
    Assert.assertEquals(1, statistics.getCountPassed());
    // check assessed identities list
    List<Identity> assessedIdentities = assessmentToolManager.getAssessedIdentities(coach, params);
    Assert.assertNotNull(assessedIdentities);
    Assert.assertEquals(2, assessedIdentities.size());
    // number of assessed identities
    int numOfAssessedIdentities = assessmentToolManager.getNumberOfAssessedIdentities(coach, params);
    Assert.assertEquals(2, numOfAssessedIdentities);
    // check only the queries
    AssessmentMembersStatistics participantStatistics = assessmentToolManager.getNumberOfParticipants(coach, params);
    Assert.assertNotNull(participantStatistics);
    int numOfInitialLanches = assessmentToolManager.getNumberOfInitialLaunches(coach, params);
    // not launched, only simulated
    Assert.assertEquals(0, numOfInitialLanches);
    List<IdentityShort> assessedShortIdentities = assessmentToolManager.getShortAssessedIdentities(coach, params, 120);
    Assert.assertNotNull(assessedShortIdentities);
    Assert.assertEquals(2, assessedShortIdentities.size());
    List<AssessmentEntry> assessmentEntries = assessmentToolManager.getAssessmentEntries(coach, params, AssessmentEntryStatus.notStarted);
    Assert.assertNotNull(assessmentEntries);
    Assert.assertEquals(0, assessmentEntries.size());
    // separate check with more options in the search parameters
    // add by group key
    params.setBusinessGroupKeys(Collections.singletonList(group1.getKey()));
    // assessed groups
    List<AssessedBusinessGroup> assessedGroups = assessmentToolManager.getBusinessGroupStatistics(coach, params);
    Assert.assertNotNull(assessedGroups);
    Assert.assertEquals(1, assessedGroups.size());
    // check assessed identities list
    List<Identity> assessedIdentitiesAlt = assessmentToolManager.getAssessedIdentities(coach, params);
    Assert.assertNotNull(assessedIdentitiesAlt);
    Assert.assertEquals(2, assessedIdentitiesAlt.size());
    // number of assessed identities
    int numOfAssessedIdentitiesAlt = assessmentToolManager.getNumberOfAssessedIdentities(coach, params);
    Assert.assertEquals(2, numOfAssessedIdentitiesAlt);
    List<IdentityShort> assessedShortIdentitiesAlt = assessmentToolManager.getShortAssessedIdentities(coach, params, 120);
    Assert.assertNotNull(assessedShortIdentitiesAlt);
    Assert.assertEquals(2, assessedShortIdentitiesAlt.size());
    List<AssessmentEntry> assessmentEntriesAlt = assessmentToolManager.getAssessmentEntries(coach, params, AssessmentEntryStatus.notStarted);
    Assert.assertNotNull(assessmentEntriesAlt);
    Assert.assertEquals(0, assessmentEntriesAlt.size());
}
Also used : AssessmentMembersStatistics(org.olat.modules.assessment.model.AssessmentMembersStatistics) BusinessGroup(org.olat.group.BusinessGroup) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) IdentityShort(org.olat.basesecurity.IdentityShort) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) AssessmentStatistics(org.olat.course.assessment.model.AssessmentStatistics) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 5 with AssessmentToolSecurityCallback

use of org.olat.modules.assessment.ui.AssessmentToolSecurityCallback in project OpenOLAT by OpenOLAT.

the class AssessmentToolManagerTest method assessmentTool_coach.

@Test
public void assessmentTool_coach() {
    // course
    Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-author-1");
    ICourse course = CoursesWebService.createEmptyCourse(author, "course-assessment-tool", "course long name", null);
    // members as participant and coach
    Identity assessedIdentity1 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-1");
    Identity assessedIdentity2 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-2");
    Identity assessedIdentity3 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-3");
    Identity assessedIdentity4 = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-4");
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("ast-coach-1");
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    RepositoryEntry refEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    String subIdent = UUID.randomUUID().toString();
    BusinessGroup group1 = businessGroupDao.createAndPersist(null, "assessment-tool-bg-1", "assessment-tool-bg-1-desc", -1, -1, false, false, false, false, false);
    businessGroupRelationDao.addRelationToResource(group1, entry);
    BusinessGroup group2 = businessGroupDao.createAndPersist(null, "assessment-tool-bg-2", "assessment-tool-bg-2-desc", -1, -1, false, false, false, false, false);
    businessGroupRelationDao.addRelationToResource(group2, entry);
    businessGroupRelationDao.addRole(assessedIdentity1, group1, GroupRoles.participant.name());
    businessGroupRelationDao.addRole(assessedIdentity2, group1, GroupRoles.participant.name());
    businessGroupRelationDao.addRole(assessedIdentity3, group2, GroupRoles.participant.name());
    businessGroupRelationDao.addRole(coach, group1, GroupRoles.coach.name());
    dbInstance.commitAndCloseSession();
    // some datas
    assessmentEntryDao.createAssessmentEntry(assessedIdentity1, null, entry, subIdent, refEntry, 3.0f, Boolean.FALSE, null, null);
    assessmentEntryDao.createAssessmentEntry(assessedIdentity2, null, entry, subIdent, refEntry, 5.0f, Boolean.TRUE, null, null);
    assessmentEntryDao.createAssessmentEntry(assessedIdentity3, null, entry, subIdent, refEntry, 8.0f, Boolean.TRUE, null, null);
    assessmentEntryDao.createAssessmentEntry(assessedIdentity4, null, entry, subIdent, refEntry, 9.0f, Boolean.TRUE, null, null);
    assessmentEntryDao.createAssessmentEntry(null, UUID.randomUUID().toString(), entry, subIdent, refEntry);
    dbInstance.commitAndCloseSession();
    // coach of group 1 with id 1 and id2
    List<BusinessGroup> coachedGroups = Collections.singletonList(group1);
    AssessmentToolSecurityCallback assessmentCallback = new AssessmentToolSecurityCallback(false, false, false, true, coachedGroups);
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(entry, subIdent, refEntry, assessmentCallback);
    // statistics
    AssessmentStatistics statistics = assessmentToolManager.getStatistics(coach, params);
    Assert.assertEquals(4.0d, statistics.getAverageScore().doubleValue(), 0.0001);
    Assert.assertEquals(1, statistics.getCountFailed());
    Assert.assertEquals(1, statistics.getCountPassed());
    // check assessed identities list
    List<Identity> assessedIdentities = assessmentToolManager.getAssessedIdentities(coach, params);
    Assert.assertNotNull(assessedIdentities);
    Assert.assertEquals(2, assessedIdentities.size());
    // number of assessed identities
    int numOfAssessedIdentities = assessmentToolManager.getNumberOfAssessedIdentities(coach, params);
    Assert.assertEquals(2, numOfAssessedIdentities);
    // check only the queries
    AssessmentMembersStatistics participantStatistics = assessmentToolManager.getNumberOfParticipants(coach, params);
    Assert.assertNotNull(participantStatistics);
    int numOfInitialLanches = assessmentToolManager.getNumberOfInitialLaunches(coach, params);
    // not launched, only simulated
    Assert.assertEquals(0, numOfInitialLanches);
    List<IdentityShort> assessedShortIdentities = assessmentToolManager.getShortAssessedIdentities(coach, params, 120);
    Assert.assertNotNull(assessedShortIdentities);
    Assert.assertEquals(2, assessedShortIdentities.size());
    List<AssessmentEntry> assessmentEntries = assessmentToolManager.getAssessmentEntries(coach, params, AssessmentEntryStatus.notStarted);
    Assert.assertNotNull(assessmentEntries);
    Assert.assertEquals(0, assessmentEntries.size());
    // separate check with more options in the search parameters
    // add by group key
    params.setBusinessGroupKeys(Collections.singletonList(group1.getKey()));
    // assessed groups
    List<AssessedBusinessGroup> assessedGroups = assessmentToolManager.getBusinessGroupStatistics(coach, params);
    Assert.assertNotNull(assessedGroups);
    Assert.assertEquals(1, assessedGroups.size());
    // check assessed identities list
    List<Identity> assessedIdentitiesAlt = assessmentToolManager.getAssessedIdentities(coach, params);
    Assert.assertNotNull(assessedIdentitiesAlt);
    Assert.assertEquals(2, assessedIdentitiesAlt.size());
    // number of assessed identities
    int numOfAssessedIdentitiesAlt = assessmentToolManager.getNumberOfAssessedIdentities(coach, params);
    Assert.assertEquals(2, numOfAssessedIdentitiesAlt);
    List<IdentityShort> assessedShortIdentitiesAlt = assessmentToolManager.getShortAssessedIdentities(coach, params, 120);
    Assert.assertNotNull(assessedShortIdentitiesAlt);
    Assert.assertEquals(2, assessedShortIdentitiesAlt.size());
    List<AssessmentEntry> assessmentEntriesAlt = assessmentToolManager.getAssessmentEntries(coach, params, AssessmentEntryStatus.notStarted);
    Assert.assertNotNull(assessmentEntriesAlt);
    Assert.assertEquals(0, assessmentEntriesAlt.size());
}
Also used : AssessmentMembersStatistics(org.olat.modules.assessment.model.AssessmentMembersStatistics) BusinessGroup(org.olat.group.BusinessGroup) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) IdentityShort(org.olat.basesecurity.IdentityShort) AssessmentToolSecurityCallback(org.olat.modules.assessment.ui.AssessmentToolSecurityCallback) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) AssessmentStatistics(org.olat.course.assessment.model.AssessmentStatistics) SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) AssessedBusinessGroup(org.olat.course.assessment.model.AssessedBusinessGroup) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Aggregations

AssessmentToolSecurityCallback (org.olat.modules.assessment.ui.AssessmentToolSecurityCallback)8 WindowControl (org.olat.core.gui.control.WindowControl)6 OLATResourceable (org.olat.core.id.OLATResourceable)6 BusinessGroup (org.olat.group.BusinessGroup)4 AssessableResource (org.olat.modules.assessment.ui.AssessableResource)4 AssessmentToolController (org.olat.modules.assessment.ui.AssessmentToolController)4 Test (org.junit.Test)2 IdentityShort (org.olat.basesecurity.IdentityShort)2 Identity (org.olat.core.id.Identity)2 ICourse (org.olat.course.ICourse)2 AssessedBusinessGroup (org.olat.course.assessment.model.AssessedBusinessGroup)2 AssessmentStatistics (org.olat.course.assessment.model.AssessmentStatistics)2 SearchAssessedIdentityParams (org.olat.course.assessment.model.SearchAssessedIdentityParams)2 AssessmentToolController (org.olat.course.assessment.ui.tool.AssessmentToolController)2 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)2 AssessmentMembersStatistics (org.olat.modules.assessment.model.AssessmentMembersStatistics)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2