use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method deleteAssessmentTestSession.
@Override
public boolean deleteAssessmentTestSession(List<Identity> identities, RepositoryEntryRef testEntry, RepositoryEntryRef entry, String subIdent) {
Set<AssessmentEntry> entries = new HashSet<>();
for (Identity identity : identities) {
List<AssessmentTestSession> sessions = testSessionDao.getTestSessions(testEntry, entry, subIdent, identity);
for (AssessmentTestSession session : sessions) {
if (session.getAssessmentEntry() != null) {
entries.add(session.getAssessmentEntry());
}
File fileStorage = testSessionDao.getSessionStorage(session);
testSessionDao.deleteTestSession(session);
FileUtils.deleteDirsAndFiles(fileStorage, true, true);
}
}
for (AssessmentEntry assessmentEntry : entries) {
assessmentEntryDao.resetAssessmentEntry(assessmentEntry);
}
return true;
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class BinderPickerController method updateAssessmentInfos.
private void updateAssessmentInfos(Date returnDate) {
if (returnDate != null) {
String rDate = formatter.formatDateAndTime(returnDate);
uifactory.addStaticTextElement("map.returnDate", rDate, infosContainer);
AssessmentEntry assessmentEntry = assessmentService.loadAssessmentEntry(getIdentity(), templateEntry, null, templateEntry);
assessmentInfosContainer.contextPut("hasScoreField", Boolean.FALSE);
/* score
if(courseNode.hasScoreConfigured()) {
Float score = scoreEval.getScore();
Float minScore = courseNode.getMinScoreConfiguration();
Float maxScore = courseNode.getMaxScoreConfiguration();
assessmentInfosContainer.contextPut("scoreMin", AssessmentHelper.getRoundedScore(minScore));
assessmentInfosContainer.contextPut("scoreMax", AssessmentHelper.getRoundedScore(maxScore));
assessmentInfosContainer.contextPut("score", AssessmentHelper.getRoundedScore(score));
}
*/
// passed
assessmentInfosContainer.contextPut("hasPassedField", Boolean.TRUE);
// if(courseNode.hasPassedConfigured()) {
Boolean passed = assessmentEntry.getPassed();
assessmentInfosContainer.contextPut("passed", passed);
assessmentInfosContainer.contextPut("hasPassedValue", new Boolean(passed != null));
// Float cutValue = courseNode.getCutValueConfiguration();
// assessmentInfosContainer.contextPut("passedCutValue", AssessmentHelper.getRoundedScore(cutValue));
// }
// get comment
String comment = assessmentEntry.getComment();
assessmentInfosContainer.contextPut("hasCommentField", new Boolean(comment != null));
if (comment != null) {
assessmentInfosContainer.contextPut("comment", comment);
}
assessmentInfosContainer.setVisible(true);
} else {
assessmentInfosContainer.setVisible(false);
}
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method updateAssessmentEntry.
private void updateAssessmentEntry(Identity assessedIdentity, Binder binder, Set<AssessmentSection> assessmentSections, Identity coachingIdentity) {
boolean allPassed = true;
int totalSectionPassed = 0;
int totalSectionClosed = 0;
BigDecimal totalScore = new BigDecimal("0.0");
AssessmentEntryStatus binderStatus = null;
for (AssessmentSection assessmentSection : assessmentSections) {
if (assessmentSection.getScore() != null) {
totalScore = totalScore.add(assessmentSection.getScore());
}
if (assessmentSection.getPassed() != null && assessmentSection.getPassed().booleanValue()) {
allPassed &= true;
totalSectionPassed++;
}
Section section = assessmentSection.getSection();
if (section.getSectionStatus() == SectionStatus.closed) {
totalSectionClosed++;
}
}
Boolean totalPassed = null;
if (totalSectionClosed == assessmentSections.size()) {
totalPassed = new Boolean(allPassed);
} else {
if (assessmentSections.size() == totalSectionPassed) {
totalPassed = Boolean.TRUE;
}
binderStatus = AssessmentEntryStatus.inProgress;
}
// order status from the entry / section
RepositoryEntry entry = binder.getEntry();
if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
ICourse course = CourseFactory.loadCourse(entry);
CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
ScoreEvaluation scoreEval = new ScoreEvaluation(totalScore.floatValue(), totalPassed, binderStatus, true, true, null, null, binder.getKey());
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
assessmentEntry.setScore(totalScore);
assessmentEntry.setPassed(totalPassed);
assessmentEntry.setAssessmentStatus(binderStatus);
assessmentService.updateAssessmentEntry(assessmentEntry);
}
}
use of org.olat.modules.assessment.AssessmentEntry in project OpenOLAT by OpenOLAT.
the class GTACoachedGroupGradingController method loadMembers.
private void loadMembers() {
// load participants, load datas
List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
List<AssessmentEntry> assessmentEntries = assessmentManager.getAssessmentEntries(assessedGroup, gtaNode);
for (AssessmentEntry entry : assessmentEntries) {
identityToEntryMap.put(entry.getIdentity(), entry);
}
List<AssessmentRow> rows = new ArrayList<>(identities.size());
for (Identity identity : identities) {
AssessmentEntry entry = identityToEntryMap.get(identity);
AssessmentRow row = new AssessmentRow(identity, false);
rows.add(row);
if (withScore && entry != null) {
String pointVal = AssessmentHelper.getRoundedScore(entry.getScore());
row.setScore(pointVal);
}
if (withPassed && entry != null) {
row.setPassed(entry.getPassed());
}
if (withComment) {
FormLink commentLink = null;
String comment = null;
if (entry != null && StringHelper.containsNonWhitespace(entry.getComment())) {
comment = entry.getComment();
commentLink = uifactory.addFormLink("comment-" + CodeHelper.getRAMUniqueID(), "comment", "comment", null, flc, Link.LINK);
commentLink.setIconLeftCSS("o_icon o_icon_comments");
commentLink.setUserObject(row);
}
row.setComment(comment);
row.setCommentTooltipLink(commentLink);
}
}
model.setObjects(rows);
table.reset();
}
use of org.olat.modules.assessment.AssessmentEntry 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();
}
Aggregations