Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookController.java =================================================================== diff -u -rfd2cfad55c7c517931f69334ce644d509ec28140 -rca79baf0ed380e5f7892841f7088325ea9664f35 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookController.java (.../GradebookController.java) (revision fd2cfad55c7c517931f69334ce644d509ec28140) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookController.java (.../GradebookController.java) (revision ca79baf0ed380e5f7892841f7088325ea9664f35) @@ -101,14 +101,7 @@ * User view will get the grid data for a specified user, which is all their activity marks/outputs etc * * Activity view will get the grid data for all activities, without user info, instead there is an average mark for - * each activity - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * each activity. */ @RequestMapping("/getActivityGridData") @ResponseBody @@ -291,14 +284,7 @@ * Activity view will take an extra parameter (activityID) and instead show the user's mark just for one activity * * Course monitor view gets the same as the user view, but the link is set to the lesson level gradebook instead of - * learner - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * learner. */ @RequestMapping("/getUserGridData") @ResponseBody @@ -376,7 +362,7 @@ } else { // return null and the grid will report an error - GradebookController.logger.error("No activity found for: " + activityID); + logger.error("No activity found for: " + activityID); return null; } } @@ -416,14 +402,7 @@ * * Learner view will get the data specific to one user * - * Monitor will get the data average for whole lessons - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * Monitor will get the data average for whole lessons. */ @SuppressWarnings("unchecked") @RequestMapping("/getCourseGridData") @@ -500,8 +479,7 @@ if ((organisation == null) || (user == null) || (viewer == null)) { // Grid will handle error, just log and return null - GradebookController.logger - .error("Error: request for course gradebook data with null course or user. CourseID: " + courseID); + logger.error("Error: request for course gradebook data with null course or user. CourseID: " + courseID); return null; } List gradebookLessonDTOs = gradebookService.getGBLessonRows(organisation, user, viewer, @@ -524,14 +502,7 @@ } /** - * Gets the total mark for a user's lesson and writes the result in the response - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * Gets the total mark for a user's lesson and writes the result in the response. */ @RequestMapping("/getLessonMarkAggregate") @ResponseBody @@ -563,21 +534,13 @@ } } else { // Grid will handle error, just log and return null - GradebookController.logger - .error("Error: request for course gradebook data with null user or lesson. lessonID: " + lessonID); + logger.error("Error: request for course gradebook data with null user or lesson. lessonID: " + lessonID); } return null; } /** * Gets the average mark for an activity and writes the result in the response - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception */ @SuppressWarnings("unchecked") @RequestMapping("/getActivityMarkAverage") @@ -614,26 +577,18 @@ Double averageMark = gradebookService.getAverageMarkForActivity(activityID, groupID); response.setContentType("text/plain, charset=utf-8"); if (averageMark != null) { - return GradebookUtil.niceFormatting(averageMark); + } else { - return GradebookConstants.CELL_EMPTY; } - } /** * Gets the average mark for lesson and writes the result in the response - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception */ @RequestMapping("/getAverageMarkForLesson") + @ResponseBody public String getAverageMarkForLesson(HttpServletRequest request, HttpServletResponse response) throws Exception { Long lessonID = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); if (!securityService.isLessonMonitor(lessonID, getUser().getUserID(), "get lesson mark average", false)) { @@ -645,10 +600,9 @@ response.setContentType("text/plain; charset=utf-8"); if (averageMark != null) { - return GradebookUtil.niceFormatting(averageMark); + } else { - return GradebookConstants.CELL_EMPTY; } } Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookLearningController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -rca79baf0ed380e5f7892841f7088325ea9664f35 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookLearningController.java (.../GradebookLearningController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookLearningController.java (.../GradebookLearningController.java) (revision ca79baf0ed380e5f7892841f7088325ea9664f35) @@ -77,8 +77,7 @@ return null; } if (logger.isDebugEnabled()) { - GradebookLearningController.logger - .debug("Getting learner gradebook for organisation: " + oranisationID); + logger.debug("Getting learner gradebook for organisation: " + oranisationID); } Organisation organisation = (Organisation) userManagementService.findById(Organisation.class, oranisationID); @@ -88,7 +87,7 @@ return "gradebookCourseLearner"; } catch (Exception e) { - GradebookLearningController.logger.error("Failed to load learner gradebook", e); + logger.error("Failed to load learner gradebook", e); return "error"; } } Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookMonitoringController.java =================================================================== diff -u -r562089bd7ef5093aed1d28a87a7366a0448a6145 -rca79baf0ed380e5f7892841f7088325ea9664f35 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookMonitoringController.java (.../GradebookMonitoringController.java) (revision 562089bd7ef5093aed1d28a87a7366a0448a6145) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/controller/GradebookMonitoringController.java (.../GradebookMonitoringController.java) (revision ca79baf0ed380e5f7892841f7088325ea9664f35) @@ -94,7 +94,7 @@ } UserDTO user = getUser(); if (user == null) { - GradebookMonitoringController.log.error("User missing from session. "); + log.error("User missing from session. "); return "error"; } if (!securityService.isLessonMonitor(lessonId, user.getUserID(), "get lesson gradebook", false)) { @@ -117,7 +117,7 @@ return "gradebookMonitor"; } catch (Exception e) { - GradebookMonitoringController.log.error("Failed to load lesson gradebook", e); + log.error("Failed to load lesson gradebook", e); return "error"; } } @@ -127,13 +127,13 @@ try { Integer organisationID = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); - if (GradebookMonitoringController.log.isDebugEnabled()) { - GradebookMonitoringController.log.debug("Getting gradebook for organisation " + organisationID); + if (log.isDebugEnabled()) { + log.debug("Getting gradebook for organisation " + organisationID); } UserDTO user = getUser(); if (user == null) { - GradebookMonitoringController.log.error("User missing from session. "); + log.error("User missing from session. "); return "error"; } if (!securityService.hasOrgRole(organisationID, user.getUserID(), @@ -149,23 +149,15 @@ return "gradebookCourseMonitor"; } catch (Exception e) { - GradebookMonitoringController.log.error("Failed to load course gradebook", e); + log.error("Failed to load course gradebook", e); return "error"; } } /** - * Updates a user's mark or feedback for an entire lesson - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * Updates a user's mark or feedback for an entire lesson. */ @RequestMapping(path = "/updateUserLessonGradebookData", method = RequestMethod.POST) - @ResponseBody public void updateUserLessonGradebookData(HttpServletRequest request, HttpServletResponse response) throws Exception { Long lessonID = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); @@ -176,8 +168,7 @@ Integer userID = WebUtil.readIntParam(request, GradebookConstants.PARAM_ID); User learner = (User) userManagementService.findById(User.class, userID); if (learner == null) { - GradebookMonitoringController.log - .error("User with ID " + userID + " could not be found to update his lesson gradebook"); + log.error("User with ID " + userID + " could not be found to update his lesson gradebook"); response.sendError(HttpServletResponse.SC_BAD_REQUEST, "User could not be found"); } @@ -191,18 +182,10 @@ if (feedback != null) { gradebookService.updateUserLessonGradebookFeedback(lesson, learner, feedback); } - } /** - * Updates a user's mark or feedback for an activity, then aggregates their total lesson mark - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * Updates a user's mark or feedback for an activity, then aggregates their total lesson mark. */ @RequestMapping(path = "/updateUserActivityGradebookData", method = RequestMethod.POST) @ResponseBody @@ -231,15 +214,13 @@ Activity activity = gradebookService.getActivityById(activityID); if ((activity == null) || !activity.isToolActivity()) { - GradebookMonitoringController.log - .error("Activity with ID " + activityID + " could not be found or it is not a Tool Activity"); + log.error("Activity with ID " + activityID + " could not be found or it is not a Tool Activity"); response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Wrong activity"); } User learner = (User) userManagementService.findById(User.class, userID); if (learner == null) { - GradebookMonitoringController.log - .error("User with ID " + userID + " could not be found to update his activity gradebook"); + log.error("User with ID " + userID + " could not be found to update his activity gradebook"); response.sendError(HttpServletResponse.SC_BAD_REQUEST, "User could not be found"); } @@ -270,14 +251,7 @@ } /** - * Toggles the release mark flag for a lesson - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws Exception + * Toggles the release mark flag for a lesson. */ @RequestMapping("/toggleReleaseMarks") @ResponseBody @@ -305,16 +279,16 @@ response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson"); } - if (GradebookMonitoringController.log.isDebugEnabled()) { - GradebookMonitoringController.log.debug("Exporting to a spreadsheet lesson: " + lessonID); + if (log.isDebugEnabled()) { + log.debug("Exporting to a spreadsheet lesson: " + lessonID); } Lesson lesson = lessonService.getLesson(lessonID); String fileName = lesson.getLessonName().replaceAll(" ", "_") + ".xlsx"; fileName = FileUtil.encodeFilenameForDownload(request, fileName); response.setContentType("application/x-download"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - GradebookMonitoringController.log.debug("Exporting to a spreadsheet gradebook lesson: " + lessonID); + log.debug("Exporting to a spreadsheet gradebook lesson: " + lessonID); ServletOutputStream out = response.getOutputStream(); LinkedHashMap dataToExport = gradebookService.exportLessonGradebook(lesson); @@ -343,8 +317,8 @@ } Organisation organisation = (Organisation) userManagementService.findById(Organisation.class, organisationID); - if (GradebookMonitoringController.log.isDebugEnabled()) { - GradebookMonitoringController.log.debug("Exporting to a spreadsheet course: " + organisationID); + if (log.isDebugEnabled()) { + log.debug("Exporting to a spreadsheet course: " + organisationID); } LinkedHashMap dataToExport = gradebookService.exportCourseGradebook(user.getUserID(), organisationID); @@ -384,9 +358,9 @@ Organisation organisation = (Organisation) userManagementService.findById(Organisation.class, organisationID); String[] lessonIds = request.getParameterValues(AttributeNames.PARAM_LESSON_ID); - if (GradebookMonitoringController.log.isDebugEnabled()) { - GradebookMonitoringController.log.debug("Exporting to a spreadsheet lessons " + Arrays.toString(lessonIds) - + " from course: " + organisationID); + if (log.isDebugEnabled()) { + log.debug("Exporting to a spreadsheet lessons " + Arrays.toString(lessonIds) + " from course: " + + organisationID); } LinkedHashMap dataToExport = gradebookService .exportSelectedLessonsGradebook(user.getUserID(), organisationID, lessonIds, simplified);