def approveRefund(self, email, event_id, purchase_date): data = TransactionsCollection.getSingleTransaction( email, event_id, purchase_date) event = EventsCollection.getSingleEvent(event_id) EventsCollection.updateTicketAmount(event, -1 * int(data['quantity'])) TransactionsCollection.approveRefund(email, event_id, purchase_date, data)
def editEvent(): if 'user' in session: user = Account.fromDict(session['user']) event_id = request.args.get('id') event = EventsCollection.getSingleEvent(event_id) if user.user_type == 'organiser': return render_template('edit.html', user=user, event=event) else: return redirect(url_for('home', events=None))
def buyTicket(): if 'user' in session: user = Account.fromDict(session['user']) event_id = request.form['id'] num_tix = request.form['num_tix'] event = EventsCollection.getSingleEvent(event_id) user.purchaseTickets(event, num_tix) event.updateTicketAmount(num_tix) url = "/event?id="+str(event.ID) return redirect(url, code=302)
def editEventAction(): if 'user' in session: user = Account.fromDict(session['user']) event_id = request.form['event_id'] name = request.form['name'] date = request.form['date'] location = request.form['location'] capacity = request.form['capacity'] price = request.form['price'] event = EventsCollection.getSingleEvent(event_id) user.editEvent(event, name, location, date, capacity, price) return redirect(url_for('home', events=None))
def event(): if 'user' in session: user = Account.fromDict(session['user']) event_id = request.args.get('id') event = EventsCollection.getSingleEvent(event_id) return render_template('event.html', event=event, user=user)
def editEvent(self, event, n_name, n_location, n_date, n_capacity, n_price): EventsCollection.editEvent(event, n_name, n_location, n_date, n_capacity, n_price)
def deleteEvent(self, event_id): EventsCollection.deleteEvent(event_id)
def createEvent(self, event): EventsCollection.addEvent(event)
def searchEvents(self, location, name, date, event_type): events = EventsCollection.getEvents(location, name, date, event_type) return events