Search in sources :

Example 56 with GTACourseNode

use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.

the class AssessmentIdentityListCourseTreeController method doSelectCourseNode.

private Controller doSelectCourseNode(UserRequest ureq, CourseNode courseNode) {
    removeAsListenerAndDispose(currentCtrl);
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Node", new Long(courseNode.getIdent()));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    if (courseNode instanceof AssessableCourseNode) {
        if (((AssessableCourseNode) courseNode).isAssessedBusinessGroups() && courseNode instanceof GTACourseNode) {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
            List<BusinessGroup> coachedGroups;
            if (businessGroup != null) {
                coachedGroups = Collections.singletonList(businessGroup);
            } else if (assessmentCallback.isAdmin()) {
                coachedGroups = courseEnv.getCourseGroupManager().getAllBusinessGroups();
            } else {
                coachedGroups = assessmentCallback.getCoachedGroups();
            }
            currentCtrl = ((GTACourseNode) courseNode).getCoachedGroupListController(ureq, bwControl, stackPanel, coachCourseEnv, assessmentCallback.isAdmin(), coachedGroups);
        } else {
            currentCtrl = ((AssessableCourseNode) courseNode).getIdentityListController(ureq, bwControl, stackPanel, courseEntry, businessGroup, coachCourseEnv, toolContainer, assessmentCallback);
        }
    } else {
        currentCtrl = new IdentityListCourseNodeController(ureq, bwControl, stackPanel, courseEntry, businessGroup, courseNode, coachCourseEnv, toolContainer, assessmentCallback);
    }
    listenTo(currentCtrl);
    mainPanel.setContent(currentCtrl.getInitialComponent());
    addToHistory(ureq, currentCtrl);
    return currentCtrl;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResourceable(org.olat.core.id.OLATResourceable) BusinessGroup(org.olat.group.BusinessGroup) GTACourseNode(org.olat.course.nodes.GTACourseNode) WindowControl(org.olat.core.gui.control.WindowControl)

Example 57 with GTACourseNode

use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.

the class BeforeDateTaskRuleEditor method searchNodesWithDeadlines.

private void searchNodesWithDeadlines(CourseNode courseNode, List<CourseNode> nodes) {
    if (courseNode instanceof GTACourseNode) {
        GTACourseNode assessableCourseNode = (GTACourseNode) courseNode;
        ModuleConfiguration config = assessableCourseNode.getModuleConfiguration();
        if (AssignTaskRuleSPI.class.getSimpleName().equals(ruleType)) {
            boolean assignment = config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT);
            if (assignment) {
                Date dueDate = config.getDateValue(GTACourseNode.GTASK_ASSIGNMENT_DEADLINE);
                int numOfDays = config.getIntegerSafe(GTACourseNode.GTASK_ASSIGNMENT_DEADLINE_RELATIVE, -1);
                String relativeTo = config.getStringValue(GTACourseNode.GTASK_ASSIGNMENT_DEADLINE_RELATIVE_TO);
                if (dueDate != null) {
                    nodes.add(courseNode);
                } else if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
                    nodes.add(courseNode);
                }
            }
        } else if (SubmissionTaskRuleSPI.class.getSimpleName().equals(ruleType)) {
            boolean submit = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
            if (submit) {
                Date dueDate = config.getDateValue(GTACourseNode.GTASK_SUBMIT_DEADLINE);
                int numOfDays = config.getIntegerSafe(GTACourseNode.GTASK_SUBMIT_DEADLINE_RELATIVE, -1);
                String relativeTo = config.getStringValue(GTACourseNode.GTASK_SUBMIT_DEADLINE_RELATIVE_TO);
                if (dueDate != null) {
                    nodes.add(courseNode);
                } else if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
                    nodes.add(courseNode);
                }
            }
        }
    }
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        searchNodesWithDeadlines(child, nodes);
    }
}
Also used : AssignTaskRuleSPI(org.olat.course.nodes.gta.rule.AssignTaskRuleSPI) ModuleConfiguration(org.olat.modules.ModuleConfiguration) GTACourseNode(org.olat.course.nodes.GTACourseNode) CourseNode(org.olat.course.nodes.CourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) Date(java.util.Date)

Example 58 with GTACourseNode

use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.

the class BulkAssessmentTask method doProcess.

