Compare commits
2 Commits
1889ee7fb2
...
8103629370
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8103629370 | ||
|
|
dce5d0af12 |
@@ -76,6 +76,9 @@ class Event < ApplicationRecord
|
||||
tickets.active.sum(:price_cents)
|
||||
end
|
||||
|
||||
# Alias for template compatibility
|
||||
alias_method :total_earnings_cents, :total_gross_cents
|
||||
|
||||
def total_fees_cents
|
||||
earnings.pending.sum(:fee_cents)
|
||||
end
|
||||
@@ -88,6 +91,11 @@ class Event < ApplicationRecord
|
||||
event_ended? && (net_earnings_cents > 0) && user.is_professionnal? && payouts.pending.empty?
|
||||
end
|
||||
|
||||
# Get the latest payout for this event
|
||||
def payout
|
||||
payouts.order(created_at: :desc).first
|
||||
end
|
||||
|
||||
# Check if coordinates were successfully geocoded or are fallback coordinates
|
||||
def geocoding_successful?
|
||||
coordinates_look_valid?
|
||||
|
||||
@@ -147,8 +147,8 @@ completed_event = Event.find_or_create_by!(name: "Completed Music Festival") do
|
||||
e.featured = false
|
||||
e.image = "https://data.bizouk.com/cache1/events/images/10/78/87/b801a9a43266b4cc54bdda73bf34eec8_700_800_auto_97.jpg"
|
||||
e.user = completed_event_promoter
|
||||
# Ensure payout status is not_requested
|
||||
e.payout_status = :not_requested
|
||||
# Ensure payout status is pending_request
|
||||
e.payout_status = :pending_request
|
||||
end
|
||||
|
||||
# Create ticket types for the completed event
|
||||
|
||||
Reference in New Issue
Block a user