Search in sources :

Example 1 with TaskLight

use of org.olat.course.nodes.gta.TaskLight 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 2 with TaskLight

use of org.olat.course.nodes.gta.TaskLight in project openolat by klemens.

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 3 with TaskLight

use of org.olat.course.nodes.gta.TaskLight in project openolat by klemens.

the class GTACoachedParticipantListController method updateModel.

protected void updateModel(UserRequest ureq) {
    RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
    List<TaskLight> tasks = gtaManager.getTasksLight(entry, gtaNode);
    Map<Long, TaskLight> identityToTasks = new HashMap<>(tasks.size());
    for (TaskLight task : tasks) {
        if (task.getIdentityKey() != null) {
            identityToTasks.put(task.getIdentityKey(), task);
        }
    }
    List<IdentityMark> marks = gtaManager.getMarks(entry, gtaNode, ureq.getIdentity());
    Map<Long, IdentityMark> identityToMarks = new HashMap<>(marks.size());
    for (IdentityMark mark : marks) {
        if (mark.getParticipant() != null) {
            identityToMarks.put(mark.getParticipant().getKey(), mark);
        }
    }
    List<AssessmentEntry> assessments = assessmentService.loadAssessmentEntriesBySubIdent(entry, gtaNode.getIdent());
    Map<Long, AssessmentEntry> identityToAssessments = new HashMap<>(assessments.size());
    for (AssessmentEntry assessment : assessments) {
        if (assessment.getIdentity() != null) {
            identityToAssessments.put(assessment.getIdentity().getKey(), assessment);
        }
    }
    List<CoachedIdentityRow> rows = new ArrayList<>(assessableIdentities.size());
    for (UserPropertiesRow assessableIdentity : assessableIdentities) {
        IdentityMark mark = identityToMarks.get(assessableIdentity.getIdentityKey());
        if (markedOnly && mark == null)
            continue;
        FormLink markLink = uifactory.addFormLink("mark_" + assessableIdentity.getIdentityKey(), "mark", "", null, null, Link.NONTRANSLATED);
        markLink.setIconLeftCSS(mark != null ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        markLink.setUserObject(assessableIdentity.getIdentityKey());
        TaskLight task = identityToTasks.get(assessableIdentity.getIdentityKey());
        Date submissionDueDate = null;
        if (task == null || task.getTaskStatus() == null || task.getTaskStatus() == TaskProcess.assignment) {
            IdentityRef identityRef = new IdentityRefImpl(assessableIdentity.getIdentityKey());
            DueDate dueDate = gtaManager.getSubmissionDueDate(task, identityRef, null, 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 = hasSubmittedDocument(task);
            }
        }
        int numSubmittedDocs = task != null && task.getSubmissionNumOfDocs() != null ? task.getSubmissionNumOfDocs() : 0;
        AssessmentEntry assessment = identityToAssessments.get(assessableIdentity.getIdentityKey());
        Boolean userVisibility = assessment != null ? assessment.getUserVisibility() : null;
        BigDecimal score = assessment != null ? assessment.getScore() : null;
        Boolean passed = assessment != null ? assessment.getPassed() : null;
        rows.add(new CoachedIdentityRow(assessableIdentity, task, submissionDueDate, syntheticSubmissionDate, hasSubmittedDocument, markLink, userVisibility, score, passed, numSubmittedDocs));
    }
    tableModel.setObjects(rows);
    tableEl.reset();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) TaskLight(org.olat.course.nodes.gta.TaskLight) UserPropertiesRow(org.olat.user.UserPropertiesRow) DueDate(org.olat.course.nodes.gta.model.DueDate) IdentityMark(org.olat.course.nodes.gta.IdentityMark) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) BigDecimal(java.math.BigDecimal)

Example 4 with TaskLight

use of org.olat.course.nodes.gta.TaskLight in project OpenOLAT by OpenOLAT.

the class GTACoachedParticipantListController method updateModel.

protected void updateModel(UserRequest ureq) {
    RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
    List<TaskLight> tasks = gtaManager.getTasksLight(entry, gtaNode);
    Map<Long, TaskLight> identityToTasks = new HashMap<>(tasks.size());
    for (TaskLight task : tasks) {
        if (task.getIdentityKey() != null) {
            identityToTasks.put(task.getIdentityKey(), task);
        }
    }
    List<IdentityMark> marks = gtaManager.getMarks(entry, gtaNode, ureq.getIdentity());
    Map<Long, IdentityMark> identityToMarks = new HashMap<>(marks.size());
    for (IdentityMark mark : marks) {
        if (mark.getParticipant() != null) {
            identityToMarks.put(mark.getParticipant().getKey(), mark);
        }
    }
    List<AssessmentEntry> assessments = assessmentService.loadAssessmentEntriesBySubIdent(entry, gtaNode.getIdent());
    Map<Long, AssessmentEntry> identityToAssessments = new HashMap<>(assessments.size());
    for (AssessmentEntry assessment : assessments) {
        if (assessment.getIdentity() != null) {
            identityToAssessments.put(assessment.getIdentity().getKey(), assessment);
        }
    }
    List<CoachedIdentityRow> rows = new ArrayList<>(assessableIdentities.size());
    for (UserPropertiesRow assessableIdentity : assessableIdentities) {
        IdentityMark mark = identityToMarks.get(assessableIdentity.getIdentityKey());
        if (markedOnly && mark == null)
            continue;
        FormLink markLink = uifactory.addFormLink("mark_" + assessableIdentity.getIdentityKey(), "mark", "", null, null, Link.NONTRANSLATED);
        markLink.setIconLeftCSS(mark != null ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
        markLink.setUserObject(assessableIdentity.getIdentityKey());
        TaskLight task = identityToTasks.get(assessableIdentity.getIdentityKey());
        Date submissionDueDate = null;
        if (task == null || task.getTaskStatus() == null || task.getTaskStatus() == TaskProcess.assignment) {
            IdentityRef identityRef = new IdentityRefImpl(assessableIdentity.getIdentityKey());
            DueDate dueDate = gtaManager.getSubmissionDueDate(task, identityRef, null, 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 = hasSubmittedDocument(task);
            }
        }
        int numSubmittedDocs = task != null && task.getSubmissionNumOfDocs() != null ? task.getSubmissionNumOfDocs() : 0;
        AssessmentEntry assessment = identityToAssessments.get(assessableIdentity.getIdentityKey());
        Boolean userVisibility = assessment != null ? assessment.getUserVisibility() : null;
        BigDecimal score = assessment != null ? assessment.getScore() : null;
        Boolean passed = assessment != null ? assessment.getPassed() : null;
        rows.add(new CoachedIdentityRow(assessableIdentity, task, submissionDueDate, syntheticSubmissionDate, hasSubmittedDocument, markLink, userVisibility, score, passed, numSubmittedDocs));
    }
    tableModel.setObjects(rows);
    tableEl.reset();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) TaskLight(org.olat.course.nodes.gta.TaskLight) UserPropertiesRow(org.olat.user.UserPropertiesRow) DueDate(org.olat.course.nodes.gta.model.DueDate) IdentityMark(org.olat.course.nodes.gta.IdentityMark) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) BigDecimal(java.math.BigDecimal)

Aggregations

ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 TaskLight (org.olat.course.nodes.gta.TaskLight)4 DueDate (org.olat.course.nodes.gta.model.DueDate)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 BigDecimal (java.math.BigDecimal)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 IdentityMark (org.olat.course.nodes.gta.IdentityMark)2 BusinessGroup (org.olat.group.BusinessGroup)2 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)2 UserPropertiesRow (org.olat.user.UserPropertiesRow)2