private void doProcess(List<BulkAssessmentFeedback> feedbacks) {
    final DB dbInstance = DBFactory.getInstance();
    final BaseSecurity securityManager = CoreSpringFactory.getImpl(BaseSecurity.class);
    final Identity coachIdentity = securityManager.loadIdentityByKey(coachedIdentity);
    final ICourse course = CourseFactory.loadCourse(courseRes);
    final AssessableCourseNode courseNode = getCourseNode();
    final Roles studentRoles = new Roles(false, false, false, false, false, false, false, false);
    final boolean hasUserComment = courseNode.hasCommentConfigured();
    final boolean hasScore = courseNode.hasScoreConfigured();
    final boolean hasPassed = courseNode.hasPassedConfigured();
    final boolean hasReturnFiles = (StringHelper.containsNonWhitespace(datas.getReturnFiles()) && (courseNode instanceof TACourseNode || courseNode instanceof GTACourseNode));
    if (hasReturnFiles) {
        try {
            OlatRootFileImpl returnFilesZipped = new OlatRootFileImpl(datas.getReturnFiles(), null);
            String tmp = FolderConfig.getCanonicalTmpDir();
            unzipped = new File(tmp, UUID.randomUUID().toString() + File.separatorChar);
            unzipped.mkdirs();
            ZipUtil.unzip(returnFilesZipped.getBasefile(), unzipped);
        } catch (Exception e) {
            log.error("Cannot unzip the return files during bulk assessment", e);
        }
    }
    Float min = null;
    Float max = null;
    Float cut = null;
    if (hasScore) {
        min = courseNode.getMinScoreConfiguration();
        max = courseNode.getMaxScoreConfiguration();
    }
    if (hasPassed) {
        cut = courseNode.getCutValueConfiguration();
    }
    int count = 0;
    List<BulkAssessmentRow> rows = datas.getRows();
    for (BulkAssessmentRow row : rows) {
        Long identityKey = row.getIdentityKey();
        if (identityKey == null) {
            feedbacks.add(new BulkAssessmentFeedback("bulk.action.no.such.user", row.getAssessedId()));
            // nothing to do
            continue;
        }
        Identity identity = securityManager.loadIdentityByKey(identityKey);
        IdentityEnvironment ienv = new IdentityEnvironment(identity, studentRoles);
        UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
        // update comment, empty string will reset comment
        String userComment = row.getComment();
        if (hasUserComment && userComment != null) {
            // Update userComment in db
            courseNode.updateUserUserComment(userComment, uce, coachIdentity);
        // LD: why do we have to update the efficiency statement?
        // EfficiencyStatementManager esm =	EfficiencyStatementManager.getInstance();
        // esm.updateUserEfficiencyStatement(uce);
        }
        // update score
        Float score = row.getScore();
        if (hasScore && score != null) {
            // score < minimum score
            if ((min != null && score.floatValue() < min.floatValue()) || (score.floatValue() < AssessmentHelper.MIN_SCORE_SUPPORTED)) {
            // "bulk.action.lessThanMin";
            } else // score > maximum score
            if ((max != null && score.floatValue() > max.floatValue()) || (score.floatValue() > AssessmentHelper.MAX_SCORE_SUPPORTED)) {
            // "bulk.action.greaterThanMax";
            } else {
                // score between minimum and maximum score
                ScoreEvaluation se;
                if (hasPassed && cut != null) {
                    Boolean passed = (score.floatValue() >= cut.floatValue()) ? Boolean.TRUE : Boolean.FALSE;
                    se = new ScoreEvaluation(score, passed);
                } else {
                    se = new ScoreEvaluation(score, null);
                }
                // Update score,passed properties in db, and the user's efficiency statement
                courseNode.updateUserScoreEvaluation(se, uce, coachIdentity, false, Role.auto);
            }
        }
        Boolean passed = row.getPassed();
        if (hasPassed && passed != null && cut == null) {
            // Configuration of manual assessment --> Display passed/not passed: yes, Type of display: Manual by tutor
            ScoreEvaluation seOld = courseNode.getUserScoreEvaluation(uce);
            Float oldScore = seOld.getScore();
            ScoreEvaluation se = new ScoreEvaluation(oldScore, passed);
            // Update score,passed properties in db, and the user's efficiency statement
            boolean incrementAttempts = false;
            courseNode.updateUserScoreEvaluation(se, uce, coachIdentity, incrementAttempts, Role.auto);
        }
        boolean identityHasReturnFile = false;
        if (hasReturnFiles && row.getReturnFiles() != null && row.getReturnFiles().size() > 0) {
            String assessedId = row.getAssessedId();
            File assessedFolder = new File(unzipped, assessedId);
            identityHasReturnFile = assessedFolder.exists();
            if (identityHasReturnFile) {
                processReturnFile(courseNode, row, uce, assessedFolder);
            }
        }
        if (courseNode instanceof GTACourseNode) {
            // push the state further
            GTACourseNode gtaNode = (GTACourseNode) courseNode;
            if ((hasScore && score != null) || (hasPassed && passed != null)) {
                // pushed to graded
                updateTasksState(gtaNode, uce, TaskProcess.grading);
            } else if (hasReturnFiles) {
                // push to revised
                updateTasksState(gtaNode, uce, TaskProcess.correction);
            }
        }
        if (count++ % 5 == 0) {
            dbInstance.commitAndCloseSession();
        } else {
            dbInstance.commit();
        }
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) GTACourseNode(org.olat.course.nodes.GTACourseNode) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) TACourseNode(org.olat.course.nodes.TACourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) OlatRootFileImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFileImpl) BulkAssessmentRow(org.olat.course.assessment.model.BulkAssessmentRow) FileNotFoundException(java.io.FileNotFoundException) BaseSecurity(org.olat.basesecurity.BaseSecurity) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) Identity(org.olat.core.id.Identity) File(java.io.File) IdentityEnvironment(org.olat.core.id.IdentityEnvironment) DB(org.olat.core.commons.persistence.DB)

