Index: lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java =================================================================== diff -u -r6f7031f1ac1eb389133a9c306cc6ea178eb88573 -r487adbd2d8d6c3be1389a1bb0f2b2803c751a366 --- lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java (.../CoreNotebookService.java) (revision 6f7031f1ac1eb389133a9c306cc6ea178eb88573) +++ lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java (.../CoreNotebookService.java) (revision 487adbd2d8d6c3be1389a1bb0f2b2803c751a366) @@ -111,15 +111,16 @@ * alias of notebookEntry) and the sql join clause, which should go with any other join clauses. * * To make sure it always returns the same number of objects add the select clause like this: - * queryText.append(notebookEntryStrings != null ? notebookEntryStrings[0] : ", NULL notebookEntry"); + * queryText.append(notebookEntryStrings != null ? notebookEntryStrings[0] : ", NULL notebookEntry"); or + * queryText.append(notebookEntryStrings != null ? notebookEntryStrings[0] : ", NULL notebookEntry, NULL notebookModifiedDate"); or * * Then if there is isn't a notebookEntry to return, it still returns a notebookEntry column, which translates to * null. So you can return a collection like List irrespective of whether or not the * notebook entries (the Strings) are needed. * * Finally, as it will be returning the notebook entry as a separate field in select clause, set up the sql -> java * object translation using ".addScalar("notebookEntry", Hibernate.STRING)" if includeDateModified = false or - * .addScalar("notebookEntry", Hibernate.STRING).addScalar("notebookCreateDate", Hibernate.DATE).addScalar("notebookModifiedDate", Hibernate.DATE) + * .addScalar("notebookEntry", Hibernate.STRING).addScalar("notebookModifiedDate", Hibernate.DATE) * if includeDates = true. * * @param sessionIdString @@ -144,7 +145,9 @@ buf.append("\" AND entry.user_id="); buf.append(userIdString); String[] retValue = new String[2]; - retValue[0] = includeDates ? ", entry.entry notebookEntry, entry.create_date notebookCreateDate, entry.last_modified notebookModifiedDate " : ", entry.entry notebookEntry "; + retValue[0] = includeDates + ? ", entry.entry notebookEntry, (CASE WHEN entry.last_modified IS NULL THEN entry.create_date ELSE entry.last_modified END) notebookModifiedDate " + : ", entry.entry notebookEntry "; retValue[1] = buf.toString(); return retValue; } Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dao/INotebookUserDAO.java =================================================================== diff -u -r6f7031f1ac1eb389133a9c306cc6ea178eb88573 -r487adbd2d8d6c3be1389a1bb0f2b2803c751a366 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dao/INotebookUserDAO.java (.../INotebookUserDAO.java) (revision 6f7031f1ac1eb389133a9c306cc6ea178eb88573) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dao/INotebookUserDAO.java (.../INotebookUserDAO.java) (revision 487adbd2d8d6c3be1389a1bb0f2b2803c751a366) @@ -62,9 +62,7 @@ */ NotebookUser getByUID(Long uid); - /** Will return List<[NotebookUser, String, Date, Date]> - * where the String is the notebook entry, the first date is the create date and the second date is the modified date. - * No notebook entries needed? Will return in their place. + /** Will return List<[NotebookUser, String, Date]> where the String is the notebook entry and the modified date. */ List getUsersForTablesorter(final Long sessionId, int page, int size, int sorting, String searchString, ICoreNotebookService coreNotebookService); Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dao/hibernate/NotebookUserDAO.java =================================================================== diff -u -r6f7031f1ac1eb389133a9c306cc6ea178eb88573 -r487adbd2d8d6c3be1389a1bb0f2b2803c751a366 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dao/hibernate/NotebookUserDAO.java (.../NotebookUserDAO.java) (revision 6f7031f1ac1eb389133a9c306cc6ea178eb88573) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/dao/hibernate/NotebookUserDAO.java (.../NotebookUserDAO.java) (revision 487adbd2d8d6c3be1389a1bb0f2b2803c751a366) @@ -95,9 +95,7 @@ } @SuppressWarnings("unchecked") - /** Will return List<[NotebookUser, String, Date, Date]> - * where the String is the notebook entry, the first date is the create date and the second date is the modified date. - * No notebook entries needed? Will return in their place. + /** Will return List<[NotebookUser, String, Date]> where the String is the notebook entry and the modified date. */ public List getUsersForTablesorter(final Long sessionId, int page, int size, int sorting, String searchString, ICoreNotebookService coreNotebookService) { @@ -110,10 +108,10 @@ sortingOrder = "user.last_name DESC, user.first_name DESC"; break; case NotebookConstants.SORT_BY_DATE_ASC: - sortingOrder = "notebookCreateDate ASC"; + sortingOrder = "notebookModifiedDate ASC"; break; case NotebookConstants.SORT_BY_DATE_DESC: - sortingOrder = "notebookCreateDate DESC"; + sortingOrder = "notebookModifiedDate DESC"; break; case NotebookConstants.SORT_BY_COMMENT_ASC: sortingOrder = "user.teachers_comment ASC"; @@ -144,7 +142,6 @@ SQLQuery query = getSession().createSQLQuery(queryText.toString()); query.addEntity("user", NotebookUser.class) .addScalar("notebookEntry", Hibernate.STRING) - .addScalar("notebookCreateDate", Hibernate.TIMESTAMP) .addScalar("notebookModifiedDate", Hibernate.TIMESTAMP) .setLong("sessionId", sessionId.longValue()) .setFirstResult(page * size) Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/INotebookService.java =================================================================== diff -u -r6f7031f1ac1eb389133a9c306cc6ea178eb88573 -r487adbd2d8d6c3be1389a1bb0f2b2803c751a366 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/INotebookService.java (.../INotebookService.java) (revision 6f7031f1ac1eb389133a9c306cc6ea178eb88573) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/INotebookService.java (.../INotebookService.java) (revision 487adbd2d8d6c3be1389a1bb0f2b2803c751a366) @@ -168,8 +168,8 @@ */ String getLearnerContentFolder(Long toolSessionId, Long userId); - /** Will return List<[NotebookUser, String, Date, Date]> - * where the String is the notebook entry, the first date is the create date and the second date is the modified date. + /** + * Will return List<[NotebookUser, String, Date]> where the String is the notebook entry and the modified date. */ List getUsersForTablesorter(final Long sessionId, int page, int size, int sorting, String searchString); int getCountUsersBySession(final Long sessionId, String searchString); Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/MonitoringAction.java =================================================================== diff -u -r6f7031f1ac1eb389133a9c306cc6ea178eb88573 -r487adbd2d8d6c3be1389a1bb0f2b2803c751a366 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision 6f7031f1ac1eb389133a9c306cc6ea178eb88573) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision 487adbd2d8d6c3be1389a1bb0f2b2803c751a366) @@ -112,7 +112,6 @@ setupService(); Long toolSessionId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID)); - // TODO fix modified date - sorts on creation date at the moment due to database. boolean hasSearch = WebUtil.readBooleanParam(request, "_search", false); String searchString = hasSearch ? request.getParameter(NotebookConstants.PARAM_NAME) : null; int page = WebUtil.readIntParam(request, "page"); @@ -157,15 +156,9 @@ responseRow.put(NotebookConstants.PARAM_COMMENT, user.getTeachersComment()); } - Date modifiedDate = null; - if ( userAndReflection.length > 3 && userAndReflection[3] != null) { - modifiedDate = (Date) userAndReflection[3]; - } else if ( userAndReflection.length > 2 && userAndReflection[2] != null) { - modifiedDate = (Date) userAndReflection[2]; - } - if ( modifiedDate != null ) { - responseRow.put(NotebookConstants.PARAM_MODIFIED_DATE, - DateUtil.convertToStringForJSON(modifiedDate)); + if ( userAndReflection.length > 2 && userAndReflection[2] != null) { + Date modifiedDate = (Date) userAndReflection[2]; + responseRow.put(NotebookConstants.PARAM_MODIFIED_DATE, DateUtil.convertToStringForJSON(modifiedDate)); } else { responseRow.put(NotebookConstants.PARAM_MODIFIED_DATE,noEntry); } Index: lams_tool_notebook/web/pages/monitoring/summary.jsp =================================================================== diff -u -r6f7031f1ac1eb389133a9c306cc6ea178eb88573 -r487adbd2d8d6c3be1389a1bb0f2b2803c751a366 --- lams_tool_notebook/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 6f7031f1ac1eb389133a9c306cc6ea178eb88573) +++ lams_tool_notebook/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 487adbd2d8d6c3be1389a1bb0f2b2803c751a366) @@ -181,10 +181,10 @@ {name:'id',index:'id', width:10, hidden: true, search: false}, {name:'userUid',index:'userUid', width:0, hidden: true, search: false}, {name:'userName',index:'userName', width:200}, - {name:'lastEdited',index:'lastEdited', width:120, search: false, sortable: false}, + {name:'lastEdited',index:'lastEdited', width:120, search: false}, {name:'entry',index:'entry', hidden: true, width:0, search: false}, {name:'commentsort',index:'commentsort', width:40, search: false }, - {name:'comment',index:'comment', hidden: true, width:0, search: false } + {name:'comment',index:'comment', hidden: true, width:0, search: false} ], multiselect: false,