def METHOD_NAME(self, obj):
    obj_id = obj.id
    total = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id)
        .scalar()
    )
    draft = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id, Order.status == 'draft')
        .scalar()
    )
    cancelled = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id, Order.status == 'cancelled')
        .scalar()
    )
    pending = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id, Order.status == 'pending')
        .scalar()
    )
    expired = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id, Order.status == 'expired')
        .scalar()
    )
    placed = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id, Order.status == 'placed')
        .scalar()
    )
    completed = (
        db.session.query(func.sum(OrderTicket.quantity.label('sum')))
        .join(Order.order_tickets)
        .filter(OrderTicket.ticket_id == obj_id, Order.status == 'completed')
        .scalar()
    )
    result = {
        'total': total or 0,
        'draft': draft or 0,
        'cancelled': cancelled or 0,
        'pending': pending or 0,
        'expired': expired or 0,
        'placed': placed or 0,
        'completed': completed or 0,
    }
    return result