Repository: fossasia/open-event-server

Issue:
Ticket Attendees Page: Discount and ticket if 0.00 info not displayed
The ticket overview attendees page does not display:
* discount codes
* ticket cost if 0.00 show "Free"

![screenshot from 2017-03-12 01-29-43](https://cloud.githubusercontent.com/assets/1583873/23825379/a3aaea78-06c3-11e7-87a4-46264686a83a.png)



Discussion:
@mariobehling 
I forgot to update in the attendees page , while solving issue #3332 . Will do it soon.
@mariobehling 
I got this :
![image](https://cloud.githubusercontent.com/assets/17861054/23962312/af1fcf0a-09d3-11e7-95fc-709e79846696.png)

But I have some doubts regarding code :

In the file '**app/views/users/ticket_sales.py**'
`if len(order.ticket_holders) == 0:` **(Line 218)**
Where does this attribute *ticket_holders* come from or am I missing something ?
Cause in **order.py** , model there is none:
```
class Order(db.Model):
    __tablename__ = "orders"

    id = db.Column(db.Integer, primary_key=True)
    identifier = db.Column(db.String, unique=True)
    amount = db.Column(db.Float)
    address = db.Column(db.String)
    city = db.Column(db.String)
    state = db.Column(db.String)
    country = db.Column(db.String)
    zipcode = db.Column(db.String)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='SET NULL'))
    event_id = db.Column(db.Integer, db.ForeignKey('events.id', ondelete='SET NULL'))
    marketer_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='SET NULL'))
    created_at = db.Column(db.DateTime)
    completed_at = db.Column(db.DateTime, nullable=True, default=None)
    trashed_at = db.Column(db.DateTime, nullable=True, default=None)
    transaction_id = db.Column(db.String)
    paid_via = db.Column(db.String)
    payment_mode = db.Column(db.String)
    brand = db.Column(db.String)
    exp_month = db.Column(db.Integer)
    exp_year = db.Column(db.Integer)
    last4 = db.Column(db.String)
    stripe_token = db.Column(db.String)
    paypal_token = db.Column(db.String)
    status = db.Column(db.String)

    discount_code_id = db.Column(
        db.Integer, db.ForeignKey('discount_codes.id', ondelete='SET NULL'), nullable=True, default=None)
    discount_code = db.relationship('DiscountCode', backref='orders')

    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", backref='order')

    def __init__(self,
```

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
@@ -216,7 +216,8 @@ def display_attendees(event_id, pdf=None):
                 'firstname': holder.firstname,
                 'lastname': holder.lastname,
                 'email': holder.email,
-                'ticket_price': holder.ticket.price
+                'ticket_price': holder.ticket.price,
+                'discount': discount
             }
 
             if order.status == 'completed':


Test patch: