use of org.olat.course.nodes.gta.TaskProcess in project openolat by klemens.
the class GTACoachedGroupListController method doEditDueDate.
private void doEditDueDate(UserRequest ureq, CoachedGroupRow row) {
if (editDueDatesCtrl != null)
return;
Task task;
BusinessGroup assessedGroup = row.getBusinessGroup();
RepositoryEntry entry = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
if (row.getTask() == null) {
TaskProcess firstStep = gtaManager.firstStep(gtaNode);
TaskList taskList = gtaManager.getTaskList(entry, gtaNode);
task = gtaManager.createAndPersistTask(null, taskList, firstStep, assessedGroup, null, gtaNode);
} else {
task = gtaManager.getTask(row.getTask());
}
editDueDatesCtrl = new EditDueDatesController(ureq, getWindowControl(), task, null, assessedGroup, gtaNode, entry, courseEnv);
listenTo(editDueDatesCtrl);
String title = translate("duedates.user", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) });
cmc = new CloseableModalController(getWindowControl(), "close", editDueDatesCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.course.nodes.gta.TaskProcess in project openolat by klemens.
the class GTACoachedParticipantListController method doEditDueDate.
private void doEditDueDate(UserRequest ureq, CoachedIdentityRow row) {
if (editDueDatesCtrl != null)
return;
Task task;
Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentity().getIdentityKey());
RepositoryEntry entry = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
if (row.getTask() == null) {
TaskProcess firstStep = gtaManager.firstStep(gtaNode);
TaskList taskList = gtaManager.getTaskList(entry, gtaNode);
task = gtaManager.createAndPersistTask(null, taskList, firstStep, null, assessedIdentity, gtaNode);
} else {
task = gtaManager.getTask(row.getTask());
}
editDueDatesCtrl = new EditDueDatesController(ureq, getWindowControl(), task, assessedIdentity, null, gtaNode, entry, courseEnv);
listenTo(editDueDatesCtrl);
String fullname = userManager.getUserDisplayName(assessedIdentity);
String title = translate("duedates.user", new String[] { fullname });
cmc = new CloseableModalController(getWindowControl(), "close", editDueDatesCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.course.nodes.gta.TaskProcess in project openolat by klemens.
the class GTAManagerImpl method selectTask.
private AssignmentResponse selectTask(Identity identity, BusinessGroup businessGroup, TaskList tasks, GTACourseNode cNode, File taskFile) {
Task currentTask;
if (businessGroup != null) {
currentTask = getTask(businessGroup, tasks);
} else {
currentTask = getTask(identity, tasks);
}
AssignmentResponse response;
if (currentTask == null) {
String taskName = taskFile.getName();
TaskList reloadedTasks = loadForUpdate(tasks);
String sampling = cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_SAMPLING);
if (GTACourseNode.GTASK_SAMPLING_UNIQUE.equals(sampling) && isTaskAssigned(reloadedTasks, taskName)) {
response = new AssignmentResponse(null, Status.alreadyAssigned);
} else {
TaskProcess nextStep = nextStep(TaskProcess.assignment, cNode);
TaskImpl task = createTask(taskName, reloadedTasks, nextStep, businessGroup, identity, cNode);
task.setAssignmentDate(new Date());
dbInstance.getCurrentEntityManager().persist(task);
syncAssessmentEntry(task, cNode, Role.user);
response = new AssignmentResponse(task, Status.ok);
}
dbInstance.commit();
} else {
if (currentTask.getTaskStatus() == TaskProcess.assignment) {
TaskProcess nextStep = nextStep(currentTask.getTaskStatus(), cNode);
((TaskImpl) currentTask).setTaskStatus(nextStep);
if (taskFile != null) {
((TaskImpl) currentTask).setTaskName(taskFile.getName());
}
}
currentTask = dbInstance.getCurrentEntityManager().merge(currentTask);
syncAssessmentEntry((TaskImpl) currentTask, cNode, Role.user);
response = new AssignmentResponse(currentTask, Status.ok);
}
return response;
}
use of org.olat.course.nodes.gta.TaskProcess in project openolat by klemens.
the class GTAManagerImpl method submitTask.
@Override
public Task submitTask(Task task, GTACourseNode cNode, int numOfDocs, Role by) {
TaskProcess review = nextStep(TaskProcess.submit, cNode);
TaskImpl taskImpl = (TaskImpl) task;
taskImpl.setSubmissionDate(new Date());
taskImpl.setSubmissionNumOfDocs(numOfDocs);
return updateTask(task, review, cNode, by);
}
use of org.olat.course.nodes.gta.TaskProcess in project openolat by klemens.
the class GTAManagerImpl method convertToAssessmentEntrystatus.
@Override
public AssessmentEntryStatus convertToAssessmentEntrystatus(Task task, GTACourseNode cNode) {
TaskProcess status = task.getTaskStatus();
TaskProcess firstStep = firstStep(cNode);
AssessmentEntryStatus assessmentStatus;
if (status == firstStep) {
assessmentStatus = AssessmentEntryStatus.notStarted;
} else if (status == TaskProcess.review || status == TaskProcess.correction || status == TaskProcess.grading) {
assessmentStatus = AssessmentEntryStatus.inReview;
} else if (status == TaskProcess.graded) {
assessmentStatus = AssessmentEntryStatus.done;
} else {
assessmentStatus = AssessmentEntryStatus.inProgress;
}
return assessmentStatus;
}
Aggregations