use of org.olat.course.nodes.gta.Task in project OpenOLAT by OpenOLAT.
the class AbstractDueDateTaskRuleSPI method getIndividualsToRemind.
protected List<Identity> getIndividualsToRemind(TaskList taskList, RepositoryEntry entry, GTACourseNode gtaNode) {
List<Task> tasks = gtaManager.getTasks(taskList, gtaNode);
Set<Identity> doneTasks = new HashSet<Identity>();
for (Task task : tasks) {
if (task.getIdentity() != null) {
doneTasks.add(task.getIdentity());
}
}
List<Identity> identities = repositoryEntryRelationDao.getMembers(entry, RepositoryEntryRelationType.both, GroupRoles.participant.name());
for (Iterator<Identity> identityIt = identities.iterator(); identityIt.hasNext(); ) {
if (doneTasks.contains(identityIt.next())) {
identityIt.remove();
}
}
return identities;
}
use of org.olat.course.nodes.gta.Task in project OpenOLAT by OpenOLAT.
the class GTANotifications method createIndividualSubscriptionInfo.
private void createIndividualSubscriptionInfo(Identity subscriberIdentity) {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
List<String> roles = repositoryService.getRoles(subscriberIdentity, entry);
boolean owner = roles.contains(GroupRoles.owner.name());
boolean coach = roles.contains(GroupRoles.coach.name());
if (owner || coach) {
Set<Identity> duplicateKiller = new HashSet<>();
List<Identity> assessableIdentities = new ArrayList<>();
List<Identity> participants;
List<BusinessGroup> coachedGroups = null;
if (owner) {
participants = businessGroupService.getMembersOf(entry, false, true);
} else {
SearchBusinessGroupParams params = new SearchBusinessGroupParams(subscriberIdentity, true, false);
coachedGroups = businessGroupService.findBusinessGroups(params, entry, 0, -1);
participants = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name());
}
for (Identity participant : participants) {
if (!duplicateKiller.contains(participant)) {
assessableIdentities.add(participant);
duplicateKiller.add(participant);
}
}
boolean repoTutor = owner || (coachedGroups.isEmpty() && repositoryService.hasRole(subscriberIdentity, entry, GroupRoles.coach.name()));
if (repoTutor) {
List<Identity> courseParticipants = repositoryService.getMembers(entry, GroupRoles.participant.name());
for (Identity participant : courseParticipants) {
if (!duplicateKiller.contains(participant)) {
assessableIdentities.add(participant);
duplicateKiller.add(participant);
}
}
}
for (Identity assessedIdentity : assessableIdentities) {
createIndividualSubscriptionInfo(assessedIdentity, true);
}
createCoachSolutionItems();
} else {
Task task = gtaManager.getTask(subscriberIdentity, taskList);
if (task != null) {
header = translator.translate("notifications.individual.header.task", new String[] { getTaskName(task), displayName });
}
}
if (roles.contains(GroupRoles.participant.name())) {
createIndividualSubscriptionInfo(subscriberIdentity, false);
Task task = gtaManager.getTask(subscriberIdentity, taskList);
if (isSolutionVisible(subscriberIdentity, null, task)) {
createParticipantSolutionItems(task, subscriberIdentity, null);
}
if (task != null && task.getTaskStatus() == TaskProcess.graded) {
createAssessmentItem(task, subscriberIdentity, false);
}
}
}
use of org.olat.course.nodes.gta.Task in project OpenOLAT by OpenOLAT.
the class GTANotifications method createBusinessGroupsSubscriptionInfo.
private void createBusinessGroupsSubscriptionInfo(Identity subscriberIdentity) {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
Membership membership = gtaManager.getMembership(subscriberIdentity, entry, gtaNode);
boolean owner = repositoryService.hasRole(subscriberIdentity, entry, GroupRoles.owner.name());
if (owner) {
List<BusinessGroup> groups = gtaManager.getBusinessGroups(gtaNode);
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, true);
}
createCoachSolutionItems();
} else if (membership.isCoach()) {
List<BusinessGroup> groups = gtaManager.getCoachedBusinessGroups(subscriberIdentity, gtaNode);
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, true);
}
createCoachSolutionItems();
}
if (membership.isParticipant()) {
List<BusinessGroup> groups = gtaManager.getParticipatingBusinessGroups(subscriberIdentity, gtaNode);
if (groups.size() == 1 && !owner && !membership.isCoach()) {
Task task = gtaManager.getTask(groups.get(0), taskList);
if (task != null) {
header = translator.translate("notifications.group.header.task", new String[] { getTaskName(task), displayName });
}
}
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, false);
Task task = gtaManager.getTask(group, taskList);
if (createParticipantSolutionItems(task, null, group)) {
break;
}
}
}
}
use of org.olat.course.nodes.gta.Task in project OpenOLAT by OpenOLAT.
the class GTANotifications method createIndividualSubscriptionInfo.
private void createIndividualSubscriptionInfo(Identity assessedIdentity, boolean coach) {
Task task = gtaManager.getTask(assessedIdentity, taskList);
if (coach && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SUBMIT)) {
task = checkSubmitStep(assessedIdentity, null, task);
// show after the step submit, if submission date after compare date
if (task != null && notInStep(task, TaskProcess.assignment, TaskProcess.submit) && task.getSubmissionDate() != null && task.getSubmissionDate().after(compareDate)) {
Date submissionDate = task.getSubmissionDate();
String fullName = userManager.getUserDisplayName(assessedIdentity);
File submitDirectory = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedIdentity);
File[] submissions = submitDirectory.listFiles(SystemFileFilter.FILES_ONLY);
if (submissions.length == 0) {
String[] params = new String[] { // {0}
getTaskName(task), // {1}
displayName, // {2}
fullName };
appendSubscriptionItem("notifications.submission.individual", params, assessedIdentity, submissionDate, coach);
} else {
for (File submission : submissions) {
String[] params = new String[] { // {0}
getTaskName(task), // {1}
displayName, // {2}
submission.getName(), // {3}
fullName };
appendSubscriptionItemForFile("notifications.submission.individual.doc", params, assessedIdentity, "[submit:0]", submission, submissionDate, coach);
}
}
}
}
createReviewAndRevisionsItems(task, assessedIdentity, null, coach);
createAcceptedItem(task, assessedIdentity, null, coach);
}
use of org.olat.course.nodes.gta.Task in project OpenOLAT by OpenOLAT.
the class GTANotifications method createBusinessGroupsSubscriptionItems.
private void createBusinessGroupsSubscriptionItems(BusinessGroup group, boolean coach) {
Task task = gtaManager.getTask(group, taskList);
if (gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SUBMIT)) {
task = checkSubmitStep(null, group, task);
if (task != null && notInStep(task, TaskProcess.assignment, TaskProcess.submit) && (task.getSubmissionDate() == null || task.getSubmissionDate().after(compareDate))) {
File submitDirectory = gtaManager.getSubmitDirectory(courseEnv, gtaNode, group);
VFSContainer submitContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, group);
Date submissionDate = task.getSubmissionDate();
File[] submisssions = submitDirectory.listFiles(SystemFileFilter.FILES_ONLY);
if (submisssions.length == 0) {
String[] params = new String[] { getTaskName(task), displayName, group.getName() };
appendSubscriptionItem("notifications.submission.group", params, group, submissionDate, coach);
} else {
for (File submission : submisssions) {
String author = getAuthor(submission, submitContainer);
String[] params = new String[] { // {0}
getTaskName(task), // {1}
displayName, // {2}
submission.getName(), // {3}
author, // {3}
group.getName() };
appendSubscriptionItemForFile("notifications.submission.group.doc", params, group, "[submit:0]", submission, submissionDate, coach);
}
}
}
}
createReviewAndRevisionsItems(task, null, group, coach);
createAcceptedItem(task, null, group, coach);
}
Aggregations