Search in sources :

Example 51 with TaskList

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

the class GTAIdentityListCourseNodeController method loadModel.

@Override
protected void loadModel(UserRequest ureq) {
    super.loadModel(ureq);
    ModuleConfiguration config = courseNode.getModuleConfiguration();
    if (GTAType.individual.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE)) && config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT)) {
        TaskList taskList = gtaManager.getTaskList(getCourseRepositoryEntry(), (GTACourseNode) courseNode);
        if (taskList != null) {
            loadTasksInModel(taskList);
        }
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) TaskList(org.olat.course.nodes.gta.TaskList)

Example 52 with TaskList

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

the class GroupBulkDownloadResource method prepare.

@Override
public void prepare(HttpServletResponse hres) {
    try {
        hres.setCharacterEncoding(encoding);
    } catch (Exception e) {
        log.error("", e);
    }
    String label = StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) + "_" + Formatter.formatDatetimeWithMinutes(new Date()) + ".zip";
    String urlEncodedLabel = StringHelper.urlEncodeUTF8(label);
    hres.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + urlEncodedLabel);
    hres.setHeader("Content-Description", urlEncodedLabel);
    try (ZipOutputStream zout = new ZipOutputStream(hres.getOutputStream())) {
        zout.setLevel(9);
        ICourse course = CourseFactory.loadCourse(courseOres);
        GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class);
        if (courseNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_GRADING)) {
            List<Identity> assessableIdentities = CoreSpringFactory.getImpl(BusinessGroupService.class).getMembers(groups, GroupRoles.participant.name());
            String courseTitle = course.getCourseTitle();
            String fileName = ExportUtil.createFileNameWithTimeStamp(courseTitle, "xlsx");
            List<AssessableCourseNode> nodes = Collections.<AssessableCourseNode>singletonList(courseNode);
            try (OutputStream out = new ShieldOutputStream(zout)) {
                zout.putNextEntry(new ZipEntry(fileName));
                ScoreAccountingHelper.createCourseResultsOverviewXMLTable(assessableIdentities, nodes, course, locale, out);
                zout.closeEntry();
            } catch (Exception e) {
                log.error("", e);
            }
        }
        TaskList taskList = gtaManager.getTaskList(course.getCourseEnvironment().getCourseGroupManager().getCourseEntry(), courseNode);
        for (BusinessGroup businessGroup : groups) {
            courseNode.archiveNodeData(course, businessGroup, taskList, "", zout);
        }
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) ZipOutputStream(java.util.zip.ZipOutputStream) OutputStream(java.io.OutputStream) ShieldOutputStream(org.olat.core.util.io.ShieldOutputStream) ZipEntry(java.util.zip.ZipEntry) TaskList(org.olat.course.nodes.gta.TaskList) ICourse(org.olat.course.ICourse) Date(java.util.Date) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ShieldOutputStream(org.olat.core.util.io.ShieldOutputStream) BusinessGroupService(org.olat.group.BusinessGroupService) ZipOutputStream(java.util.zip.ZipOutputStream) GTAManager(org.olat.course.nodes.gta.GTAManager) Identity(org.olat.core.id.Identity)

Example 53 with TaskList

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

the class ConvertToGTACourseNode method convert.

public void convert(TACourseNode sourceNode, GTACourseNode gtaNode, ICourse course) {
    ModuleConfiguration modConfig = sourceNode.getModuleConfiguration();
    CourseEnvironment courseEnv = course.getCourseEnvironment();
    gtaNode.setShortTitle("New_ " + sourceNode.getShortTitle());
    gtaNode.setLongTitle("New_ " + sourceNode.getLongTitle());
    gtaNode.setDisplayOption(sourceNode.getDisplayOption());
    gtaNode.setLearningObjectives(sourceNode.getLearningObjectives());
    TaskList taskList = gtaManager.createIfNotExists(courseEnv.getCourseGroupManager().getCourseEntry(), gtaNode);
    DBFactory.getInstance().commit();
    convertConfiguration(sourceNode, gtaNode);
    if (modConfig.getBooleanSafe(TACourseNode.CONF_TASK_ENABLED)) {
        convertTasks(taskList, sourceNode, gtaNode, course);
        DBFactory.getInstance().commit();
    }
    if (modConfig.getBooleanSafe(TACourseNode.CONF_DROPBOX_ENABLED)) {
        convertDropbox(taskList, sourceNode, gtaNode, courseEnv);
        DBFactory.getInstance().commit();
    }
    if (modConfig.getBooleanSafe(TACourseNode.CONF_RETURNBOX_ENABLED)) {
        convertReturnbox(taskList, sourceNode, gtaNode, courseEnv);
        DBFactory.getInstance().commit();
    }
    if (modConfig.getBooleanSafe(TACourseNode.CONF_SCORING_ENABLED)) {
        // copy the scores
        convertAssessmentDatas(taskList, sourceNode, gtaNode, course);
        DBFactory.getInstance().commit();
    }
    // solutions
    if (modConfig.getBooleanSafe(TACourseNode.CONF_SOLUTION_ENABLED)) {
        copySolutions(sourceNode, gtaNode, courseEnv);
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) TaskList(org.olat.course.nodes.gta.TaskList)

Example 54 with TaskList

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

the class GTAIdentityMarkDAOTest method shouldCheckIfHasNoMarks.

@Test
public void shouldCheckIfHasNoMarks() {
    TaskList taskList = createTaskList();
    TaskList otherTaskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
    Identity participant = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
    sut.createAndPersisitMark(otherTaskList, marker, participant);
    sut.createAndPersisitMark(taskList, otherMarker, participant);
    dbInstance.commitAndCloseSession();
    boolean hasMarks = sut.hasMarks(taskList, marker);
    assertThat(hasMarks).isFalse();
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 55 with TaskList

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

the class GTAIdentityMarkDAOTest method shouldCheckIfMarked.

@Test
public void shouldCheckIfMarked() {
    TaskList taskList = createTaskList();
    Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
    Identity participant = JunitTestHelper.createAndPersistIdentityAsUser("participant");
    sut.createAndPersisitMark(taskList, marker, participant);
    dbInstance.commitAndCloseSession();
    boolean isMarked = sut.isMarked(taskList, marker, participant);
    assertThat(isMarked).isTrue();
}
Also used : TaskList(org.olat.course.nodes.gta.TaskList) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Aggregations

TaskList (org.olat.course.nodes.gta.TaskList)102 Identity (org.olat.core.id.Identity)68 Test (org.junit.Test)64 RepositoryEntry (org.olat.repository.RepositoryEntry)60 GTACourseNode (org.olat.course.nodes.GTACourseNode)48 File (java.io.File)36 Task (org.olat.course.nodes.gta.Task)36 AssignmentResponse (org.olat.course.nodes.gta.AssignmentResponse)32 BusinessGroup (org.olat.group.BusinessGroup)20 ArrayList (java.util.ArrayList)16 Date (java.util.Date)12 List (java.util.List)12 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)12 TaskProcess (org.olat.course.nodes.gta.TaskProcess)10 ReminderRuleImpl (org.olat.modules.reminder.model.ReminderRuleImpl)10 IdentityMark (org.olat.course.nodes.gta.IdentityMark)8 ModuleConfiguration (org.olat.modules.ModuleConfiguration)8 Calendar (java.util.Calendar)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 GTAManager (org.olat.course.nodes.gta.GTAManager)6