Search in sources :

Example 6 with DueDate

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;
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 7 with DueDate

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;
}
Also used : TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 8 with DueDate

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();
}
Also used : HashMap(java.util.HashMap) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskLight(org.olat.course.nodes.gta.TaskLight) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 9 with DueDate

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);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate)

Example 10 with DueDate

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;
}
Also used : TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Aggregations

DueDate (org.olat.course.nodes.gta.model.DueDate)44 Date (java.util.Date)38 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)14 TaskDueDate (org.olat.course.nodes.gta.TaskDueDate)12 RepositoryEntry (org.olat.repository.RepositoryEntry)10 File (java.io.File)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 ArrayList (java.util.ArrayList)4 Calendar (java.util.Calendar)4 HashMap (java.util.HashMap)4 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 TaskLight (org.olat.course.nodes.gta.TaskLight)4 ModuleConfiguration (org.olat.modules.ModuleConfiguration)4 BigDecimal (java.math.BigDecimal)2 List (java.util.List)2 IdentityRef (org.olat.basesecurity.IdentityRef)2 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2