Ejemplo n.º 1
0
 def addSession(self, staff, seminarId, startDateTime, endDateTime, name,
                descr, capacity, presenter):
     seminar = self.getEvent(seminarId)
     venue = seminar.getVenue()
     if (venue.getMaxCapacity() < capacity):
         raise VenueCapacityException(
             'Capacity', 'Venue Capacity is less than session capacity')
     if (startDateTime < seminar.getStartDateTime()):
         raise SessionDateTimeException(
             'StartDateTime',
             'Session start date time > seminar start date time')
     if (endDateTime > seminar.getEndDateTime()):
         raise SessionDateTimeException(
             'EndDateTime',
             'Session end date time <= seminar end date time')
     id = self.getUniqueEventId()
     session = Session(seminarId,id,startDateTime,endDateTime,name,descr,seminar.getVenue(),\
     seminar.getConvener(),capacity,seminar.getDeregEnd(),presenter,seminar.getFee(),seminar.getEarlyBirdEnd())
     if seminar.sessionPeriodOverlaps(session.getPeriod()):
         raise OverlappingBookingException(
             'Session',
             'Session time overlaps with previous booking at this venue')
     if not self.__seminarManager.addSession(seminarId, session):
         raise ExistingEventException(
             'Session',
             'Session in this seminar, with this name already exists')
     staff.addPostedCurrEvent(session)
     # if you are making the session and set the presenter to be yourself then you automatically accept the request
     if staff.get_id() != presenter.get_id():
         guestRequestNotification = AcceptRejectNotification(
             "{0} has asked you to be the presenter to '{1}' session".
             format(staff.getName(), name), session.getId())
         presenter.addNotification(guestRequestNotification)
     else:
         session.setIsPending(False)
     return id