Example 59 with GTACourseNode

use of org.olat.course.nodes.GTACourseNode in project OpenOLAT by OpenOLAT.

the class BulkAssessmentTask method getReturnBox.

/**
 * Return the target folder of the assessed identity. This is a factory method which take care
 * of the type of the course node.
 *
 * @param uce
 * @param courseNode
 * @param identity
 * @return
 */
private VFSContainer getReturnBox(UserCourseEnvironment uce, CourseNode courseNode, Identity identity) {
    VFSContainer returnContainer = null;
    if (courseNode instanceof GTACourseNode) {
        final GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class);
        CourseEnvironment courseEnv = uce.getCourseEnvironment();
        returnContainer = gtaManager.getCorrectionContainer(courseEnv, (GTACourseNode) courseNode, identity);
    } else {
        String returnPath = ReturnboxController.getReturnboxPathRelToFolderRoot(uce.getCourseEnvironment(), courseNode);
        OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(returnPath, null);
        VFSItem assessedItem = rootFolder.resolve(identity.getName());
        if (assessedItem == null) {
            returnContainer = rootFolder.createChildContainer(identity.getName());
        } else if (assessedItem instanceof VFSContainer) {
            returnContainer = (VFSContainer) assessedItem;
        }
    }
    return returnContainer;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) VFSContainer(org.olat.core.util.vfs.VFSContainer) GTACourseNode(org.olat.course.nodes.GTACourseNode) GTAManager(org.olat.course.nodes.gta.GTAManager) VFSItem(org.olat.core.util.vfs.VFSItem)

Example 60 with GTACourseNode

use of org.olat.course.nodes.GTACourseNode in project openolat by klemens.

the class OLATUpgrade_11_0_0 method postCopyPassedScore.

/**
 * Used if a passed or score value was set.
 * @param nodeAssessment
 * @param course
 */
private void postCopyPassedScore(AssessmentEntry entry, ICourse course) {
    String nodeIdent = entry.getSubIdent();
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
    if (courseNode instanceof GTACourseNode) {
    // 
    } else if (courseNode instanceof TACourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof IQTESTCourseNode) {
    // 
    } else if (courseNode instanceof PortfolioCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof MSCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof BasicLTICourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof ScormCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    }
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode)

Aggregations

GTACourseNode (org.olat.course.nodes.GTACourseNode)74 RepositoryEntry (org.olat.repository.RepositoryEntry)52 Test (org.junit.Test)48 Identity (org.olat.core.id.Identity)48 TaskList (org.olat.course.nodes.gta.TaskList)48 File (java.io.File)36 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)28 Task (org.olat.course.nodes.gta.Task)24 BusinessGroup (org.olat.group.BusinessGroup)16 ArrayList (java.util.ArrayList)14 CourseNode (org.olat.course.nodes.CourseNode)14 List (java.util.List)12 ICourse (org.olat.course.ICourse)12 ReminderRuleImpl (org.olat.modules.reminder.model.ReminderRuleImpl)12 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 TACourseNode (org.olat.course.nodes.TACourseNode)8 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)8 Calendar (java.util.Calendar)6 Date (java.util.Date)6 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)6