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>
36 lines
686 B
Ruby
36 lines
686 B
Ruby
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
|