Billing Stripe, link regia mobile e staff solo trasmissione.
Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
35
backend/app/services/teams/staff_coverage.rb
Normal file
35
backend/app/services/teams/staff_coverage.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
module Teams
|
||||
class StaffCoverage
|
||||
def initialize(team)
|
||||
@team = team
|
||||
end
|
||||
|
||||
def assigned_count(_kind = "transmission")
|
||||
members_count + pending_invitations_count
|
||||
end
|
||||
|
||||
def covered_count(_kind = "transmission")
|
||||
assigned_count.positive? ? 1 : 0
|
||||
end
|
||||
|
||||
def role_label_for(membership)
|
||||
return "Trasmissione" if membership.staff_kind.present?
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
def open_slot_for_invite?(_kind = "transmission")
|
||||
assigned_count < 1
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def members_count
|
||||
@team.user_teams.where.not(staff_kind: nil).count
|
||||
end
|
||||
|
||||
def pending_invitations_count
|
||||
@team.team_invitations.pending.count
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user