internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: fossasia/open-event-server

Issue:
Events not displaying ticket information on events overview page
The events overview page on https://eventyay.com/events/ is missing ticketing info on newer events.

![screenshot from 2017-02-23 17-29-26](https://cloud.githubusercontent.com/assets/1583873/23253048/11a8d4c8-f9ee-11e6-8204-05eb70a3c70a.png)



Discussion:

Resolving patch:
diff --git a/app/helpers/ticketing.py b/app/helpers/ticketing.py
--- a/app/helpers/ticketing.py
+++ b/app/helpers/ticketing.py
@@ -91,7 +91,8 @@ def get_ticket_stats(event):
                 'total': ticket.quantity,
                 'completed': 0
             }
-        orders = Order.query.filter_by(event_id=event.id).filter_by(status='completed').all()
+        orders = Order.query.filter_by(event_id=event.id).filter(
+            or_(Order.status == 'completed', Order.status == 'placed')).all()
         for order in orders:
             for order_ticket in order.tickets:
                 tickets_summary[str(order_ticket.ticket_id)]['completed'] += order_ticket.quantity


Test patch:
Repository: fossasia/open-event-server

Issue:
Missing comma error in  static.py 



Discussion:

Resolving patch:
diff --git a/app/helpers/static.py b/app/helpers/static.py
--- a/app/helpers/static.py
+++ b/app/helpers/static.py
@@ -153,7 +153,7 @@
 }
 PAYMENT_COUNTRIES = {
     'United States',
-    'Albania'
+    'Albania',
     'Argentina',
     'Australia',
     'Austria',


Test patch:
Repository: fossasia/open-event-server

Issue:
Schedule: On click show more info
On clicking on the schedule sessions currently only limited information is displayed. Please show more info here:
* Start time and End time
* Short abstract (up to 500 characters)
* Speaker info (up to 500 characters)

 ![screenshot from 2017-02-27 01-00-24](https://cloud.githubusercontent.com/assets/1583873/23344507/b1af5eac-fcb8-11e6-9939-746e1e3cfcad.png)



Discussion:
I want to work on this. :)
@Achint08 please proceed

Resolving patch:
diff --git a/app/api/sessions.py b/app/api/sessions.py
--- a/app/api/sessions.py
+++ b/app/api/sessions.py
@@ -38,6 +38,8 @@
     'name': fields.String(),
     'organisation': fields.String(),
     'city': fields.String(),
+    'short_biography': fields.String(),
+    'long_biography': fields.String(),
     'heard_from': fields.String(),
     'speaking_experience': fields.String(),
     'sponsorship_required': fields.String()


Test patch:
Repository: fossasia/open-event-server

Issue:
Email option to send email to speaker not working as expected
There is an email option with a blue button and a mail sign on the accepted sessions, e.g. https://eventyay.com/events/6/sessions/

Currently there is no email window that opens, when the user clicks on the button.

![screenshot from 2017-02-27 17-01-00](https://cloud.githubusercontent.com/assets/1583873/23354971/7c2a0ad8-fd0e-11e6-80e6-c1fd3b891ed8.png)

Expected behavior is: An email windows opens, where the user can send a message to the speaker.



Discussion:
I would like to work on this issue.

Resolving patch:
diff --git a/app/views/users/sessions.py b/app/views/users/sessions.py
--- a/app/views/users/sessions.py
+++ b/app/views/users/sessions.py
@@ -176,7 +176,9 @@ def reject_session(event_id, session_id):
 @can_accept_and_reject
 def send_emails_session(event_id, session_id):
     session = get_session_or_throw(session_id)
-    trigger_session_state_change_notifications(session, event_id)
+    message = request.form.get('message', None) if request.form else None
+    subject = request.form.get('subject', None) if request.form else None
+    trigger_session_state_change_notifications(session, event_id, message=message, subject=subject)
     return redirect(url_for('.index_view', event_id=event_id))
 
 


Test patch:
Repository: fossasia/open-event-server

Issue:
Ticket "Check in" on web form does not work. Shows "error"
The checkin on the web system used to be possible. Trying out the feature show "Error saving".

![screenshot from 2017-03-07 22-14-12](https://cloud.githubusercontent.com/assets/1583873/23660183/91435502-0383-11e7-8ec0-4c4aa9bc6691.png)



Discussion:

Resolving patch:
diff --git a/app/helpers/ticketing.py b/app/helpers/ticketing.py
--- a/app/helpers/ticketing.py
+++ b/app/helpers/ticketing.py
@@ -114,7 +114,7 @@ def get_max_orders_count(event_id, type='free'):
     def get_attendee(event_id, attendee_id):
         holder = None
         if represents_int(attendee_id):
-            holder = TicketHolder.query.get(id)
+            holder = TicketHolder.query.get(attendee_id)
             if holder.ticket.event_id != event_id:
                 return None
         else:


Test patch:
Repository: fossasia/open-event-server

Issue:
Inactive Promo Code still working
There is the option of making promo codes inactive in the table view. If the user does it, the code shows "inactive" in the table, but actually on the ticket page the promo code still works.

At the moment the only option is to delete the promo code.

![screenshot from 2017-03-08 00-45-36](https://cloud.githubusercontent.com/assets/1583873/23667414/baf852de-0398-11e7-97ed-8487406588bb.png)



Discussion:
I would like to work on this.


Resolving patch:
diff --git a/app/views/public/ticketing.py b/app/views/public/ticketing.py
--- a/app/views/public/ticketing.py
+++ b/app/views/public/ticketing.py
@@ -40,7 +40,7 @@ def create_order():
 def apply_promo():
     discount = TicketingManager.get_discount_code(request.form.get('event_id'), request.form.get('promo_code', ''))
     access_code = TicketingManager.get_access_code(request.form.get('event_id'), request.form.get('promo_code', ''))
-    if discount and access_code:
+    if discount and access_code and discount.is_active:
         return jsonify({
             'discount_type': discount.type,
             'discount_amount': discount.value,
@@ -49,7 +49,7 @@ def apply_promo():
             'access_code_ticket': access_code.tickets,
             'discount_code_ticket': discount.tickets,
         })
-    elif discount:
+    elif discount and discount.is_active:
         return jsonify({
             'discount_type': discount.type,
             'discount_amount': discount.value,


Test patch:
Repository: fossasia/open-event-server

Issue:
Tracks Page does not show additional info
Sessions on the tracks page are supposed to show additional info on clicking on the specific session (similar to web app and sessions view). Currently the area does not expand on clicking it.

![screenshot from 2017-02-26 15-00-30](https://cloud.githubusercontent.com/assets/1583873/23338266/c753ccac-fc40-11e6-9f53-779db90f2f4a.png)



Discussion:
Issue is not solved entirely yet. Please implement in similar way to Webapp:

1. Not expanded version

![screenshot from 2017-03-05 19-03-16](https://cloud.githubusercontent.com/assets/1583873/23586737/889870da-01d6-11e7-851d-3f487a66ab33.png)

2. Expanded version

![screenshot from 2017-03-05 19-03-40](https://cloud.githubusercontent.com/assets/1583873/23586738/91d374ba-01d6-11e7-976a-30cc5cf7b2f0.png)

I can try to solve this issue if @SaptakS is not currently working on this issue :)
@Princu7 I think @SaptakS has other open issues and already solved the expansion part. So, please go ahead.
@Princu7 the expansion part is already done. All you need to do is arrange and put all the relevant information on expanding.
@saptakS Okay. I will try to fill in the rest of the work. Thanks!!
@SaptakS @niranjan94  I am able to access most of the required properties of the speaker though `sessionRefObject.session.speakers` object in the `scheduler.js` file. It contains fields like `name`, `Organization` but doesn't contain the other required fields like `short_biography` and `photo`. Please guide how can I access those fields or from where I can populate them. Thanks!!
@Princu7 About speaker info, please have a look at the implementation of featured speakers,e.g. https://eventyay.com/e/45da88b7/#feat-speakers. 
@mariobehling Thanks. Featured speakers pages directly use the event object passed to it. The schedule page requests data from the API itself. The other info fields of speakers like `short_biography` and `photo` were not defined in the object returned from the API and hence were not present. Adding them to the API should correct the problem :)

Resolving patch:
diff --git a/app/api/sessions.py b/app/api/sessions.py
--- a/app/api/sessions.py
+++ b/app/api/sessions.py
@@ -42,7 +42,10 @@
     'long_biography': fields.String(),
     'heard_from': fields.String(),
     'speaking_experience': fields.String(),
-    'sponsorship_required': fields.String()
+    'sponsorship_required': fields.String(),
+    'short_biography': fields.String(),
+    'long_biography' : fields.String(),
+    'photo' : fields.String()
 })
 
 SESSION_MICROLOCATION = api.model('SessionMicrolocation', {


Test patch:
Repository: fossasia/open-event-server

Issue:
Ticketing: More than Maximum Number of Tickets set can be bought
The system let's users buy more than the maximum number of tickets set by the organizer.

Tickets set in wizard step 1:
![screenshot from 2017-03-10 08-10-13](https://cloud.githubusercontent.com/assets/1583873/23776511/c6735d66-0569-11e7-83a3-c3fa4ddd0570.png)

Tickets sold:
![screenshot from 2017-03-10 08-11-43](https://cloud.githubusercontent.com/assets/1583873/23776518/d72ef002-0569-11e7-89df-f6b0db7036be.png)

Tickets still available on site. It should display: "Sold out".

![screenshot from 2017-03-10 08-16-43](https://cloud.githubusercontent.com/assets/1583873/23776559/febe499c-0569-11e7-8cea-89da908fa7a6.png)




Discussion:
Tickets Sold is now bigger than Ticket Capacity:

![screenshot from 2017-03-10 08-51-16](https://cloud.githubusercontent.com/assets/1583873/23777343/ebbb254a-056e-11e7-838b-6c8a5aa37a7c.png)


Resolving patch:
diff --git a/app/helpers/data_getter.py b/app/helpers/data_getter.py
--- a/app/helpers/data_getter.py
+++ b/app/helpers/data_getter.py
@@ -35,6 +35,7 @@
 from app.models.modules import Module
 from app.models.notifications import Notification
 from app.models.order import Order
+from app.models.order import OrderTicket
 from app.models.page import Page
 from app.models.panel_permissions import PanelPermission
 from app.models.permission import Permission
@@ -723,10 +724,22 @@ def get_locations_of_events():
     @staticmethod
     def get_sales_open_tickets(event_id, give_all=False):
         if give_all:
-            return Ticket.query.filter(Ticket.event_id == event_id)
-        return Ticket.query.filter(Ticket.event_id == event_id).filter(
+            tickets = Ticket.query.filter(Ticket.event_id == event_id)
+        tickets = Ticket.query.filter(Ticket.event_id == event_id).filter(
             Ticket.sales_start <= datetime.datetime.now()).filter(
             Ticket.sales_end >= datetime.datetime.now())
+        open_tickets = []
+        for ticket in tickets:
+            orders = OrderTicket.query.filter(OrderTicket.ticket_id == ticket.id)
+            ticket_count = 0
+            for order in orders:
+                ticket_count += order.quantity
+            if ticket_count >= ticket.quantity:
+                status = "Sold"
+            else:
+                status = "Available"
+            open_tickets.append({'ticket': ticket, "status": status})
+        return open_tickets
 
     @staticmethod
     def get_module():


Test patch:
Repository: fossasia/open-event-server

Issue:
Ticket is generated and sold without taking ticket holder name, email details.
Order is placed with these empty fields and tickets are generated and sold.

![screenshot 12](https://cloud.githubusercontent.com/assets/13533840/23812166/4e026282-05ff-11e7-9558-c1d268b5c5f7.png)


The JSON response for such attendees is coming as-
```
{
	"id": 359,
	"order": {
		"id": 242,
		"identifier": "7ca7b854-57d2-4399-b3b3-68a3bee8b92f",
		"paid_via": "free",
		"amount": 0.0,
		"invoice_number": "O1489178012-242",
		"status": "completed",
		"completed_at": "2017-03-10T20:33:43",
		"payment_mode": null
	},
	"email": "",
	"lastname": "",
	"firstname": "",
	"ticket": {
		"id": 187,
		"price": 0.0,
		"description": "",
		"type": "free",
		"quantity": 100,
		"name": "My Ticket"
	},
	"checked_in": false
}
```


Discussion:
@niranjan94  I am working on this 

Resolving patch:
diff --git a/app/helpers/ticketing.py b/app/helpers/ticketing.py
--- a/app/helpers/ticketing.py
+++ b/app/helpers/ticketing.py
@@ -1,7 +1,7 @@
 import uuid
 from datetime import timedelta, datetime
 
-from flask import url_for, flash
+from flask import url_for, flash, abort
 from flask.ext import login
 from sqlalchemy import desc
 from sqlalchemy import or_
@@ -373,6 +373,8 @@ def initiate_order_payment(form, paid_via=None):
                                              ticket_id=int(holders_ticket_ids[i]),
                                              email=holder_user.email,
                                              order_id=order.id)
+                if data['firstname'] == '' or data['lastname'] == '' or holder_user.email == '':
+                    return abort(400)
                 if order.status == "completed":
                     send_email_for_after_purchase(holder_user.email, invoice_id, order_url, order.event.name,
                                                   order.event.organizer_name)


Test patch:
Repository: fossasia/open-event-server

Issue:
Tickets show sold out even though capacity was increased
A few days ago the organizers increased the capacity of tickets. Now they show up as sold out even though the capacity is not reached.

![screenshot from 2017-03-12 09-58-38](https://cloud.githubusercontent.com/assets/1583873/23828388/ce9a1f78-070a-11e7-93d0-524c30318981.png)

Shows sold out.

![screenshot from 2017-03-12 10-01-21](https://cloud.githubusercontent.com/assets/1583873/23828392/e1f56ec4-070a-11e7-9468-6eee1f818808.png)



Discussion:
Would like to work on this.

Resolving patch:
diff --git a/app/helpers/data_getter.py b/app/helpers/data_getter.py
--- a/app/helpers/data_getter.py
+++ b/app/helpers/data_getter.py
@@ -733,7 +733,8 @@ def get_sales_open_tickets(event_id, give_all=False):
             orders = OrderTicket.query.filter(OrderTicket.ticket_id == ticket.id)
             ticket_count = 0
             for order in orders:
-                ticket_count += order.quantity
+                if order.order.status == 'completed' or order.order.status == 'placed':
+                    ticket_count += order.quantity
             if ticket_count >= ticket.quantity:
                 status = "Sold"
             else:
diff --git a/app/models/order.py b/app/models/order.py
--- a/app/models/order.py
+++ b/app/models/order.py
@@ -45,7 +45,7 @@ class Order(db.Model):
     event = db.relationship('Event', backref='orders')
     user = db.relationship('User', backref='orders', foreign_keys=[user_id])
     marketer = db.relationship('User', backref='marketed_orders', foreign_keys=[marketer_id])
-    tickets = db.relationship("OrderTicket")
+    tickets = db.relationship("OrderTicket", backref='order')
 
     def __init__(self,
                  identifier=None,


Test patch:
Repository: fossasia/open-event-server

Issue:
Public Schedule: Tracks Page: Very large PNGs are displayed for speaker images
The tracks page loads very large speaker images. We will have lots of users at the weekend and this might crash us.

Please use smaller jpgs here (Tracks Page): https://eventyay.com/e/45da88b7/schedule/


Discussion:

Resolving patch:
diff --git a/app/api/sessions.py b/app/api/sessions.py
--- a/app/api/sessions.py
+++ b/app/api/sessions.py
@@ -45,7 +45,10 @@
     'sponsorship_required': fields.String(),
     'short_biography': fields.String(),
     'long_biography' : fields.String(),
-    'photo' : fields.String()
+    'photo' : fields.String(),
+    'small': fields.Upload(),
+    'thumbnail': fields.Upload(),
+    'icon': fields.Upload(),
 })
 
 SESSION_MICROLOCATION = api.model('SessionMicrolocation', {
diff --git a/app/api/speakers.py b/app/api/speakers.py
--- a/app/api/speakers.py
+++ b/app/api/speakers.py
@@ -28,6 +28,9 @@
     'id': fields.Integer(required=True),
     'name': fields.String(required=True),
     'photo': fields.Upload(),
+    'small': fields.Upload(),
+    'thumbnail': fields.Upload(),
+    'icon': fields.Upload(),
     'short_biography': fields.String(),
     'long_biography': fields.String(),
     'email': fields.Email(required=True),


Test patch:
Repository: fossasia/open-event-server

Issue:
FOSSASIA Summit no longer on start page event though event is still running
Please ensure events that are still running are listed on start page until end of event, e.g. check https://eventyay.com


Discussion:
I will try to fix it :)

Resolving patch:
diff --git a/app/helpers/data_getter.py b/app/helpers/data_getter.py
--- a/app/helpers/data_getter.py
+++ b/app/helpers/data_getter.py
@@ -417,8 +417,7 @@ def get_all_published_events(include_private=False):
             events = Event.query.filter(Event.state == 'Published')
         else:
             events = Event.query.filter(Event.state == 'Published').filter(Event.privacy != 'private')
-        events = events.filter(Event.start_time >= datetime.datetime.now()).filter(
-            Event.end_time >= datetime.datetime.now()).filter(Event.in_trash == 'False')
+        events = events.filter(Event.end_time >= datetime.datetime.now()).filter(Event.in_trash == 'False')
         return events
 
     @staticmethod


Test patch:
Repository: fossasia/open-event-server

Issue:
Exported csv of Orders - name of file not suitable
The exported csv file of orders have a name that is not suitable: e.g. Orders-FOSSASIA Summit_06-Dec-2016_09_40_01.csv Please export the file using the event name only.


Discussion:
@mariobehling I will fix it.

Resolving patch:
diff --git a/app/views/users/ticket_sales.py b/app/views/users/ticket_sales.py
--- a/app/views/users/ticket_sales.py
+++ b/app/views/users/ticket_sales.py
@@ -2,6 +2,7 @@
 from flask import make_response
 
 import pycountry
+import re
 from datetime import datetime
 from flask import Blueprint
 from flask import abort, jsonify
@@ -386,7 +387,7 @@ def download_orders_as_csv(event_id):
     response = make_response(value)
     response.headers['Content-Type'] = 'text/csv'
     response.headers['Content-Disposition'] = \
-        'inline; filename=Orders-%s_%s.csv' % (event.name, event.created_at.strftime("%d-%b-%Y_%H_%M_%S"))
+        'inline; filename=%s.csv' % (re.sub(r"[^\w\s]", '', event.name).replace(" ", "_"))
 
     return response
 


Test patch:
Repository: fossasia/open-event-server

Issue:
'Register as a Speaker' takes back to the same pop up
Even on registering as speaker, user is not registered. After registration, it takes back to the same "Register as Speaker" and "Propose Session" modal. 
That is:
![screenshot from 2017-03-24 03-52-33](https://cloud.githubusercontent.com/assets/20799954/24272958/d44e61ba-1045-11e7-8973-1f207ed9a107.png)

And on clicking "Propose session", it takes to speaker_session form rather than only session form.




Discussion:

Resolving patch:
diff --git a/app/views/public/event_detail.py b/app/views/public/event_detail.py
--- a/app/views/public/event_detail.py
+++ b/app/views/public/event_detail.py
@@ -244,7 +244,7 @@ def display_event_cfs(identifier, via_hash=False):
                            accepted_sessions_count=accepted_sessions_count,
                            session_form=session_form, call_for_speakers=call_for_speakers,
                            placeholder_images=placeholder_images, state=state, speakers=speakers,
-                           via_hash=via_hash, custom_placeholder=custom_placeholder,
+                           via_hash=via_hash, custom_placeholder=custom_placeholder, user_speaker=user_speaker,
                            existing_sessions=existing_sessions)
 
 


Test patch:
Repository: fossasia/open-event-server

Issue:
Exported csv of Attendees - incomplete data, missing ticket types
the csv of Attendees must include the ticket types 


Discussion:

Resolving patch:
diff --git a/app/views/users/ticket_sales.py b/app/views/users/ticket_sales.py
--- a/app/views/users/ticket_sales.py
+++ b/app/views/users/ticket_sales.py
@@ -213,6 +213,7 @@ def display_attendees(event_id, pdf=None):
                 'completed_at': order.completed_at,
                 'created_at': order.created_at,
                 'ticket_name': holder.ticket.name,
+                'ticket_type': holder.ticket.type,
                 'firstname': holder.firstname,
                 'lastname': holder.lastname,
                 'email': holder.email,
@@ -283,7 +284,7 @@ def download_as_pdf(event_id):
 def download_as_csv(event_id):
     (event, event_id, holders, orders, ticket_names, selected_ticket) = display_attendees(event_id, pdf='print_csv')
     value = 'Order#,Order Date, Status, First Name, Last Name, Email, Payment Type,' \
-            'Ticket Price \n'
+            'Ticket Name, Ticket Price, Ticket Type \n'
 
     for holder in holders:
         if holder['status'] != "deleted":
@@ -308,9 +309,15 @@ def download_as_csv(event_id):
             if 'paid_via' in holder and holder['paid_via']:
                 value += holder['paid_via']
             value += ','
+            if 'ticket_name' in holder:
+                value += str(holder['ticket_name'])
+            value += ','
             if 'ticket_price' in holder:
                 value += str(holder['ticket_price'])
             value += ','
+            if 'ticket_type' in holder:
+                value += str(holder['ticket_type'])
+            value += ','
             value += '\n'
 
     response = make_response(value)


Test patch:
Repository: fossasia/open-event-server

Issue:
Sales tab in Admin section gives error message
Clicking on sales tab results in error message in admin section.

![screenshot from 2017-03-24 18-30-32](https://cloud.githubusercontent.com/assets/1583873/24314399/1fd291c2-10c0-11e7-9d78-64327b59e521.png)



Discussion:

Resolving patch:
diff --git a/app/views/super_admin/sales.py b/app/views/super_admin/sales.py
--- a/app/views/super_admin/sales.py
+++ b/app/views/super_admin/sales.py
@@ -336,9 +336,9 @@ def sales_by_events_view(path):
             tickets_summary_event_wise[str(event.id)]['discount_code'] = \
                 str(event.discount_code.value) + '% off for ' + str(event.discount_code.max_quantity) + ' months'
 
-        tickets_summary_organizer_wise[str(organizer.user.id)] = \
-            copy.deepcopy(tickets_summary_event_wise[str(event.id)])
         if organizer:
+            tickets_summary_organizer_wise[str(organizer.user.id)] = \
+                copy.deepcopy(tickets_summary_event_wise[str(event.id)])
             tickets_summary_organizer_wise[str(organizer.user.id)]['name'] = organizer.user.email
 
         tickets_summary_location_wise[unicode(event.searchable_location_name)] = \


Test patch: