Skip to content
Snippets Groups Projects
Commit 41e1877e authored by srosse's avatar srosse
Browse files

Merge remote-tracking branch 'origin/OpenOLAT_14.1'

parents 6dd623b3 57daf142
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,7 @@
<apache.log4j>2.12.1</apache.log4j>
<io.jsonwebtoken>0.10.7</io.jsonwebtoken>
<io.undertow>2.0.27.Final</io.undertow>
<!-- Override data-bind -->
<jackson.version>2.9.10</jackson.version>
<org.mysql.version>5.1.46</org.mysql.version>
<org.postgresql.version>42.2.8</org.postgresql.version>
......@@ -2239,7 +2240,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}.1</version>
<version>2.9.10.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
......
......@@ -155,12 +155,12 @@ public class AssessmentToolManagerImpl implements AssessmentToolManager {
public List<AssessedBusinessGroup> getBusinessGroupStatistics(Identity coach, SearchAssessedIdentityParams params) {
RepositoryEntry courseEntry = params.getEntry();
StringBuilder sf = new StringBuilder();
QueryBuilder sf = new QueryBuilder();
sf.append("select bgi.key, bgi.name, baseGroup.key,")
.append(" avg(aentry.score) as scoreAverage,")
.append(" sum(case when aentry.score is not null then 1 else 0 end) as numOfScore,")
.append(" sum(case when aentry.passed=true then 1 else 0 end) as numOfPassed,")
.append(" sum(case when aentry.passed=false then 1 else 0 end) as numOfFailed,")
.append(" sum(case when (aentry.status is null or not(aentry.status='").append(AssessmentEntryStatus.notStarted.name()).append("') or aentry.passed is null) then 1 else 0 end) as numOfNotAttempted,")
.append(" (select count(gmember.key) from bgroupmember as gmember")
.append(" where gmember.group.key=baseGroup.key and gmember.role='").append(GroupRoles.participant.name()).append("'")
.append(" ) as numOfParticipants")
......@@ -170,18 +170,14 @@ public class AssessmentToolManagerImpl implements AssessmentToolManager {
.append(" left join baseGroup.members as bmember on (bmember.role='").append(GroupRoles.participant.name()).append("')")
.append(" left join assessmententry as aentry on (bmember.identity.key=aentry.identity.key and rel.entry.key = aentry.repositoryEntry.key)");
boolean where = false;
if(!params.isAdmin()) {
where = PersistenceHelper.appendAnd(sf, where);
sf.append(" bgi.key in (:groupKeys)");
sf.and().append(" bgi.key in (:groupKeys)");
}
if(params.getSubIdent() != null) {
where = PersistenceHelper.appendAnd(sf, where);
sf.append(" aentry.subIdent=:subIdent");
sf.and().append(" aentry.subIdent=:subIdent");
}
if(params.getReferenceEntry() != null) {
where = PersistenceHelper.appendAnd(sf, where);
sf.append(" aentry.referenceEntry.key=:referenceKey");
sf.and().append(" aentry.referenceEntry.key=:referenceKey");
}
sf.append(" group by bgi.key, bgi.name, baseGroup.key");
......@@ -200,18 +196,17 @@ public class AssessmentToolManagerImpl implements AssessmentToolManager {
List<Object[]> results = stats.getResultList();
List<AssessedBusinessGroup> rows = new ArrayList<>(results.size());
for(Object[] result:results) {
Long key = (Long)result[0];
String name = (String)result[1];
double averageScore = result[3] == null ? 0.0d : ((Number)result[3]).doubleValue();
int numOfPassed = result[4] == null ? 0 : ((Number)result[4]).intValue();
int numOfFailed = result[5] == null ? 0 : ((Number)result[5]).intValue();
int numOfNotAttempted = result[6] == null ? 0 : ((Number)result[6]).intValue();
int numOfScores = result[4] == null ? 0 : ((Number)result[4]).intValue();
int numOfPassed = result[5] == null ? 0 : ((Number)result[5]).intValue();
int numOfFailed = result[6] == null ? 0 : ((Number)result[6]).intValue();
int numOfParticipants = result[7] == null ? 0 : ((Number)result[7]).intValue();
rows.add(new AssessedBusinessGroup(key, name, averageScore,
numOfPassed, numOfFailed, numOfNotAttempted,
numOfParticipants));
rows.add(new AssessedBusinessGroup(key, name, averageScore, numOfScores > 0,
numOfPassed, numOfFailed, numOfParticipants));
}
return rows;
}
......
......@@ -35,18 +35,17 @@ public class AssessedBusinessGroup implements BusinessGroupRef {
private int numOfParticipants;
private int numOfPassed;
private int numOfFailed;
private int numOfNotAttempted;
private double averageScore;
private boolean hasScore;
public AssessedBusinessGroup(Long key, String name, double averageScore,
int numOfPassed, int numOfFailed, int numOfNotAttempted,
int numOfParticipants) {
public AssessedBusinessGroup(Long key, String name, double averageScore, boolean hasScore,
int numOfPassed, int numOfFailed, int numOfParticipants) {
this.key = key;
this.name = name;
this.hasScore = hasScore;
this.averageScore = averageScore;
this.numOfPassed = numOfPassed;
this.numOfFailed = numOfFailed;
this.numOfNotAttempted = numOfNotAttempted;
this.numOfParticipants = numOfParticipants;
}
......@@ -75,8 +74,8 @@ public class AssessedBusinessGroup implements BusinessGroupRef {
public int getNumOfFailed() {
return numOfFailed;
}
public int getNumOfNotAttempted() {
return numOfNotAttempted;
public boolean isHasScore() {
return hasScore;
}
}
......@@ -175,7 +175,7 @@ public class AssessedBusinessGroupCourseNodeListController extends FormBasicCont
for(BusinessGroup group:groups) {
if(!keys.contains(group.getKey())) {
rows.add(new AssessedBusinessGroup(group.getKey(), group.getName(), 0.0d, 0, 0, 0, 0));
rows.add(new AssessedBusinessGroup(group.getKey(), group.getName(), 0.0d, false, 0, 0, 0));
}
}
......
......@@ -73,17 +73,9 @@ implements SortableFlexiTableDataModel<AssessedBusinessGroup> {
val.setGreen(row.getNumOfPassed());
return val;
}
case averageScore: {
if(row.getNumOfParticipants() == row.getNumOfNotAttempted()) {
return null;
}
if(row.getAverageScore() == 0.0) {
return null;
}
return row.getAverageScore();
}
case averageScore: return row.isHasScore() ? row.getAverageScore() : null;
default: return "ERROR";
}
return null;
}
@Override
......
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