use of org.olat.course.assessment.UserEfficiencyStatement in project openolat by klemens.
the class EfficiencyStatementManager method deleteEfficiencyStatement.
/**
* Delete the given efficiency statement for this person
* @param identity
* @param efficiencyStatement
*/
protected void deleteEfficiencyStatement(Identity identity, EfficiencyStatement efficiencyStatement) {
RepositoryEntryRef ref = new RepositoryEntryRefImpl(efficiencyStatement.getCourseRepoEntryKey());
UserEfficiencyStatement s = getUserEfficiencyStatementLightByRepositoryEntry(ref, identity);
if (s != null) {
dbInstance.getCurrentEntityManager().remove(s);
}
}
use of org.olat.course.assessment.UserEfficiencyStatement in project openolat by klemens.
the class GetScoreWithCourseIdFunction method call.
/**
* @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[])
*/
public Object call(Object[] inStack) {
if (inStack.length > 2) {
// need > 2 for compatibility reason
return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs", "solution.provideone.nodereference"));
} else if (inStack.length < 1) {
return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "", "error.moreargs", "solution.provideone.nodereference"));
}
Long courseRepoEntryKey;
try {
courseRepoEntryKey = Long.decode((String) inStack[0]);
} catch (NumberFormatException nfe) {
return handleException(new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "", "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
}
// no integrity check can be done - other course might not exist anymore
CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
if (cev != null) {
return defaultValue();
}
// the real function evaluation which is used during run time
EfficiencyStatementManager esm = CoreSpringFactory.getImpl(EfficiencyStatementManager.class);
RepositoryEntryRef courseRef = new RepositoryEntryRefImpl(courseRepoEntryKey);
UserEfficiencyStatement es = esm.getUserEfficiencyStatementLightByRepositoryEntry(courseRef, getUserCourseEnv().getIdentityEnvironment().getIdentity());
if (es == null)
return defaultValue();
Float score = es.getScore();
if (score == null)
return defaultValue();
// finally check existing value
return new Double(score.doubleValue());
}
use of org.olat.course.assessment.UserEfficiencyStatement in project openolat by klemens.
the class UserDetailsController method doOpenEfficiencyStatementController.
private CertificateAndEfficiencyStatementController doOpenEfficiencyStatementController(UserRequest ureq) {
if (statementCtrl == null || hasChanged) {
removeAsListenerAndDispose(statementCtrl);
RepositoryEntry entry = statementEntry.getCourse();
UserEfficiencyStatement statement = statementEntry.getUserEfficencyStatement();
EfficiencyStatement efficiencyStatement = null;
if (statement != null) {
RepositoryEntry re = statementEntry.getCourse();
efficiencyStatement = efficiencyStatementManager.getUserEfficiencyStatementByCourseRepositoryEntry(re, assessedIdentity);
}
statementCtrl = new CertificateAndEfficiencyStatementController(getWindowControl(), ureq, assessedIdentity, null, entry.getOlatResource().getKey(), entry, efficiencyStatement, true);
listenTo(statementCtrl);
hasChanged = false;
}
mainVC.put("segmentCmp", statementCtrl.getInitialComponent());
segmentView.select(efficiencyStatementLink);
return statementCtrl;
}
use of org.olat.course.assessment.UserEfficiencyStatement in project openolat by klemens.
the class CoachingServiceImpl method getEfficencyStatements.
@Override
public List<EfficiencyStatementEntry> getEfficencyStatements(Identity student, List<RepositoryEntry> courses, List<UserPropertyHandler> userPropertyHandlers, Locale locale) {
List<UserEfficiencyStatement> statements = efficiencyStatementManager.getUserEfficiencyStatementLight(student, courses);
Map<Long, UserEfficiencyStatement> courseKeyToStatements = new HashMap<>();
for (UserEfficiencyStatement statement : statements) {
courseKeyToStatements.put(statement.getCourseRepoKey(), statement);
}
List<EfficiencyStatementEntry> entries = new ArrayList<>(courses.size());
for (RepositoryEntry course : courses) {
UserEfficiencyStatement statement = courseKeyToStatements.get(course.getKey());
entries.add(new EfficiencyStatementEntry(student, course, statement, userPropertyHandlers, locale));
}
return entries;
}
Aggregations