membershipworks: Show non-member ticket count in event registrations view
This commit is contained in:
parent
a5cc2cce25
commit
f33aa314b6
@ -66,7 +66,8 @@ class EventTable(tables.Table):
|
|||||||
|
|
||||||
|
|
||||||
class EventRegistrationsTable(tables.Table):
|
class EventRegistrationsTable(tables.Table):
|
||||||
ticket_count = tables.Column(empty_values=())
|
total_ticket_count = tables.Column(empty_values=())
|
||||||
|
non_member_ticket_count = tables.Column("Non-Member ticket count", empty_values=())
|
||||||
name = tables.Column(accessor="Full name")
|
name = tables.Column(accessor="Full name")
|
||||||
email = tables.EmailColumn(accessor="Email")
|
email = tables.EmailColumn(accessor="Email")
|
||||||
phone = tables.Column(accessor="Phone")
|
phone = tables.Column(accessor="Phone")
|
||||||
@ -76,14 +77,18 @@ class EventRegistrationsTable(tables.Table):
|
|||||||
)
|
)
|
||||||
emergency_contact_relation = tables.Column(accessor="Emergency Contact Relation:")
|
emergency_contact_relation = tables.Column(accessor="Emergency Contact Relation:")
|
||||||
|
|
||||||
def render_ticket_count(self, record):
|
def render_total_ticket_count(self, record):
|
||||||
return sum(int(v) for k, v in record.items() if k.startswith("Ticket: "))
|
return sum(int(v) for k, v in record.items() if k.startswith("Ticket: "))
|
||||||
|
|
||||||
|
def render_non_member_ticket_count(self, record):
|
||||||
|
# TODO: this is somewhat brittle
|
||||||
|
return sum(int(v) for k, v in record.items() if k == "Ticket: CMS Non-Members")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
row_attrs = {
|
row_attrs = {
|
||||||
"class": lambda table, record: (
|
"class": lambda table, record: (
|
||||||
""
|
""
|
||||||
if table.render_ticket_count(record) > 0
|
if table.render_total_ticket_count(record) > 0
|
||||||
else "text-decoration-line-through table-danger"
|
else "text-decoration-line-through table-danger"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user