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

OO-2133 define assessment members, modify condition when to show, split position view

parent b598c848
No related branches found
No related tags found
No related merge requests found
Showing
with 95 additions and 21 deletions
...@@ -206,8 +206,11 @@ public interface AssessmentManager { ...@@ -206,8 +206,11 @@ public interface AssessmentManager {
public List<AssessmentEntry> getAssessmentEntries(CourseNode courseNode); public List<AssessmentEntry> getAssessmentEntries(CourseNode courseNode);
public List<AssessmentEntry> getAssessmentEntriesWithStatus(CourseNode courseNode, String status);
public List<AssessmentEntry> getAssessmentEntries(BusinessGroup group, CourseNode courseNode); public List<AssessmentEntry> getAssessmentEntries(BusinessGroup group, CourseNode courseNode);
public List<AssessmentEntry> getAssessmentEntries(Identity assessedIdentity); public List<AssessmentEntry> getAssessmentEntries(Identity assessedIdentity);
} }
\ No newline at end of file
...@@ -93,6 +93,11 @@ public class CourseAssessmentManagerImpl implements AssessmentManager { ...@@ -93,6 +93,11 @@ public class CourseAssessmentManagerImpl implements AssessmentManager {
public List<AssessmentEntry> getAssessmentEntries(CourseNode courseNode) { public List<AssessmentEntry> getAssessmentEntries(CourseNode courseNode) {
return assessmentService.loadAssessmentEntriesBySubIdent(cgm.getCourseEntry(), courseNode.getIdent()); return assessmentService.loadAssessmentEntriesBySubIdent(cgm.getCourseEntry(), courseNode.getIdent());
} }
@Override
public List<AssessmentEntry> getAssessmentEntriesWithStatus(CourseNode courseNode, String status) {
return assessmentService.loadAssessmentEntriesBySubIdentWithStatus(cgm.getCourseEntry(), courseNode.getIdent(), status);
}
@Override @Override
public AssessmentEntry getAssessmentEntry(CourseNode courseNode, Identity assessedIdentity) { public AssessmentEntry getAssessmentEntry(CourseNode courseNode, Identity assessedIdentity) {
......
...@@ -66,6 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -66,6 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class HighScoreRunController extends FormBasicController{ public class HighScoreRunController extends FormBasicController{
private static final String GUIPREF_KEY_HIGHSCORE = "highscore"; private static final String GUIPREF_KEY_HIGHSCORE = "highscore";
private static final String STATUS_DONE = "done";
private FlexiTableDataModel<HighScoreTableEntry> tableDataModel, tableDataModel2; private FlexiTableDataModel<HighScoreTableEntry> tableDataModel, tableDataModel2;
private List<HighScoreTableEntry> allMembers, ownIdMembers; private List<HighScoreTableEntry> allMembers, ownIdMembers;
...@@ -130,8 +131,14 @@ public class HighScoreRunController extends FormBasicController{ ...@@ -130,8 +131,14 @@ public class HighScoreRunController extends FormBasicController{
return; return;
} }
List<AssessmentEntry> assessEntries = userCourseEnv.getCourseEnvironment() List<AssessmentEntry> assessEntries;
.getAssessmentManager().getAssessmentEntries(courseNode); if ("iqtest".equals(courseNode.getType())) {
assessEntries = userCourseEnv.getCourseEnvironment().getAssessmentManager()
.getAssessmentEntriesWithStatus(courseNode, STATUS_DONE);
} else {
assessEntries = userCourseEnv.getCourseEnvironment().getAssessmentManager()
.getAssessmentEntries(courseNode);
}
// display only if has content // display only if has content
if (assessEntries.isEmpty()) { if (assessEntries.isEmpty()) {
viewHighscore = false; viewHighscore = false;
...@@ -327,9 +334,14 @@ public class HighScoreRunController extends FormBasicController{ ...@@ -327,9 +334,14 @@ public class HighScoreRunController extends FormBasicController{
} }
} }
if (viewPosition && ownIdIndices.size() > 0) { if (viewPosition && ownIdIndices.size() > 0) {
mainVC.contextPut("position", translate("highscore.position.info", int amountWorse = allScores.length - ownIdIndices.get(0) - 1;
new String[] { String.valueOf(highscoreDataModel.getOwnTableEntry().getRank()), if (amountWorse > 0) {
String.valueOf(allScores.length - ownIdIndices.get(0) - 1)})); mainVC.contextPut("relposition", translate("highscore.position.second",
new String[] { String.valueOf(amountWorse)}));
}
int ownRank = highscoreDataModel.getOwnTableEntry().getRank();
mainVC.contextPut("position", translate("highscore.position.first",
new String[] { String.valueOf(ownRank) }));
} }
} }
......
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
<div class="container-fluid o_highscore"> <div class="container-fluid o_highscore">
<div class="row clearfix"> <div class="row clearfix">
#if ($position) #if ($position)
<div class="o_position">$position</div> <div class="o_position">$position
#if($relposition)
<div class="o_position_relative">$relposition</div>
#end
</div>
#end #end
#if ($first) #if ($first)
<div class="col-sm-6 o_podium"> <div class="col-sm-6 o_podium">
......
...@@ -12,7 +12,8 @@ highscore.description=Erstellen Sie eine HighScore f\u00FCr diesen Kursbaustein. ...@@ -12,7 +12,8 @@ highscore.description=Erstellen Sie eine HighScore f\u00FCr diesen Kursbaustein.
controller.title=Einstellungen der HighScore des Kursbausteins controller.title=Einstellungen der HighScore des Kursbausteins
pane.tab.highscore=HighScore pane.tab.highscore=HighScore
highscore.position=Positionsanzeige highscore.position=Positionsanzeige
highscore.position.info=Herzlichen Gl\u00FCckwunsch, du bist {0}.! {1} sind schlechter als du! highscore.position.first=Herzlichen Gl\u00FCckwunsch, du bist {0}.!
highscore.position.second= {0} sind schlechter als du!
highscore.podium=Siegertreppchen highscore.podium=Siegertreppchen
highscore.histogram=Histogramm highscore.histogram=Histogramm
highscore.listing=Auflistung highscore.listing=Auflistung
......
...@@ -11,7 +11,8 @@ highscore.description=Create a HighScore for this Course Element. Define whether ...@@ -11,7 +11,8 @@ highscore.description=Create a HighScore for this Course Element. Define whether
controller.title=HighScore Settings of your Course Element controller.title=HighScore Settings of your Course Element
pane.tab.highscore=HighScore pane.tab.highscore=HighScore
highscore.position=Display position highscore.position=Display position
highscore.position.info=Congratulations you are {0}.! {1} are worse than you! highscore.position.first=Congratulations you are {0}.!
highscore.position.second={0} are worse than you!
highscore.podium=Podium highscore.podium=Podium
highscore.histogram=Histogram highscore.histogram=Histogram
highscore.listing=Listing highscore.listing=Listing
......
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
</div> </div>
#end #end
#end #end
<div class="o_button_group">
$r.render("start")
</div>
#if ($r.available("highScore")) #if ($r.available("highScore"))
$r.render("highScore") $r.render("highScore")
#end #end
\ No newline at end of file <div class="o_button_group">
$r.render("start")
</div>
\ No newline at end of file
...@@ -71,9 +71,6 @@ ...@@ -71,9 +71,6 @@
/* ]]> */ /* ]]> */
</script> </script>
#end #end
#if ($r.available("highScore"))
$r.render("highScore")
#end
#else #else
<div class="o_no_scoreinfo"> <div class="o_no_scoreinfo">
$r.translate("score.noscoreinfoyet") $r.translate("score.noscoreinfoyet")
...@@ -89,6 +86,9 @@ ...@@ -89,6 +86,9 @@
#end #end
#end #end
#if ($r.available("highScore"))
$r.render("highScore")
#end
#if($showResultsOnHomePage && $attempts > 0) #if($showResultsOnHomePage && $attempts > 0)
<div class="panel panel-default o_results"> <div class="panel panel-default o_results">
<div class="panel-heading"> <div class="panel-heading">
......
...@@ -65,9 +65,6 @@ ...@@ -65,9 +65,6 @@
/* ]]> */ /* ]]> */
</script> </script>
#end #end
#if ($r.available("highScore"))
$r.render("highScore")
#end
#else #else
<div class="o_no_scoreinfo"> <div class="o_no_scoreinfo">
$r.translate("score.noscoreinfoyet") $r.translate("score.noscoreinfoyet")
...@@ -82,6 +79,9 @@ ...@@ -82,6 +79,9 @@
</div> </div>
#end #end
#end #end
#if ($r.available("highScore"))
$r.render("highScore")
#end
#if($showResultsOnHomePage && $attempts >0) #if($showResultsOnHomePage && $attempts >0)
<div class="panel panel-default o_results"> <div class="panel panel-default o_results">
......
...@@ -55,15 +55,15 @@ ...@@ -55,15 +55,15 @@
/* ]]> */ /* ]]> */
</script> </script>
#end #end
#if ($r.available("highScore"))
$r.render("highScore")
#end
#else #else
<div class="o_no_scoreinfo"> <div class="o_no_scoreinfo">
$r.translate("score.noscoreinfoyet") $r.translate("score.noscoreinfoyet")
</div> </div>
#end #end
#end #end
#if ($r.available("highScore"))
$r.render("highScore")
#end
#if ($maxAttemptsReached) #if ($maxAttemptsReached)
<div class="o_warning"> <div class="o_warning">
......
...@@ -66,6 +66,11 @@ final class PreviewAssessmentManager extends BasicManager implements AssessmentM ...@@ -66,6 +66,11 @@ final class PreviewAssessmentManager extends BasicManager implements AssessmentM
public List<AssessmentEntry> getAssessmentEntries(CourseNode courseNode) { public List<AssessmentEntry> getAssessmentEntries(CourseNode courseNode) {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public List<AssessmentEntry> getAssessmentEntriesWithStatus(CourseNode courseNode, String status) {
return Collections.emptyList();
}
@Override @Override
public AssessmentEntry getAssessmentEntry(CourseNode courseNode, Identity assessedIdentity) { public AssessmentEntry getAssessmentEntry(CourseNode courseNode, Identity assessedIdentity) {
......
...@@ -84,6 +84,8 @@ public interface AssessmentService { ...@@ -84,6 +84,8 @@ public interface AssessmentService {
public List<AssessmentEntry> loadAssessmentEntriesBySubIdent(RepositoryEntry entry, String subIdent); public List<AssessmentEntry> loadAssessmentEntriesBySubIdent(RepositoryEntry entry, String subIdent);
public List<AssessmentEntry> loadAssessmentEntriesBySubIdentWithStatus(RepositoryEntry entry, String subIdent, String status);
public List<AssessmentEntry> loadAssessmentEntriesByAssessedIdentity(Identity assessedIdentity, RepositoryEntry entry); public List<AssessmentEntry> loadAssessmentEntriesByAssessedIdentity(Identity assessedIdentity, RepositoryEntry entry);
public List<AssessmentEntry> loadAssessmentEntries(BusinessGroup assessedGroup, RepositoryEntry entry, String subIdent); public List<AssessmentEntry> loadAssessmentEntries(BusinessGroup assessedGroup, RepositoryEntry entry, String subIdent);
......
...@@ -222,6 +222,39 @@ public class AssessmentEntryDAO { ...@@ -222,6 +222,39 @@ public class AssessmentEntryDAO {
.getResultList(); .getResultList();
} }
/**
* Load all assessment entries for the specific assessed repository entry with
* the specific sub identifier (it is mandatory). The anonym users are excluded
* by the query. The status of the assessment entry is optional
*
* @param entry The entry (mandatory)
* @param subIdent The subIdent (mandatory)
* @param status The status of the assessment entry (optional)
* @return A list of assessment entries
*/
public List<AssessmentEntry> loadAssessmentEntryBySubIdentWithStatus(RepositoryEntryRef entry, String subIdent, String status) {
StringBuilder sb = new StringBuilder();
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");
if (status != null) {
sb.append(" and data.status=:status");
}
TypedQuery<AssessmentEntry> typedQuery = dbInstance.getCurrentEntityManager()
.createQuery(sb.toString(), AssessmentEntry.class)
.setParameter("repositoryEntryKey", entry.getKey())
.setParameter("subIdent", subIdent);
if (status != null) {
typedQuery.setParameter("status", status);
}
return typedQuery.getResultList();
}
public List<Identity> getAllIdentitiesWithAssessmentData(RepositoryEntryRef entry) { public List<Identity> getAllIdentitiesWithAssessmentData(RepositoryEntryRef entry) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("select distinct data.identity from assessmententry data where data.repositoryEntry.key=:repositoryEntryKey"); sb.append("select distinct data.identity from assessmententry data where data.repositoryEntry.key=:repositoryEntryKey");
......
...@@ -88,6 +88,11 @@ public class AssessmentServiceImpl implements AssessmentService, UserDataDeletab ...@@ -88,6 +88,11 @@ public class AssessmentServiceImpl implements AssessmentService, UserDataDeletab
public List<AssessmentEntry> loadAssessmentEntriesBySubIdent(RepositoryEntry entry, String subIdent) { public List<AssessmentEntry> loadAssessmentEntriesBySubIdent(RepositoryEntry entry, String subIdent) {
return assessmentEntryDao.loadAssessmentEntryBySubIdent(entry, subIdent); return assessmentEntryDao.loadAssessmentEntryBySubIdent(entry, subIdent);
} }
@Override
public List<AssessmentEntry> loadAssessmentEntriesBySubIdentWithStatus(RepositoryEntry entry, String subIdent, String status) {
return assessmentEntryDao.loadAssessmentEntryBySubIdentWithStatus(entry, subIdent, status);
}
@Override @Override
public List<AssessmentEntry> loadAssessmentEntriesByAssessedIdentity(Identity assessedIdentity, RepositoryEntry entry) { public List<AssessmentEntry> loadAssessmentEntriesByAssessedIdentity(Identity assessedIdentity, RepositoryEntry entry) {
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
border-style: ridge; border-style: ridge;
border-width: 3px; border-width: 3px;
border-color: $o-hs-podium-first-bg ; border-color: $o-hs-podium-first-bg ;
.o_position_relative {
}
} }
.o_podium { .o_podium {
......
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