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);
}
}
}
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);
}
}
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);
}
}
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();
}
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();
}
Aggregations