use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class QTI12ResultDetailsController method doRetrieveTest.
/**
* Retrieve the test: load the course, close the assessment instamce, persist the QTI
* result set, pass the score to the course node.
* @param ureq
*/
private void doRetrieveTest() {
ICourse course = CourseFactory.loadCourse(courseResourceableId);
AssessableCourseNode testNode = (AssessableCourseNode) course.getRunStructure().getNode(nodeIdent);
ModuleConfiguration modConfig = testNode.getModuleConfiguration();
String resourcePathInfo = courseResourceableId + File.separator + nodeIdent;
AssessmentInstance ai = AssessmentFactory.createAssessmentInstance(assessedIdentity, "", modConfig, false, courseResourceableId, nodeIdent, resourcePathInfo, null);
// close the test
ai.stop();
// persist the results
iqm.persistResults(ai);
// reporting
Document docResReporting = iqm.getResultsReporting(ai, assessedIdentity, I18nModule.getDefaultLocale());
FilePersister.createResultsReporting(docResReporting, assessedIdentity, ai.getFormattedType(), ai.getAssessID());
// olat results
AssessmentContext ac = ai.getAssessmentContext();
Float score = Float.valueOf(ac.getScore());
Boolean passed = Boolean.valueOf(ac.isPassed());
ScoreEvaluation sceval = new ScoreEvaluation(score, passed, Boolean.FALSE, new Long(ai.getAssessID()));
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
testNode.updateUserScoreEvaluation(sceval, userCourseEnv, assessedIdentity, true, Role.coach);
// cleanup
ai.cleanUp();
List<QTIResultSet> resultSets = qrm.getResultSets(courseResourceableId, nodeIdent, repositoryEntry.getKey(), assessedIdentity);
tableModel.setObjects(resultSets);
tableCtr.modelChanged();
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class PFCourseNode method createPeekViewRunController.
@Override
public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
VFSContainer rootFolder = null;
CourseEnvironment courseEnv = userCourseEnv.getCourseEnvironment();
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
Path folderRelPath = null;
OlatRootFolderImpl baseContainer = courseEnv.getCourseBaseContainer();
PFManager pfManager = CoreSpringFactory.getImpl(PFManager.class);
if (userCourseEnv.isCoach() || userCourseEnv.isAdmin()) {
folderRelPath = Paths.get(baseContainer.getBasefile().toPath().toString(), PFManager.FILENAME_PARTICIPANTFOLDER, getIdent());
rootFolder = new LocalFolderImpl(folderRelPath.toFile());
} else if (userCourseEnv.isParticipant()) {
folderRelPath = Paths.get(baseContainer.getBasefile().toPath().toString(), PFManager.FILENAME_PARTICIPANTFOLDER, getIdent(), pfManager.getIdFolderName(identity));
rootFolder = new LocalFolderImpl(folderRelPath.toFile());
}
if (rootFolder == null) {
return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
} else {
return new PFPeekviewController(ureq, wControl, rootFolder, getIdent(), 4);
}
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class CheckboxAssessmentController method formOK.
@Override
protected void formOK(UserRequest ureq) {
saveCurrentSelectCheckbox();
int numOfCheckbox = checkboxList.getNumOfCheckbox();
Map<Long, CheckListAssessmentRow> identityToInitialRow = new HashMap<>();
for (CheckListAssessmentRow initialRow : initialRows) {
identityToInitialRow.put(initialRow.getIdentityKey(), initialRow);
}
Set<Long> assessedIdentityToUpdate = new HashSet<>();
List<CheckboxAssessmentRow> rows = model.getObjects();
List<AssessmentBatch> batchElements = new ArrayList<>();
for (CheckboxAssessmentRow row : rows) {
CheckListAssessmentRow initialRow = identityToInitialRow.get(row.getIdentityKey());
Boolean[] checked = initialRow.getChecked();
Boolean[] editedChecked = row.getChecked();
Float[] scores = initialRow.getScores();
Float[] editedScores = row.getScores();
for (int i = 0; i < numOfCheckbox; i++) {
Checkbox box = checkboxList.getList().get(i);
boolean currentValue = getSecureValue(checked, i);
boolean editedValue = getSecureValue(editedChecked, i);
Float currentPoint = getSecureValue(scores, i);
;
Float editedPoint;
if (box.getPoints() != null && box.getPoints().floatValue() > 0f) {
editedPoint = getSecureValue(editedScores, i);
} else {
editedPoint = null;
}
if ((editedValue != currentValue) || ((currentPoint == null && editedPoint != null) || (currentPoint != null && editedPoint == null) || (currentPoint != null && !currentPoint.equals(editedPoint)))) {
Checkbox checkbox = checkboxList.getList().get(i);
String checkboxId = checkbox.getCheckboxId();
batchElements.add(new AssessmentBatch(row.getIdentityKey(), checkboxId, editedPoint, editedValue));
assessedIdentityToUpdate.add(row.getIdentityKey());
}
}
}
checkboxManager.check(courseOres, courseNode.getIdent(), batchElements);
if (assessedIdentityToUpdate.size() > 0) {
DBFactory.getInstance().commit();
ICourse course = CourseFactory.loadCourse(courseOres);
List<Identity> assessedIdentities = securityManager.loadIdentityByKeys(assessedIdentityToUpdate);
for (Identity assessedIdentity : assessedIdentities) {
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
courseNode.updateScoreEvaluation(getIdentity(), assessedUserCourseEnv, assessedIdentity, Role.coach);
}
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class GroupAssessmentController method applyChangesForTheWholeGroup.
private void applyChangesForTheWholeGroup(List<AssessmentRow> rows, boolean setAsDone, boolean userVisible) {
ICourse course = CourseFactory.loadCourse(courseEntry);
Float score = null;
if (withScore) {
String scoreValue = groupScoreEl.getValue();
if (StringHelper.containsNonWhitespace(scoreValue)) {
score = Float.parseFloat(scoreValue);
}
}
Boolean passed = null;
if (withPassed) {
if (cutValue == null) {
passed = groupPassedEl.isSelected(0);
} else if (score != null) {
passed = (score.floatValue() >= cutValue.floatValue()) ? Boolean.TRUE : Boolean.FALSE;
}
}
for (AssessmentRow row : rows) {
UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
ScoreEvaluation newScoreEval;
if (setAsDone) {
newScoreEval = new ScoreEvaluation(score, passed, AssessmentEntryStatus.done, userVisible, true, null, null, null);
} else {
newScoreEval = new ScoreEvaluation(score, passed, null, userVisible, null, null, null, null);
}
gtaNode.updateUserScoreEvaluation(newScoreEval, userCourseEnv, getIdentity(), false, Role.coach);
}
if (withComment) {
String comment = groupCommentEl.getValue();
if (StringHelper.containsNonWhitespace(comment)) {
for (AssessmentRow row : rows) {
UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
gtaNode.updateUserUserComment(comment, userCourseEnv, getIdentity());
}
}
}
}
use of org.olat.course.run.userview.UserCourseEnvironment in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method syncAssessmentEntry.
private void syncAssessmentEntry(TaskImpl taskImpl, GTACourseNode cNode, Role by) {
if (taskImpl == null || taskImpl.getTaskStatus() == null || cNode == null)
return;
RepositoryEntry courseRepoEntry = taskImpl.getTaskList().getEntry();
AssessmentEntryStatus assessmentStatus = convertToAssessmentEntrystatus(taskImpl, cNode);
if (GTAType.group.name().equals(cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
// update whole group
assessmentService.updateAssessmentEntries(taskImpl.getBusinessGroup(), courseRepoEntry, cNode.getIdent(), null, assessmentStatus);
} else {
Identity assessedIdentity = taskImpl.getIdentity();
assessmentService.updateAssessmentEntry(assessedIdentity, courseRepoEntry, cNode.getIdent(), null, assessmentStatus);
dbInstance.commit();
ICourse course = CourseFactory.loadCourse(courseRepoEntry);
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
cNode.updateLastModifications(userCourseEnv, taskImpl.getIdentity(), by);
}
}
Aggregations