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

OO-1408: improve performance with native SQL queries, add all queries needed...

OO-1408: improve performance with native SQL queries, add all queries needed for authors to see their courses and the groups linked to their courses
parent a7e79cfa
No related branches found
No related tags found
No related merge requests found
Showing
with 1157 additions and 889 deletions
......@@ -36,6 +36,12 @@ import org.olat.core.id.Persistable;
public interface DB {
public boolean isMySQL();
public boolean isPostgreSQL();
public boolean isOracle();
/**
* Close the database session.
*/
......
......@@ -87,7 +87,22 @@ public class DBImpl extends LogDelegator implements DB, Destroyable {
protected static DBImpl getInstance() {
return INSTANCE;
}
@Override
public boolean isMySQL() {
return "mysql".equals(dbVendor);
}
@Override
public boolean isPostgreSQL() {
return "postgresql".equals(dbVendor);
}
@Override
public boolean isOracle() {
return "oracle".equals(dbVendor);
}
@Override
public String getDbVendor() {
return dbVendor;
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.core.commons.persistence;
/**
* Provide some help to build native SQL queries for Oracle, MySQL and PostreSQL.
*
* Initial date: 02.02.2015<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class NativeQueryBuilder {
private final StringBuilder sb;
private final DB dbInstance;
/**
* @param len
*/
public NativeQueryBuilder(int len, DB dbInstance) {
sb = new StringBuilder(len);
this.dbInstance = dbInstance;
}
/**
*
*/
public NativeQueryBuilder(DB dbInstance) {
sb = new StringBuilder(128);
this.dbInstance = dbInstance;
}
/**
* @param val
* @return Itself
*/
public NativeQueryBuilder append(String val) {
sb.append(val);
return this;
}
/**
*
* @param val The value to append
* @param append If true append happens, if false not
* @return Itself
*/
public NativeQueryBuilder append(String val, boolean append) {
if(append) {
sb.append(val);
}
return this;
}
public NativeQueryBuilder append(String valTrue, String valFalse, boolean choice) {
if(choice) {
sb.append(valTrue);
} else {
sb.append(valFalse);
}
return this;
}
/**
* Append true as boolean for PostgreSQL, 1 for Oracle and MySQL.
* @return
*/
public NativeQueryBuilder appendTrue() {
if(dbInstance.isPostgreSQL()) {
sb.append("true");
} else {
sb.append("1");
}
return this;
}
/**
* Append false as boolean for PostgreSQL, 0 for Oracle and MySQL.
* @return
*/
public NativeQueryBuilder appendFalse() {
if(dbInstance.isPostgreSQL()) {
sb.append("false");
} else {
sb.append("0");
}
return this;
}
/**
* Append an "as" for MySQL and PostgreSQL but not Oracle.
* @return
*/
public NativeQueryBuilder appendAs() {
if(dbInstance.isOracle()) {
sb.append(" ");
} else {
sb.append(" as ");
}
return this;
}
public NativeQueryBuilder appendToArray(String var) {
if(dbInstance.isMySQL()) {
sb.append(" group_concat(").append(var).append(")");
} else if(dbInstance.isPostgreSQL()) {
sb.append(" array_to_string(array_agg(").append(var).append("),',')");
} else if(dbInstance.isOracle()) {
sb.append(" listagg(").append(var).append(",',')");
}
return this;
}
/**
* @param i
* @return Itself
*/
public NativeQueryBuilder append(int i) {
sb.append(i);
return this;
}
/**
* @param sMin
* @return Itself
*/
public NativeQueryBuilder append(long sMin) {
sb.append(String.valueOf(sMin));
return this;
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return sb.toString();
}
}
......@@ -127,10 +127,6 @@
<class>org.olat.instantMessaging.model.InstantMessageNotificationImpl</class>
<class>org.olat.ims.qti.statistics.model.QTIStatisticResult</class>
<class>org.olat.ims.qti.statistics.model.QTIStatisticResultSet</class>
<class>org.olat.modules.coach.model.EfficiencyStatementGroupStatEntry</class>
<class>org.olat.modules.coach.model.EfficiencyStatementCourseStatEntry</class>
<class>org.olat.modules.coach.model.EfficiencyStatementStudentStatEntry</class>
<class>org.olat.modules.coach.model.EfficiencyStatementIdentityStatEntry</class>
<class>org.olat.modules.qpool.model.PoolImpl</class>
<class>org.olat.modules.qpool.model.PoolToItem</class>
<class>org.olat.modules.qpool.model.PoolItemShortView</class>
......
......@@ -556,11 +556,10 @@ public class CourseFactory extends BasicManager {
true, Locale.ENGLISH, exportedCourseZIPFile, exportedCourseZIPFile.getName());
re.setSoftkey(softKey);
re.setAccess(access);
repositoryService.update(re);
ICourse course = CourseFactory.loadCourse(re.getOlatResource());
CourseFactory.publishCourse(course, RepositoryEntry.ACC_USERS, false, null, Locale.ENGLISH);
CourseFactory.publishCourse(course, access, false, null, Locale.ENGLISH);
return re;
}
......
......@@ -35,7 +35,8 @@ import org.olat.core.commons.persistence.DB;
import org.olat.core.commons.persistence.PersistenceHelper;
import org.olat.core.id.Identity;
import org.olat.core.id.OLATResourceable;
import org.olat.core.manager.BasicManager;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.coordinate.CoordinatorManager;
import org.olat.core.util.coordinate.SyncerExecutor;
import org.olat.core.util.resource.OresHelper;
......@@ -54,7 +55,9 @@ import org.springframework.stereotype.Service;
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*/
@Service("userCourseInformationsManager")
public class UserCourseInformationsManagerImpl extends BasicManager implements UserCourseInformationsManager {
public class UserCourseInformationsManagerImpl implements UserCourseInformationsManager {
private static final OLog log = Tracing.createLoggerFor(UserCourseInformationsManagerImpl.class);
@Autowired
private DB dbInstance;
......@@ -81,7 +84,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
}
return infoList.get(0);
} catch (Exception e) {
logError("Cannot retrieve course informations for: " + identity + " from " + identity, e);
log.error("Cannot retrieve course informations for: " + identity + " from " + identity, e);
return null;
}
}
......@@ -108,7 +111,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
List<UserCourseInformations> infoList = query.getResultList();
return infoList;
} catch (Exception e) {
logError("Cannot retrieve course informations for: " + identity + " from " + identity, e);
log.error("Cannot retrieve course informations for: " + identity + " from " + identity, e);
return null;
}
}
......@@ -167,7 +170,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
}
}
} catch (Exception e) {
logError("Cannot update course informations for: " + identity + " from " + identity, e);
log.error("Cannot update course informations for: " + identity + " from " + identity, e);
}
}
});
......@@ -196,7 +199,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
}
return infoList.get(0);
} catch (Exception e) {
logError("Cannot retrieve course informations for: " + id, e);
log.error("Cannot retrieve course informations for: " + id, e);
return null;
}
}
......@@ -222,7 +225,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
return new UltraLightInfos((Long)infos[0], (Date)infos[1]);
} catch (Exception e) {
logError("Cannot retrieve course informations for: " + identity + " from " + identity, e);
log.error("Cannot retrieve course informations for: " + identity + " from " + identity, e);
return null;
}
}
......@@ -284,7 +287,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
}
return infoList.get(0);
} catch (Exception e) {
logError("Cannot retrieve course informations for: " + courseResourceId, e);
log.error("Cannot retrieve course informations for: " + courseResourceId, e);
return null;
}
}
......@@ -331,7 +334,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
}
return dateMap;
} catch (Exception e) {
logError("Cannot retrieve course informations for: " + courseResourceId, e);
log.error("Cannot retrieve course informations for: " + courseResourceId, e);
return Collections.emptyMap();
}
}
......@@ -350,7 +353,7 @@ public class UserCourseInformationsManagerImpl extends BasicManager implements U
.executeUpdate();
return count;
} catch (Exception e) {
logError("Cannot Delete course informations for: " + entry, e);
log.error("Cannot Delete course informations for: " + entry, e);
return -1;
}
}
......
......@@ -19,17 +19,15 @@
*/
package org.olat.modules.coach;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.olat.basesecurity.IdentityRef;
import org.olat.core.id.Identity;
import org.olat.course.assessment.UserEfficiencyStatement;
import org.olat.group.BusinessGroup;
import org.olat.modules.coach.model.CourseStatEntry;
import org.olat.modules.coach.model.EfficiencyStatementEntry;
import org.olat.modules.coach.model.GroupStatEntry;
import org.olat.modules.coach.model.SearchCoachedIdentityParams;
import org.olat.modules.coach.model.StudentStatEntry;
import org.olat.repository.RepositoryEntry;
......@@ -44,16 +42,15 @@ public interface CoachingService {
public boolean isCoach(Identity coach);
public Map<Long, String> getIdentities(Collection<Long> identityNames);
public List<RepositoryEntry> getStudentsCourses(Identity coach, Identity student, int firstResult, int maxResults);
public List<RepositoryEntry> getStudentsCourses(Identity coach, Identity student);
public List<StudentStatEntry> getStudentsStatistics(Identity coach);
public List<StudentStatEntry> getUsersStatistics(List<? extends IdentityRef> identities);
public List<StudentStatEntry> getUsersStatistics(SearchCoachedIdentityParams params);
public List<RepositoryEntry> getUserCourses(Identity student, int firstResult, int maxResults);
public List<RepositoryEntry> getUserCourses(Identity student);
public List<CourseStatEntry> getCoursesStatistics(Identity coach);
......
......@@ -19,15 +19,11 @@
*/
package org.olat.modules.coach.manager;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.olat.basesecurity.BaseSecurity;
import org.olat.basesecurity.GroupRoles;
import org.olat.basesecurity.IdentityRef;
import org.olat.basesecurity.IdentityShort;
import org.olat.core.id.Identity;
import org.olat.course.assessment.UserEfficiencyStatement;
......@@ -37,6 +33,7 @@ import org.olat.modules.coach.CoachingService;
import org.olat.modules.coach.model.CourseStatEntry;
import org.olat.modules.coach.model.EfficiencyStatementEntry;
import org.olat.modules.coach.model.GroupStatEntry;
import org.olat.modules.coach.model.SearchCoachedIdentityParams;
import org.olat.modules.coach.model.StudentStatEntry;
import org.olat.repository.RepositoryEntry;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -68,47 +65,33 @@ public class CoachingServiceImpl implements CoachingService {
}
@Override
public Map<Long, String> getIdentities(Collection<Long> identityNames) {
Map<Long,String> identityMap = new HashMap<Long,String>();
List<IdentityShort> identities = securityManager.findShortIdentitiesByKey(identityNames);
for(IdentityShort identity:identities) {
String fullName = identity.getFirstName() + " " + identity.getLastName();
identityMap.put(identity.getKey(), fullName);
}
return identityMap;
public List<RepositoryEntry> getStudentsCourses(Identity coach, Identity student) {
return coachingDao.getStudentsCourses(coach, student);
}
@Override
public List<RepositoryEntry> getStudentsCourses(Identity coach, Identity student, int firstResult, int maxResults) {
return coachingDao.getStudentsCourses(coach, student, firstResult, maxResults);
public List<StudentStatEntry> getUsersStatistics(SearchCoachedIdentityParams params) {
return coachingDao.getUsersStatisticsNative(params);
}
@Override
public List<StudentStatEntry> getStudentsStatistics(Identity coach) {
return coachingDao.getStudentsStatistics(coach);
}
@Override
public List<StudentStatEntry> getUsersStatistics(List<? extends IdentityRef> identities) {
return coachingDao.getUsersStatistics(identities);
return coachingDao.getStudentsStatisticsNative(coach);
}
@Override
public List<RepositoryEntry> getUserCourses(Identity student, int firstResult, int maxResults) {
return coachingDao.getUserCourses(student, firstResult, maxResults);
public List<RepositoryEntry> getUserCourses(Identity student) {
return coachingDao.getUserCourses(student);
}
@Override
public List<CourseStatEntry> getCoursesStatistics(Identity coach) {
return coachingDao.getCoursesStatistics(coach);
return coachingDao.getCoursesStatisticsNative(coach);
}
@Override
public List<GroupStatEntry> getGroupsStatistics(Identity coach) {
return coachingDao.getGroupsStatistics(coach);
return coachingDao.getGroupsStatisticsNative(coach);
}
@Override
......
......@@ -30,13 +30,31 @@ public class CourseStatEntry {
private Long repoKey;
private String repoDisplayName;
private int countStudents;
private int countDistinctStudents;
private int countPassed;
private int countFailed;
private int countNotAttempted;
private Float averageScore;
private int initialLaunch;
private double totalScore;
private int totalScoredStudents;
public double getTotalScore() {
return totalScore;
}
public void setTotalScore(double totalScore) {
this.totalScore = totalScore;
}
public int getTotalScoredStudents() {
return totalScoredStudents;
}
public void setTotalScoredStudents(int totalScoredStudents) {
this.totalScoredStudents = totalScoredStudents;
}
public Long getRepoKey() {
return repoKey;
}
......@@ -60,14 +78,6 @@ public class CourseStatEntry {
public void setCountStudents(int countStudents) {
this.countStudents = countStudents;
}
public int getCountDistinctStudents() {
return countDistinctStudents;
}
public void setCountDistinctStudents(int countDistinctStudents) {
this.countDistinctStudents = countDistinctStudents;
}
public int getCountPassed() {
return countPassed;
......@@ -108,23 +118,4 @@ public class CourseStatEntry {
public void setInitialLaunch(int initialLaunch) {
this.initialLaunch = initialLaunch;
}
public void add(CourseStatEntry entry) {
countStudents += entry.getCountStudents();
countDistinctStudents += entry.getCountDistinctStudents();
float score1 = averageScore == null ? 0.0f : (averageScore * (countPassed + countFailed));
float score2 = entry.averageScore == null ? 0.0f : (entry.averageScore * (entry.countPassed + entry.countFailed));
float scores = (score1 + score2);
if(scores <= 0.0f) {
averageScore = null;
} else {
averageScore = scores / (countPassed + countFailed + entry.countPassed + entry.countFailed);
}
countPassed += entry.getCountPassed();
countFailed += entry.getCountFailed();
countNotAttempted += entry.getCountNotAttempted();
initialLaunch += entry.getInitialLaunch();
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.coach.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* Initial date: 28.02.2014<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
@Entity
@Table(name="o_as_eff_statement_courses_v")
public class EfficiencyStatementCourseStatEntry {
@Id
@Column(name="st_id", nullable=false, unique=true, insertable=false, updatable=false)
private Long statementKey;
@Column(name="re_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long repoKey;
@Column(name="re_name", nullable=false, unique=false, insertable=false, updatable=false)
private String repoDisplayName;
@Column(name="tutor_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long tutorKey;
@Column(name="student_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long studentKey;
@Column(name="st_score", nullable=false, unique=false, insertable=false, updatable=false)
private Float score;
@Column(name="st_passed", nullable=false, unique=false, insertable=false, updatable=false)
private int passed;
@Column(name="st_failed", nullable=false, unique=false, insertable=false, updatable=false)
private int failed;
@Column(name="st_not_attempted", nullable=false, unique=false, insertable=false, updatable=false)
private int notAttempted;
@Column(name="pg_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long initialLaunchKey;
public Long getStatementKey() {
return statementKey;
}
public void setStatementKey(Long statementKey) {
this.statementKey = statementKey;
}
public Long getRepoKey() {
return repoKey;
}
public void setRepoKey(Long repoKey) {
this.repoKey = repoKey;
}
public String getRepoDisplayName() {
return repoDisplayName;
}
public void setRepoDisplayName(String repoDisplayName) {
this.repoDisplayName = repoDisplayName;
}
public Long getTutorKey() {
return tutorKey;
}
public void setTutorKey(Long tutorKey) {
this.tutorKey = tutorKey;
}
public Long getStudentKey() {
return studentKey;
}
public void setStudentKey(Long studentKey) {
this.studentKey = studentKey;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public int getPassed() {
return passed;
}
public void setPassed(int passed) {
this.passed = passed;
}
public int getFailed() {
return failed;
}
public void setFailed(int failed) {
this.failed = failed;
}
public int getNotAttempted() {
return notAttempted;
}
public void setNotAttempted(int notAttempted) {
this.notAttempted = notAttempted;
}
public Long getInitialLaunchKey() {
return initialLaunchKey;
}
public void setInitialLaunchKey(Long initialLaunchKey) {
this.initialLaunchKey = initialLaunchKey;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.coach.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.olat.core.commons.persistence.PersistentObject;
/**
* The object is immutable
*
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*/
@Entity
@Table(name="o_as_eff_statement_groups_v")
public class EfficiencyStatementGroupStatEntry extends PersistentObject {
private static final long serialVersionUID = -5632894869497135693L;
@Id
@Column(name="st_id", nullable=false, unique=true, insertable=false, updatable=false)
private Long statementKey;
@Column(name="re_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long repoKey;
@Column(name="re_name", nullable=false, unique=false, insertable=false, updatable=false)
private String repoDisplayName;
@Column(name="bg_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long groupKey;
@Column(name="bg_name", nullable=false, unique=false, insertable=false, updatable=false)
private String groupName;
@Column(name="tutor_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long tutorKey;
@Column(name="student_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long studentKey;
@Column(name="st_score", nullable=false, unique=false, insertable=false, updatable=false)
private Float score;
@Column(name="st_passed", nullable=false, unique=false, insertable=false, updatable=false)
private int passed;
@Column(name="st_failed", nullable=false, unique=false, insertable=false, updatable=false)
private int failed;
@Column(name="st_not_attempted", nullable=false, unique=false, insertable=false, updatable=false)
private int notAttempted;
@Column(name="pg_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long initialLaunchKey;
public Long getRepoKey() {
return repoKey;
}
public void setRepoKey(Long repoKey) {
this.repoKey = repoKey;
}
public Long getGroupKey() {
return groupKey;
}
public void setGroupKey(Long groupKey) {
this.groupKey = groupKey;
}
public Long getStatementKey() {
return statementKey;
}
public void setStatementKey(Long statementKey) {
this.statementKey = statementKey;
}
public Long getTutorKey() {
return tutorKey;
}
public void setTutorKey(Long tutorKey) {
this.tutorKey = tutorKey;
}
public Long getStudentKey() {
return studentKey;
}
public void setStudentKey(Long studentKey) {
this.studentKey = studentKey;
}
public String getRepoDisplayName() {
return repoDisplayName;
}
public void setRepoDisplayName(String repoDisplayName) {
this.repoDisplayName = repoDisplayName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public int getPassed() {
return passed;
}
public void setPassed(int passed) {
this.passed = passed;
}
public int getFailed() {
return failed;
}
public void setFailed(int failed) {
this.failed = failed;
}
public int getNotAttempted() {
return notAttempted;
}
public void setNotAttempted(int notAttempted) {
this.notAttempted = notAttempted;
}
public Long getInitialLaunchKey() {
return initialLaunchKey;
}
public void setInitialLaunchKey(Long initialLaunchKey) {
this.initialLaunchKey = initialLaunchKey;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("efficiencyStatementStatEntry[statementId=")
.append(getKey()).append(":repositoryEntry=")
.append(repoDisplayName).append(":tutorName=");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
return false;
}
@Override
public int hashCode() {
return super.hashCode();
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.coach.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* Initial date: 28.02.2014<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
@Entity(name="coachstatisticsidentity")
@Table(name="o_as_eff_statement_identity_v")
public class EfficiencyStatementIdentityStatEntry {
@Id
@Column(name="st_id", nullable=false, unique=true, insertable=false, updatable=false)
private Long statementKey;
@Column(name="re_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long repoKey;
@Column(name="student_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long studentKey;
@Column(name="st_score", nullable=false, unique=false, insertable=false, updatable=false)
private Float score;
@Column(name="st_passed", nullable=false, unique=false, insertable=false, updatable=false)
private int passed;
@Column(name="st_failed", nullable=false, unique=false, insertable=false, updatable=false)
private int failed;
@Column(name="st_not_attempted", nullable=false, unique=false, insertable=false, updatable=false)
private int notAttempted;
@Column(name="pg_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long initialLaunchKey;
public Long getStatementKey() {
return statementKey;
}
public void setStatementKey(Long statementKey) {
this.statementKey = statementKey;
}
public Long getRepoKey() {
return repoKey;
}
public void setRepoKey(Long repoKey) {
this.repoKey = repoKey;
}
public Long getStudentKey() {
return studentKey;
}
public void setStudentKey(Long studentKey) {
this.studentKey = studentKey;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public int getPassed() {
return passed;
}
public void setPassed(int passed) {
this.passed = passed;
}
public int getFailed() {
return failed;
}
public void setFailed(int failed) {
this.failed = failed;
}
public int getNotAttempted() {
return notAttempted;
}
public void setNotAttempted(int notAttempted) {
this.notAttempted = notAttempted;
}
public Long getInitialLaunchKey() {
return initialLaunchKey;
}
public void setInitialLaunchKey(Long initialLaunchKey) {
this.initialLaunchKey = initialLaunchKey;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.coach.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* Initial date: 28.02.2014<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
@Entity
@Table(name="o_as_eff_statement_students_v")
public class EfficiencyStatementStudentStatEntry {
@Id
@Column(name="st_id", nullable=false, unique=true, insertable=false, updatable=false)
private Long statementKey;
@Column(name="re_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long repoKey;
@Column(name="tutor_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long tutorKey;
@Column(name="student_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long studentKey;
@Column(name="st_score", nullable=false, unique=false, insertable=false, updatable=false)
private Float score;
@Column(name="st_passed", nullable=false, unique=false, insertable=false, updatable=false)
private int passed;
@Column(name="st_failed", nullable=false, unique=false, insertable=false, updatable=false)
private int failed;
@Column(name="st_not_attempted", nullable=false, unique=false, insertable=false, updatable=false)
private int notAttempted;
@Column(name="pg_id", nullable=false, unique=false, insertable=false, updatable=false)
private Long initialLaunchKey;
public Long getStatementKey() {
return statementKey;
}
public void setStatementKey(Long statementKey) {
this.statementKey = statementKey;
}
public Long getRepoKey() {
return repoKey;
}
public void setRepoKey(Long repoKey) {
this.repoKey = repoKey;
}
public Long getTutorKey() {
return tutorKey;
}
public void setTutorKey(Long tutorKey) {
this.tutorKey = tutorKey;
}
public Long getStudentKey() {
return studentKey;
}
public void setStudentKey(Long studentKey) {
this.studentKey = studentKey;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public int getPassed() {
return passed;
}
public void setPassed(int passed) {
this.passed = passed;
}
public int getFailed() {
return failed;
}
public void setFailed(int failed) {
this.failed = failed;
}
public int getNotAttempted() {
return notAttempted;
}
public void setNotAttempted(int notAttempted) {
this.notAttempted = notAttempted;
}
public Long getInitialLaunchKey() {
return initialLaunchKey;
}
public void setInitialLaunchKey(Long initialLaunchKey) {
this.initialLaunchKey = initialLaunchKey;
}
}
......@@ -19,6 +19,9 @@
*/
package org.olat.modules.coach.model;
import java.util.HashSet;
import java.util.Set;
/**
*
* Dummy bean to transport statistic values about group
......@@ -26,31 +29,40 @@ package org.olat.modules.coach.model;
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*/
public class GroupStatEntry {
// s.repoKey,
private Long groupKey;
private String groupName;
private int countCourses;
private int countStudents;
private int countPassed;
private int countFailed;
private int countNotAttempted;
private final Long groupKey;
private final String groupName;
private int countCourses = 0;
private int countStudents = 0;
private int countDistinctStudents = 0;
private int countPassed = 0;
private int countFailed = 0;
private int countNotAttempted = 0;
private Float averageScore;
private int initialLaunch;
private double sumScore = 0.0d;
private int initialLaunch = 0;
private Set<Long> repoIds = new HashSet<>();
public GroupStatEntry(Long groupKey, String groupName) {
this.groupKey = groupKey;
this.groupName = groupName;
}
public Long getGroupKey() {
return groupKey;
}
public void setGroupKey(Long groupKey) {
this.groupKey = groupKey;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
public Set<Long> getRepoIds() {
return repoIds;
}
public void setRepoIds(Set<Long> repoIds) {
this.repoIds = repoIds;
}
public int getCountCourses() {
......@@ -70,11 +82,11 @@ public class GroupStatEntry {
}
public int getCountDistinctStudents() {
return countStudents;
return countDistinctStudents;
}
public void setCountDistinctStudents(int countStudents) {
this.countStudents = countStudents;
public void setCountDistinctStudents(int countDistinctStudents) {
this.countDistinctStudents = countDistinctStudents;
}
public int getCountPassed() {
......@@ -109,6 +121,14 @@ public class GroupStatEntry {
this.averageScore = averageScore;
}
public double getSumScore() {
return sumScore;
}
public void setSumScore(double sumScore) {
this.sumScore = sumScore;
}
public int getInitialLaunch() {
return initialLaunch;
}
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.coach.model;
import java.util.Map;
/**
*
* Initial date: 02.02.2015<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class SearchCoachedIdentityParams {
private String login;
private Map<String,String> userProperties;
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public Map<String, String> getUserProperties() {
return userProperties;
}
public void setUserProperties(Map<String, String> userProperties) {
this.userProperties = userProperties;
}
}
......@@ -19,6 +19,9 @@
*/
package org.olat.modules.coach.model;
import java.util.HashSet;
import java.util.Set;
/**
*
......@@ -28,26 +31,25 @@ package org.olat.modules.coach.model;
*/
public class StudentStatEntry {
private Long studentKey;
private int countRepo;
private int countPassed;
private int countFailed;
private int countNotAttempted;
private int initialLaunch;
private final Long studentKey;
private int countRepo = 0;
private int countPassed = 0;
private int countFailed = 0;
private int countNotAttempted = 0;
private int initialLaunch = 0;
private Set<String> repoIds = new HashSet<>();
private Set<String> launchIds = new HashSet<>();
public StudentStatEntry() {
//
public StudentStatEntry(Long studentKey) {
this.studentKey = studentKey;
}
public Long getStudentKey() {
return studentKey;
}
public void setStudentKey(Long studentKey) {
this.studentKey = studentKey;
}
public int getCountRepo() {
return countRepo;
}
......@@ -56,6 +58,22 @@ public class StudentStatEntry {
this.countRepo = countRepo;
}
public Set<String> getRepoIds() {
return repoIds;
}
public void setRepoIds(Set<String> repoIds) {
this.repoIds = repoIds;
}
public Set<String> getLaunchIds() {
return launchIds;
}
public void setLaunchIds(Set<String> launchIds) {
this.launchIds = launchIds;
}
public int getCountPassed() {
return countPassed;
}
......@@ -87,12 +105,4 @@ public class StudentStatEntry {
public void setInitialLaunch(int initialLaunch) {
this.initialLaunch = initialLaunch;
}
public void add(StudentStatEntry entry) {
countRepo += entry.getCountRepo();
countPassed += entry.getCountPassed();
countFailed += entry.getCountFailed();
countNotAttempted += entry.getCountNotAttempted();
initialLaunch += entry.getInitialLaunch();
}
}
......@@ -21,7 +21,6 @@ package org.olat.modules.coach.ui;
import java.util.List;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.panel.Panel;
......@@ -44,10 +43,10 @@ import org.olat.core.id.context.StateEntry;
import org.olat.core.util.resource.OresHelper;
import org.olat.modules.coach.CoachingService;
import org.olat.modules.coach.model.CourseStatEntry;
import org.olat.modules.coach.ui.CoursesTableDataModel.Columns;
import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryManager;
import org.olat.modules.coach.ui.CoursesTableDataModel.Columns;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
......@@ -68,14 +67,13 @@ public class CourseListController extends BasicController implements Activateabl
private boolean hasChanged = false;
private final CoachingService coachingService;
private final RepositoryManager repositoryManager;
@Autowired
private CoachingService coachingService;
@Autowired
private RepositoryManager repositoryManager;
public CourseListController(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl);
coachingService = CoreSpringFactory.getImpl(CoachingService.class);
repositoryManager = CoreSpringFactory.getImpl(RepositoryManager.class);
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("error.no.found"));
......
......@@ -63,10 +63,10 @@ public class CoursesTableDataModel implements TableDataModel<CourseStatEntry> {
return c.getRepoDisplayName();
}
case countStudents: {
return new Integer(c.getCountDistinctStudents());
return new Integer(c.getCountStudents());
}
case initialLaunch: {
int count = c.getCountDistinctStudents();
int count = c.getCountStudents();
if(count == 0) {
return new LightedValue("", Light.grey);
}
......@@ -81,7 +81,7 @@ public class CoursesTableDataModel implements TableDataModel<CourseStatEntry> {
return new LightedValue(Integer.toString(launch), light);
}
case countPassed: {
int numOfStudents = c.getCountDistinctStudents();
int numOfStudents = c.getCountStudents();
if(numOfStudents == 0) {
return numOfStudents;
}
......@@ -92,7 +92,7 @@ public class CoursesTableDataModel implements TableDataModel<CourseStatEntry> {
return val;
}
case countPassedLight: {
int count = c.getCountDistinctStudents();
int count = c.getCountStudents();
if(count == 0) {
return new LightedValue("", Light.grey);
}
......
......@@ -219,8 +219,8 @@ public class StudentCoursesController extends BasicController implements Activat
}
private List<EfficiencyStatementEntry> loadModel() {
List<RepositoryEntry> courses = fullAccess ? coachingService.getUserCourses(student, 0, -1)
: coachingService.getStudentsCourses(getIdentity(), student, 0, -1);
List<RepositoryEntry> courses = fullAccess ? coachingService.getUserCourses(student)
: coachingService.getStudentsCourses(getIdentity(), student);
List<EfficiencyStatementEntry> statements = coachingService.getEfficencyStatements(student, courses);
List<CertificateLight> certificates = certificatesManager.getLastCertificates(student);
......
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