use of org.olat.course.nodes.gta.IdentityMark 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();
}
use of org.olat.course.nodes.gta.IdentityMark 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();
}
use of org.olat.course.nodes.gta.IdentityMark in project openolat by klemens.
the class GTAIdentityMarkDAOTest method shouldDeleteMarkOfAMarker.
@Test
public void shouldDeleteMarkOfAMarker() {
TaskList taskList = createTaskList();
TaskList otherTaskList = createTaskList();
Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
Identity participant1 = JunitTestHelper.createAndPersistIdentityAsUser("participant1");
Identity participant2 = JunitTestHelper.createAndPersistIdentityAsUser("participant2");
Identity participant3 = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
IdentityMark mark1 = sut.createAndPersisitMark(taskList, marker, participant1);
sut.createAndPersisitMark(taskList, marker, participant2);
sut.createAndPersisitMark(otherTaskList, marker, participant3);
sut.createAndPersisitMark(taskList, otherMarker, participant3);
IdentityMark mark3 = sut.createAndPersisitMark(taskList, marker, participant3);
dbInstance.commitAndCloseSession();
sut.deleteMark(taskList, marker, participant2);
dbInstance.commitAndCloseSession();
List<IdentityMark> marks = sut.loadMarks(taskList, marker);
assertThat(marks).hasSize(2);
assertThat(marks).containsExactly(mark1, mark3);
}
use of org.olat.course.nodes.gta.IdentityMark in project openolat by klemens.
the class GTAIdentityMarkDAOTest method shouldLoadAllMarksOfAMarker.
@Test
public void shouldLoadAllMarksOfAMarker() {
TaskList taskList = createTaskList();
TaskList otherTaskList = createTaskList();
Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
Identity participant1 = JunitTestHelper.createAndPersistIdentityAsUser("participant1");
Identity participant2 = JunitTestHelper.createAndPersistIdentityAsUser("participant2");
Identity participant3 = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
IdentityMark mark1 = sut.createAndPersisitMark(taskList, marker, participant1);
IdentityMark mark2 = sut.createAndPersisitMark(taskList, marker, participant2);
sut.createAndPersisitMark(otherTaskList, marker, participant3);
sut.createAndPersisitMark(taskList, otherMarker, participant3);
IdentityMark mark3 = sut.createAndPersisitMark(taskList, marker, participant3);
dbInstance.commitAndCloseSession();
List<IdentityMark> marks = sut.loadMarks(taskList, marker);
assertThat(marks).hasSize(3);
assertThat(marks).containsExactly(mark1, mark2, mark3);
}
use of org.olat.course.nodes.gta.IdentityMark in project openolat by klemens.
the class GTAIdentityMarkDAOTest method shouldDeleteMarkOfATaskList.
@Test
public void shouldDeleteMarkOfATaskList() {
TaskList taskList = createTaskList();
TaskList otherTaskList = createTaskList();
Identity marker = JunitTestHelper.createAndPersistIdentityAsAuthor("coach");
Identity otherMarker = JunitTestHelper.createAndPersistIdentityAsAuthor("otherCoach");
Identity participant1 = JunitTestHelper.createAndPersistIdentityAsUser("participant1");
Identity participant2 = JunitTestHelper.createAndPersistIdentityAsUser("participant2");
Identity participant3 = JunitTestHelper.createAndPersistIdentityAsUser("participant3");
sut.createAndPersisitMark(taskList, marker, participant1);
sut.createAndPersisitMark(taskList, marker, participant2);
sut.createAndPersisitMark(otherTaskList, marker, participant3);
sut.createAndPersisitMark(taskList, otherMarker, participant3);
sut.createAndPersisitMark(taskList, marker, participant3);
dbInstance.commitAndCloseSession();
int numberDeleted = sut.deleteMark(taskList);
dbInstance.commitAndCloseSession();
assertThat(numberDeleted).isSameAs(4);
List<IdentityMark> marksOfDeletedTaskList = sut.loadMarks(taskList, marker);
assertThat(marksOfDeletedTaskList).hasSize(0);
List<IdentityMark> marksOfExistinTaskList = sut.loadMarks(otherTaskList, marker);
assertThat(marksOfExistinTaskList).hasSize(1);
}
Aggregations