Search in sources :

Example 11 with BulkAssessmentFeedback

use of org.olat.course.assessment.model.BulkAssessmentFeedback in project openolat by klemens.

the class BulkAssessmentTask method process.

public List<BulkAssessmentFeedback> process() {
    List<BulkAssessmentFeedback> feedbacks = new ArrayList<>();
    try {
        LoggingResourceable infos = LoggingResourceable.wrap(getCourseNode());
        ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos);
        doProcess(feedbacks);
        cleanup();
    } catch (Exception e) {
        log.error("", e);
        feedbacks.add(new BulkAssessmentFeedback("", "bulk.assessment.error"));
    } finally {
        cleanupUnzip();
    }
    return feedbacks;
}
Also used : BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) ArrayList(java.util.ArrayList) LoggingResourceable(org.olat.util.logging.activity.LoggingResourceable) FileNotFoundException(java.io.FileNotFoundException)

Example 12 with BulkAssessmentFeedback

use of org.olat.course.assessment.model.BulkAssessmentFeedback in project openolat by klemens.

the class BulkAssessmentTask method renderFeedback.

public static String renderFeedback(List<BulkAssessmentFeedback> feedbacks, Translator translator) {
    UserManager userManager = CoreSpringFactory.getImpl(UserManager.class);
    StringBuilder sb = new StringBuilder();
    for (BulkAssessmentFeedback feedback : feedbacks) {
        String errorKey = feedback.getErrorKey();
        String msg = translator.translate(errorKey);
        String assessedName;
        if (feedback.getAssessedIdentity() != null) {
            assessedName = userManager.getUserDisplayName(feedback.getAssessedIdentity());
        } else {
            assessedName = feedback.getAssessedId();
        }
        sb.append(assessedName).append(": ").append(msg).append("\n");
    }
    return sb.toString();
}
Also used : BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) UserManager(org.olat.user.UserManager)

Example 13 with BulkAssessmentFeedback

use of org.olat.course.assessment.model.BulkAssessmentFeedback in project openolat by klemens.

the class BulkAssessmentOverviewController method doUpdateBulkAssessment.

private Feedback doUpdateBulkAssessment(Task task, AssessableCourseNode node, Date scheduledDate, BulkAssessmentDatas datas) {
    BulkAssessmentTask runnable = new BulkAssessmentTask(courseEntry.getOlatResource(), node, datas, getIdentity().getKey());
    Feedback feedback;
    if (scheduledDate == null) {
        List<BulkAssessmentFeedback> feedbacks = runnable.process();
        feedback = new Feedback(true, feedbacks);
        if (task != null) {
            taskManager.delete(task);
        }
    } else {
        taskManager.updateAndReturn(task, runnable, getIdentity(), scheduledDate);
        feedback = new Feedback(false, null);
    }
    return feedback;
}
Also used : BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask)

Example 14 with BulkAssessmentFeedback

use of org.olat.course.assessment.model.BulkAssessmentFeedback in project openolat by klemens.

the class BulkAssessmentOverviewController method doBulkAssessment.

private Feedback doBulkAssessment(AssessableCourseNode node, Date scheduledDate, BulkAssessmentDatas datas) {
    BulkAssessmentTask task = new BulkAssessmentTask(courseEntry.getOlatResource(), node, datas, getIdentity().getKey());
    Feedback feedback;
    if (scheduledDate == null) {
        List<BulkAssessmentFeedback> feedbacks = task.process();
        feedback = new Feedback(true, feedbacks);
    } else {
        taskManager.execute(task, getIdentity(), courseEntry.getOlatResource(), node.getIdent(), scheduledDate);
        feedback = new Feedback(false, null);
    }
    return feedback;
}
Also used : BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask)

Aggregations

BulkAssessmentFeedback (org.olat.course.assessment.model.BulkAssessmentFeedback)14 FileNotFoundException (java.io.FileNotFoundException)6 BulkAssessmentTask (org.olat.course.assessment.manager.BulkAssessmentTask)6 ArrayList (java.util.ArrayList)4 LoggingResourceable (org.olat.util.logging.activity.LoggingResourceable)4 File (java.io.File)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2 OlatRootFileImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFileImpl)2 DB (org.olat.core.commons.persistence.DB)2 Identity (org.olat.core.id.Identity)2 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)2 Roles (org.olat.core.id.Roles)2 SessionInfo (org.olat.core.util.SessionInfo)2 UserSession (org.olat.core.util.UserSession)2 ICourse (org.olat.course.ICourse)2 BulkAssessmentRow (org.olat.course.assessment.model.BulkAssessmentRow)2 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)2 GTACourseNode (org.olat.course.nodes.GTACourseNode)2 TACourseNode (org.olat.course.nodes.TACourseNode)2 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)2