use of org.olat.modules.assessment.AssessmentEntry 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.modules.assessment.AssessmentEntry in project openolat by klemens.
the class QTI21AssessmentRunController method doShowResults.
private void doShowResults(UserRequest ureq) {
removeAsListenerAndDispose(resultCtrl);
AssessmentTestSession session = null;
if (courseNode instanceof SelfAssessableCourseNode) {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
} else {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
AssessmentEntry assessmentEntry = am.getAssessmentEntry(courseNode, getIdentity());
if (assessmentEntry.getAssessmentId() != null) {
session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
} else {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
session = qtiService.getLastAssessmentTestSessions(courseEntry, courseNode.getIdent(), testEntry, getIdentity());
}
}
if (session == null) {
mainVC.contextPut("showResults", Boolean.FALSE);
} else {
FileResourceManager frm = FileResourceManager.getInstance();
File fUnzippedDirRoot = frm.unzipFileResource(session.getTestEntry().getOlatResource());
URI assessmentObjectUri = qtiService.createAssessmentTestUri(fUnzippedDirRoot);
File submissionDir = qtiService.getAssessmentResultFile(session);
String mapperUri = registerCacheableMapper(ureq, "QTI21CNResults::" + session.getTestEntry().getKey(), new ResourcesMapper(assessmentObjectUri, submissionDir));
resultCtrl = new AssessmentResultController(ureq, getWindowControl(), getIdentity(), true, session, fUnzippedDirRoot, mapperUri, null, getDeliveryOptions().getAssessmentResultsOptions(), false, false, true);
listenTo(resultCtrl);
mainVC.put("resultReport", resultCtrl.getInitialComponent());
mainVC.contextPut("showResults", Boolean.TRUE);
}
saveOpenPanel(ureq, "results", Boolean.TRUE);
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class QTI21AssessmentRunController method doDownloadSignature.
private void doDownloadSignature(UserRequest ureq) {
MediaResource resource = null;
if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
File signature = qtiService.getAssessmentResultSignature(session);
if (signature.exists()) {
resource = new DownloadeableMediaResource(signature);
}
}
if (resource == null) {
resource = new NotFoundMediaResource();
}
ureq.getDispatchResult().setResultingMediaResource(resource);
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class AssessmentServiceImpl method updateAssessmentEntry.
@Override
public AssessmentEntry updateAssessmentEntry(Identity assessedIdentity, RepositoryEntry entry, String subIdent, RepositoryEntry referenceEntry, AssessmentEntryStatus status) {
AssessmentEntry assessmentEntry = getOrCreateAssessmentEntry(assessedIdentity, null, entry, subIdent, referenceEntry);
assessmentEntry.setAssessmentStatus(status);
return assessmentEntryDao.updateAssessmentEntry(assessmentEntry);
}
use of org.olat.modules.assessment.AssessmentEntry in project openolat by klemens.
the class HighScoreManager method sortRankByScore.
/**
* Sort rank by score, then by id and last alphabetically,
* determine rank of each member dependent on score,
* decide whether there is a second table or not
*/
public HighScoreRankingResults sortRankByScore(List<AssessmentEntry> assessEntries, List<HighScoreTableEntry> allMembers, List<HighScoreTableEntry> ownIdMembers, List<List<HighScoreTableEntry>> allPodium, List<Integer> ownIdIndices, int tableSize, Identity ownIdentity) {
HighScoreTableEntry ownTableEntry = null;
for (AssessmentEntry assessmentEntry : assessEntries) {
float score = assessmentEntry.getScore() == null ? 0f : assessmentEntry.getScore().floatValue();
HighScoreTableEntry tableEntry = new HighScoreTableEntry(score, userManager.getUserDisplayName(assessmentEntry.getIdentity()), assessmentEntry.getIdentity());
if (tableEntry.getIdentity().equals(ownIdentity)) {
ownTableEntry = tableEntry;
}
allMembers.add(tableEntry);
}
assessEntries.clear();
// 3 step comparator, sorts by score then own Identity comes first, last alphabetically
Collections.sort(allMembers, new HighscoreComparator(ownIdentity));
float buffer = -1;
int index = 0;
// int rank = 1;
double[] allScores = new double[allMembers.size()];
for (int j = 0; j < allMembers.size(); j++) {
HighScoreTableEntry member = allMembers.get(j);
if (member.getScore() < buffer) {
index++;
// rank = j + 1;
}
// first three position are put in separate lists, exclude zero scorers
if (index < 3 && member.getScore() > 0) {
allPodium.get(index).add(member);
}
// finding position rank for own id
if (member.getIdentity().equals(ownIdentity)) {
ownIdIndices.add(j);
}
// setting rank for each member
member.setRank(index + 1);
buffer = member.getScore();
// adding scores for histogram
allScores[j] = buffer;
}
// only getting member with own id for 2nd table
ownIdMembers.addAll(allMembers.stream().skip(tableSize).filter(a -> a.getIdentity().equals(ownIdentity)).collect(Collectors.toList()));
if (ownIdMembers.size() > 0) {
log.audit("2nd Highscore Table established");
}
return new HighScoreRankingResults(allScores, ownTableEntry);
}
Aggregations