use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.
the class GTANotifications method isSolutionVisible.
private boolean isSolutionVisible(Identity assessedIdentity, BusinessGroup assessedGroup, Task task) {
if (task != null) {
RepositoryEntry re = courseEnv.getCourseGroupManager().getCourseEntry();
DueDate availableDate = gtaManager.getSolutionDueDate(task, assessedIdentity, assessedGroup, gtaNode, re, true);
boolean visible = availableDate == null || (availableDate.getDueDate() != null && availableDate.getDueDate().compareTo(new Date()) <= 0);
if (visible) {
if (task.getTaskStatus() == TaskProcess.solution || task.getTaskStatus() == TaskProcess.grading || task.getTaskStatus() == TaskProcess.graded) {
// step solution or beyond
return true;
} else if ((task == null || task.getTaskStatus() == TaskProcess.assignment || task.getTaskStatus() == TaskProcess.submit || task.getTaskStatus() == TaskProcess.review || task.getTaskStatus() == TaskProcess.correction || task.getTaskStatus() == TaskProcess.revision) && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_ALL, false)) {
// steps before solution only if configured to
return true;
}
}
}
return false;
}
use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method getSolutionDueDate.
@Override
public DueDate getSolutionDueDate(TaskRef assignedTask, IdentityRef assessedIdentity, BusinessGroup assessedGroup, GTACourseNode cNode, RepositoryEntry courseEntry, boolean withIndividualDueDate) {
DueDate solutionDueDate = null;
boolean relativeDate = cNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_RELATIVE_DATES);
Date dueDate = cNode.getModuleConfiguration().getDateValue(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_AFTER);
if ((relativeDate || dueDate != null) && withIndividualDueDate && assignedTask != null && assignedTask.getSolutionDueDate() != null) {
solutionDueDate = new DueDate(false, assignedTask.getSolutionDueDate());
} else if (relativeDate) {
int numOfDays = cNode.getModuleConfiguration().getIntegerSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_AFTER_RELATIVE, -1);
String relativeTo = cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_AFTER_RELATIVE_TO);
if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
solutionDueDate = getReferenceDate(numOfDays, relativeTo, assignedTask, assessedIdentity, assessedGroup, courseEntry);
}
} else if (dueDate != null) {
solutionDueDate = new DueDate(false, dueDate);
}
return solutionDueDate;
}
use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.
the class GTACoachedGroupListController method updateModel.
protected void updateModel() {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
List<TaskLight> tasks = gtaManager.getTasksLight(entry, gtaNode);
Map<Long, TaskLight> groupToTasks = new HashMap<>();
for (TaskLight task : tasks) {
if (task.getBusinessGroupKey() != null) {
groupToTasks.put(task.getBusinessGroupKey(), task);
}
}
List<CoachedGroupRow> rows = new ArrayList<>(coachedGroups.size());
for (BusinessGroup group : coachedGroups) {
TaskLight task = groupToTasks.get(group.getKey());
Date submissionDueDate = null;
if (task == null || task.getTaskStatus() == null || task.getTaskStatus() == TaskProcess.assignment) {
DueDate dueDate = gtaManager.getSubmissionDueDate(task, null, group, gtaNode, entry, true);
if (dueDate != null) {
submissionDueDate = dueDate.getDueDate();
}
}
Date syntheticSubmissionDate = null;
boolean hasSubmittedDocument = false;
if (task != null && task.getTaskStatus() != null && task.getTaskStatus() != TaskProcess.assignment && task.getTaskStatus() != TaskProcess.submit) {
syntheticSubmissionDate = getSyntheticSubmissionDate(task);
if (syntheticSubmissionDate != null) {
hasSubmittedDocument = this.hasSubmittedDocument(task);
}
}
rows.add(new CoachedGroupRow(group, task, submissionDueDate, syntheticSubmissionDate, hasSubmittedDocument));
}
tableModel.setObjects(rows);
tableEl.reset();
}
use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.
the class EditDueDatesController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
ModuleConfiguration config = gtaNode.getModuleConfiguration();
Date assignmentDueDate = task.getAssignmentDueDate();
assignmentDueDateEl = uifactory.addDateChooser("assignment.duedate", assignmentDueDate, formLayout);
assignmentDueDateEl.setDateChooserTimeEnabled(true);
DueDate standardAssignmentDueDate = gtaManager.getAssignmentDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
setDueDateExplanation(assignmentDueDateEl, standardAssignmentDueDate);
assignmentDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT));
Date submissionDueDate = task.getSubmissionDueDate();
submissionDueDateEl = uifactory.addDateChooser("submission.duedate", submissionDueDate, formLayout);
submissionDueDateEl.setDateChooserTimeEnabled(true);
DueDate standardSubmissionDueDate = gtaManager.getSubmissionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
setDueDateExplanation(submissionDueDateEl, standardSubmissionDueDate);
boolean submissionDeadline = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
submissionDueDateEl.setVisible(submissionDeadline);
if (submissionDeadline && task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal()) {
StaticTextElement warningReopenEl = uifactory.addStaticTextElement("reopen", translate("warning.reopen"), formLayout);
warningReopenEl.setElementCssClass("o_gta_reopen_warning");
warningReopenEl.setLabel(null, null);
}
Date revisionsDueDate = task.getRevisionsDueDate();
revisionDueDateEl = uifactory.addDateChooser("revisions.duedate", revisionsDueDate, formLayout);
revisionDueDateEl.setDateChooserTimeEnabled(true);
revisionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD));
Date solutionDueDate = task.getSolutionDueDate();
solutionDueDateEl = uifactory.addDateChooser("solution.duedate", solutionDueDate, formLayout);
solutionDueDateEl.setDateChooserTimeEnabled(true);
DueDate standardSolutionDueDate = gtaManager.getSolutionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, true);
setDueDateExplanation(solutionDueDateEl, standardSolutionDueDate);
solutionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION));
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
uifactory.addFormSubmitButton("save", buttonsCont);
}
use of org.olat.course.nodes.gta.model.DueDate in project openolat by klemens.
the class GTAManagerImpl method getSolutionDueDate.
@Override
public DueDate getSolutionDueDate(TaskRef assignedTask, IdentityRef assessedIdentity, BusinessGroup assessedGroup, GTACourseNode cNode, RepositoryEntry courseEntry, boolean withIndividualDueDate) {
DueDate solutionDueDate = null;
boolean relativeDate = cNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_RELATIVE_DATES);
Date dueDate = cNode.getModuleConfiguration().getDateValue(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_AFTER);
if ((relativeDate || dueDate != null) && withIndividualDueDate && assignedTask != null && assignedTask.getSolutionDueDate() != null) {
solutionDueDate = new DueDate(false, assignedTask.getSolutionDueDate());
} else if (relativeDate) {
int numOfDays = cNode.getModuleConfiguration().getIntegerSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_AFTER_RELATIVE, -1);
String relativeTo = cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_AFTER_RELATIVE_TO);
if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
solutionDueDate = getReferenceDate(numOfDays, relativeTo, assignedTask, assessedIdentity, assessedGroup, courseEntry);
}
} else if (dueDate != null) {
solutionDueDate = new DueDate(false, dueDate);
}
return solutionDueDate;
}
Aggregations