original_docstring: Add more tickets to an existing event
docstring: Add more tickets to an existing event
docstring_tokens: Add more tickets to an existing event
code: def put(self, eventIdentifier):
          """Add more tickets to an existing event"""
          params = event_add_parser.parse_args()
  
          try:
              resp = User.decode_auth_token(params['Authorization'])
  
              if not isinstance(resp, str):
                  event = Event.query.filter_by(guid=eventIdentifier.bytes).first()
  
                  if not event:
                      response_object = {
                          'status': 'fail',
                          'message': 'Invalid eventIdentifier.'
                          }
                      return response_object, 402
  
                  if event.additional_number_of_tickets:
                      event.additional_number_of_tickets += params['additionalNumberOfTickets']
                  else:
                      event.additional_number_of_tickets = params['additionalNumberOfTickets']
  
                  tickets = (Ticket(author_id=resp, event_id=event.id)
                             for _ in range(params['additionalNumberOfTickets']))
  
                  db.session.add_all(tickets)
                  db.session.commit()
  
                  response_object = {
                      'status': 'success',
                      'message': f'Successfully added {params["additionalNumberOfTickets"]} event tickets.',
                  }
                  return response_object, 200
  
              response_object = {
                  'status': 'fail',
                  'message': resp
                  }
              return response_object, 401
  
          except Exception:
              logger.error('An error occurred creating an event.', exc_info=True)
  
              response_object = {
                  'status': 'fail',
                  'message': 'An Internal Server Error Occurred.',
              }
              return response_object, 500
code_tokens: def put ( self , eventIdentifier ) : params = event_add_parser . parse_args ( ) try : resp = User . decode_auth_token ( params [ 'Authorization' ] ) if not isinstance ( resp , str ) : event = Event . query . filter_by ( guid = eventIdentifier . bytes ) . first ( ) if not event : response_object = { 'status' : 'fail' , 'message' : 'Invalid eventIdentifier.' } return response_object , 402 if event . additional_number_of_tickets : event . additional_number_of_tickets += params [ 'additionalNumberOfTickets' ] else : event . additional_number_of_tickets = params [ 'additionalNumberOfTickets' ] tickets = ( Ticket ( author_id = resp , event_id = event . id ) for _ in range ( params [ 'additionalNumberOfTickets' ] ) ) db . session . add_all ( tickets ) db . session . commit ( ) response_object = { 'status' : 'success' , 'message' : f'Successfully added {params["additionalNumberOfTickets"]} event tickets.' , } return response_object , 200 response_object = { 'status' : 'fail' , 'message' : resp } return response_object , 401 except Exception : logger . error ( 'An error occurred creating an event.' , exc_info = True ) response_object = { 'status' : 'fail' , 'message' : 'An Internal Server Error Occurred.' , } return response_object , 500
short_docstring: Add more tickets to an existing event
short_docstring_tokens: Add more tickets to an existing event
comment: """Add more tickets to an existing event"""