Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug with classSession/show with lessonDateID

Students were not showing up in the attendance list
  • Loading branch information...
commit 8bfbdc3f9b73fc78b4d1cef58434e002e6976096 1 parent da9a755
@NathanNeff authored
View
28 grails-app/controllers/org/bworks/bworksdb/ClassSessionController.groovy
@@ -137,18 +137,30 @@ class ClassSessionController {
def show = {
def classSessionInstance = ClassSession.get( params.id )
-
- def lessonDateInstance = classSessionService.closestLessonDate(classSessionInstance)
- def attendances
- if (lessonDateInstance) {
- attendances = attendanceService.initializeAttendees(lessonDateInstance);
- }
-
if(!classSessionInstance) {
flash.message = "ClassSession not found with id ${params.id}"
redirect(action:list)
}
- else {
+ else {
+ def lessonDateInstance
+ def attendances
+
+ // If user wants a specific lessonDate, then give it to 'em
+ if (params.lessonDateId) {
+ lessonDateInstance = LessonDate.get(params.lessonDateId)
+ if (!lessonDateInstance) {
+ flash.message = "Lesson date not found with id: ${params.lessonDateId}"
+ }
+ }
+ else {
+ // Find closest class to highlight/show in attendance sheet.
+ lessonDateInstance = classSessionService.closestLessonDate(classSessionInstance)
+ }
+
+ if (lessonDateInstance) {
+ attendances = attendanceService.initializeAttendees(lessonDateInstance)
+ }
+
return [ classSessionInstance : classSessionInstance,
enrollmentData: classSessionService.attendanceMapForSession(classSessionInstance),
lessonDateInstance : lessonDateInstance,
Please sign in to comment.
Something went wrong with that request. Please try again.