Skip to content
Snippets Groups Projects
Commit aa8140a2 authored by fkiefer's avatar fkiefer
Browse files

OO-2133 quick respond scorm highscore, adjust DB query

parent 34a28188
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,6 @@ import org.olat.course.nodes.MSCourseNode;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.modules.ModuleConfiguration;
import org.olat.modules.assessment.AssessmentEntry;
import org.olat.modules.assessment.model.AssessmentEntryStatus;
import org.olat.user.DisplayPortraitController;
import org.olat.user.UserAvatarMapper;
import org.olat.user.UserManager;
......@@ -131,7 +130,7 @@ public class HighScoreRunController extends FormBasicController{
return;
}
// guests will never see the highscore
if (ureq.getUserSession().getRoles().isGuestOnly()){
if (ureq != null && ureq.getUserSession().getRoles().isGuestOnly()){
viewHighscore = false;
return;
}
......@@ -154,7 +153,7 @@ public class HighScoreRunController extends FormBasicController{
List<AssessmentEntry> assessEntries;
if ("iqtest".equals(courseNode.getType())) {
assessEntries = assessmentManager.getAssessmentEntriesWithStatus(courseNode, AssessmentEntryStatus.done);
assessEntries = assessmentManager.getAssessmentEntriesWithStatus(courseNode, null);
} else {
assessEntries = assessmentManager.getAssessmentEntries(courseNode);
}
......@@ -201,10 +200,13 @@ public class HighScoreRunController extends FormBasicController{
// add as listener to form layout for later dispatchinf of gui prefs changes
this.flc.getFormItemComponent().addListener(this);
// init showConfig from user prefs
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
Boolean showConfig = (Boolean) guiPrefs.get(HighScoreRunController.class, GUIPREF_KEY_HIGHSCORE + nodeID);
if (showConfig == null) {
showConfig = Boolean.TRUE;
Boolean showConfig = Boolean.TRUE;
if (ureq != null) {
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
showConfig = (Boolean) guiPrefs.get(HighScoreRunController.class, GUIPREF_KEY_HIGHSCORE + nodeID);
if (showConfig == null) {
showConfig = Boolean.TRUE;
}
}
// expose initial value to velocity
this.flc.contextPut("showConfig", Boolean.valueOf(showConfig));
......
......@@ -133,12 +133,6 @@ public class ScormRunController extends BasicController implements ScormAPICallb
if(isAssessable) {
assessableType = config.getStringValue(ScormEditController.CONFIG_ASSESSABLE_TYPE,
ScormEditController.CONFIG_ASSESSABLE_TYPE_SCORE);
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, scormNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
startPage.put("highScore", highScoreComponent);
}
}
// <OLATCE-289>
......@@ -156,7 +150,7 @@ public class ScormRunController extends BasicController implements ScormAPICallb
// </OLATCE-289>
main = new Panel("scormrunmain");
doStartPage();
doStartPage(ureq);
putInitialPanel(main);
boolean doSkip = config.getBooleanSafe(ScormEditController.CONFIG_SKIPLAUNCHPAGE, false);
......@@ -205,10 +199,10 @@ public class ScormRunController extends BasicController implements ScormAPICallb
if (maxAttemptsReached()) {
startPage.contextPut("maxAttemptsReached", Boolean.TRUE);
}
doStartPage();
doStartPage(ureq);
} else {
// </OLATCE-289>
doStartPage();
doStartPage(ureq);
fireEvent(ureq, event);
}
} else if (source == null) { // external source
......@@ -223,7 +217,7 @@ public class ScormRunController extends BasicController implements ScormAPICallb
}
}
private void doStartPage() {
private void doStartPage(UserRequest ureq) {
// push title and learning objectives, only visible on intro page
startPage.contextPut("menuTitle", scormNode.getShortTitle());
......@@ -254,6 +248,12 @@ public class ScormRunController extends BasicController implements ScormAPICallb
startPage.contextPut("comment", StringHelper.xssScan(comment));
}
startPage.contextPut("attempts", scormNode.getUserAttempts(userCourseEnv));
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, scormNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
startPage.put("highScore", highScoreComponent);
}
}
startPage.contextPut("isassessable", Boolean.valueOf(isAssessable));
main.setContent(startPage);
......@@ -367,7 +367,7 @@ public class ScormRunController extends BasicController implements ScormAPICallb
*/
public void lmsFinish(String olatSahsId, Properties scoreProp, Properties lessonStatusProp) {
if (config.getBooleanSafe(ScormEditController.CONFIG_CLOSE_ON_FINISH, false)) {
doStartPage();
doStartPage(null);
scormDispC.close();
}
}
......
......@@ -239,7 +239,10 @@ public class AssessmentEntryDAO {
sb.append("select data from assessmententry data ")
.append(" inner join fetch data.identity ident")
.append(" inner join fetch ident.user identuser")
.append(" where data.repositoryEntry.key=:repositoryEntryKey and data.subIdent=:subIdent");
.append(" where data.repositoryEntry.key=:repositoryEntryKey")
.append(" and data.subIdent=:subIdent")
.append(" and data.userVisibility is true")
.append(" and data.score is not null");
if (status != null) {
sb.append(" and data.status=:status");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment