use of org.olat.course.assessment.model.BulkAssessmentFeedback in project OpenOLAT by OpenOLAT.
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;
}
use of org.olat.course.assessment.model.BulkAssessmentFeedback in project OpenOLAT by OpenOLAT.
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();
}
use of org.olat.course.assessment.model.BulkAssessmentFeedback in project OpenOLAT by OpenOLAT.
the class BulkAssessmentTask method run.
/**
* Used by to task executor, without any GUI
*/
@Override
public void run() {
final List<BulkAssessmentFeedback> feedbacks = new ArrayList<>();
try {
log.audit("Start process bulk assessment");
LoggingResourceable[] infos = new LoggingResourceable[2];
if (task != null && task.getCreator() != null) {
UserSession session = new UserSession();
session.setIdentity(task.getCreator());
session.setSessionInfo(new SessionInfo(task.getCreator().getKey(), task.getCreator().getName()));
ThreadLocalUserActivityLoggerInstaller.initUserActivityLogger(session);
infos[0] = LoggingResourceable.wrap(courseRes, OlatResourceableType.course);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos[0]);
infos[1] = LoggingResourceable.wrap(getCourseNode());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos[1]);
}
doProcess(feedbacks);
log.audit("End process bulk assessment");
cleanup();
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_BULK, getClass(), infos);
} catch (Exception e) {
log.error("", e);
feedbacks.add(new BulkAssessmentFeedback("", "bulk.assessment.error"));
throw e;
} finally {
cleanupUnzip();
sendFeedback(feedbacks);
}
}
use of org.olat.course.assessment.model.BulkAssessmentFeedback in project OpenOLAT by OpenOLAT.
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;
}
use of org.olat.course.assessment.model.BulkAssessmentFeedback in project OpenOLAT by OpenOLAT.
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;
}
Aggregations