Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java,v diff -u -r1.56 -r1.57 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 29 Aug 2006 04:45:48 -0000 1.56 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 13 Sep 2006 05:42:26 -0000 1.57 @@ -215,20 +215,6 @@ public GateActivity closeGate(Long gateId); /** - * This method returns a list of all available Lessons. This is all the lessons - * created by the current user and all the lessons for which the user is in the - * staff group. It does not return removed lessons. - * - * TODO This is to be removed when the dummy interface is no longer needed. - * - * @param userID The user_id of the user for whom the lessons - * are being fetched. - * @return List The requested list of Lessons - * @throws IOException - */ - public List getAllLessons(Integer userID) throws IOException; - - /** * This method returns the details for the given Lesson in * WDDX format. Object inside the packet is a LessonDetailsDTO. * @@ -468,9 +454,4 @@ * @throws LessonServiceException */ public abstract void removeUsersFromGroup(Long activityID, Long groupID, String learnerIDs[]) throws LessonServiceException; - /* TODO Dummy methods - to be removed */ - public List getLearningDesigns(Long userId); - - - } Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java,v diff -u -r1.95 -r1.96 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 7 Sep 2006 05:24:44 -0000 1.95 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 13 Sep 2006 05:42:26 -0000 1.96 @@ -563,6 +563,18 @@ } checkOwnerOrStaffMember(userId, requestedLesson, "start lesson on schedule"); + if ( requestedLesson.isLessonStarted() ) { + // can't schedule it as it is already started. If the UI is correct, this should never happen. + log.error("Lesson for id="+lessonId+" has been started. Unable to schedule lesson start."); + return; + } + + if ( requestedLesson.getScheduleStartDate() != null) { + // can't reschedule! + log.error("Lesson for id="+lessonId+" is already scheduled and cannot be rescheduled."); + return; + } + JobDetail startLessonJob = getStartScheduleLessonJob(); //setup the message for scheduling job startLessonJob.setName("startLessonOnSchedule:" + lessonId); @@ -579,9 +591,9 @@ //start the scheduling job try { - requestedLesson.setScheduleStartDate(startDate); - setLessonState(requestedLesson,Lesson.NOT_STARTED_STATE); - scheduler.scheduleJob(startLessonJob, startLessonTrigger); + requestedLesson.setScheduleStartDate(startDate); + scheduler.scheduleJob(startLessonJob, startLessonTrigger); + setLessonState(requestedLesson,Lesson.NOT_STARTED_STATE); } catch (SchedulerException e) { @@ -651,6 +663,12 @@ if ( requestedLesson == null) { throw new MonitoringServiceException("Lesson for id="+lessonId+" is missing. Unable to start lesson."); } + + if ( requestedLesson.isLessonStarted() ) { + log.warn("Lesson for id="+lessonId+" has been started. No need to start the lesson. The lesson was probably scheduled, and then the staff used \"Start now\". This message would have then been created by the schedule start"); + return; + } + checkOwnerOrStaffMember(userId, requestedLesson, "create lesson class"); Date lessonStartTime = new Date(); @@ -978,14 +996,6 @@ /** * (non-Javadoc) - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getAllLessons(java.lang.Integer) - */ - public List getAllLessons(Integer userID)throws IOException{ - return lessonDAO.getLessonsForMonitoring(userID); - } - - /** - * (non-Javadoc) * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getLessonDetails(java.lang.Long) */ public String getLessonDetails(Long lessonID)throws IOException{ @@ -1557,12 +1567,6 @@ return table; } - /** Get all the learning designs for this user */ - public List getLearningDesigns(Long userId) { - - return learningDesignDAO.getLearningDesignByUserId(userId); - } - //--------------------------------------------------------------------- // Preview related methods //---------------------------------------------------------------------