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

OO-984: fancy automatic sorting based on recent launch date, lifecycle, mark and display name

parent 112369d4
No related branches found
No related tags found
No related merge requests found
...@@ -394,6 +394,7 @@ public class RepositoryEntryMyCourseQueries { ...@@ -394,6 +394,7 @@ public class RepositoryEntryMyCourseQueries {
OrderBy orderBy = params.getOrderBy(); OrderBy orderBy = params.getOrderBy();
if(orderBy != null) { if(orderBy != null) {
switch(orderBy) { switch(orderBy) {
case automatic://need lastVisited
case lastVisited: case lastVisited:
sb.append(" ,(select infos2.recentLaunch from usercourseinfos as infos2") sb.append(" ,(select infos2.recentLaunch from usercourseinfos as infos2")
.append(" where infos2.resource=res and infos2.identity=ident") .append(" where infos2.resource=res and infos2.identity=ident")
...@@ -417,9 +418,12 @@ public class RepositoryEntryMyCourseQueries { ...@@ -417,9 +418,12 @@ public class RepositoryEntryMyCourseQueries {
private void appendOrderBy(OrderBy orderBy, boolean asc, StringBuilder sb) { private void appendOrderBy(OrderBy orderBy, boolean asc, StringBuilder sb) {
if(orderBy != null) { if(orderBy != null) {
switch(orderBy) { switch(orderBy) {
case automatic: case automatic://! the sorting is reverse
sb.append(" order by lower(v.displayname)"); if(asc) {
appendAsc(sb, asc); sb.append(" order by recentLaunch desc nulls last, lifecycle.validFrom desc nulls last, marks asc nulls last, lower(v.displayname) asc ");
} else {
sb.append(" order by recentLaunch asc nulls last, lifecycle.validFrom asc nulls last, marks asc nulls last, lower(v.displayname) desc ");
}
break; break;
case favorit: case favorit:
if(asc) { if(asc) {
......
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