Skip to content
Snippets Groups Projects
Commit 4c34c060 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Merge branch 'public-pool'

Closes GH-13.
parents eb60907f 73465244
Branches
Tags
No related merge requests found
......@@ -205,10 +205,10 @@ public class SessionController extends AbstractController {
}
@RequestMapping(value = "/publicpool", method = RequestMethod.GET)
public final List<Session> getPublicPoolSessions(
public final List<SessionInfo> getPublicPoolSessions(
final HttpServletResponse response
) {
List<Session> sessions = sessionService.getPublicPoolSessions();
List<SessionInfo> sessions = sessionService.getPublicPoolSessionsInfo();
if (sessions == null || sessions.isEmpty()) {
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
......
......@@ -140,12 +140,18 @@ public class CouchDBDao implements IDatabaseDao {
d.getJSONObject().getJSONObject("value"),
Session.class
);
//session.set_id(d.getId());
session.set_id(d.getId());
result.add(session);
}
return result;
}
@Override
public final List<SessionInfo> getPublicPoolSessionsInfo() {
final List<Session> sessions = this.getPublicPoolSessions();
return getInfosForSessions(sessions);
}
@Override
public final List<Session> getMyPublicPoolSessions(final User user) {
final NovaView view = new NovaView("session/public_pool_by_creator");
......
......@@ -179,6 +179,8 @@ public interface IDatabaseDao {
SimpleEntry<Integer, Integer> getMyLearningProgress(Session session, User user);
List<SessionInfo> getMySessionsInfo(User user);
List<SessionInfo> getPublicPoolSessionsInfo();
List<SessionInfo> getMyPublicPoolSessionsInfo(final User user);
......
......@@ -28,13 +28,16 @@ public class SessionInfo {
private boolean active;
private String courseType;
private long creationTime;
private String sessionType;
private String ppLevel;
private String ppSubject;
private int numQuestions;
private int numAnswers;
private int numInterposed;
private int numUnredInterposed;
private int numUnanswered;
public SessionInfo(Session session) {
this.name = session.getName();
this.shortName = session.getShortName();
......@@ -42,6 +45,9 @@ public class SessionInfo {
this.active = session.isActive();
this.courseType = session.getCourseType();
this.creationTime = session.getCreationTime();
this.sessionType = session.getSessionType();
this.ppLevel = session.getPpLevel();
this.ppSubject = session.getPpSubject();
}
public static List<SessionInfo> fromSessionList(List<Session> sessions) {
......@@ -91,6 +97,30 @@ public class SessionInfo {
public void setCourseType(String courseType) {
this.courseType = courseType;
}
public String getSessionType() {
return sessionType;
}
public void setSessionType(String sessionType) {
this.sessionType = sessionType;
}
public String getPpLevel() {
return ppLevel;
}
public void setPpLevel(String ppLevel) {
this.ppLevel = ppLevel;
}
public String getPpSubject() {
return ppSubject;
}
public void setPpSubject(String ppSubject) {
this.ppSubject = ppSubject;
}
public int getNumQuestions() {
return numQuestions;
......
......@@ -37,8 +37,6 @@ public interface ISessionService {
String generateKeyword();
List<Session> getMySessions();
List<Session> getPublicPoolSessions();
List<Session> getMyVisitedSessions();
......@@ -60,6 +58,8 @@ public interface ISessionService {
List<SessionInfo> getMySessionsInfo();
List<SessionInfo> getPublicPoolSessionsInfo();
List<SessionInfo> getMyPublicPoolSessionsInfo();
List<SessionInfo> getMyVisitedSessionsInfo();
......
......@@ -168,8 +168,8 @@ public class SessionService implements ISessionService {
@Override
@PreAuthorize("isAuthenticated()")
public final List<Session> getPublicPoolSessions() {
return databaseDao.getPublicPoolSessions();
public final List<SessionInfo> getPublicPoolSessionsInfo() {
return databaseDao.getPublicPoolSessionsInfo();
}
@Override
......
......@@ -200,6 +200,12 @@ public class StubDatabaseDao implements IDatabaseDao {
return null;
}
@Override
public List<SessionInfo> getPublicPoolSessionsInfo() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Session> getMyPublicPoolSessions(User user) {
// TODO Auto-generated method stub
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment