Arie/serveme

View on GitHub
app/views/reservations/_available_servers.html.haml

Summary

Maintainability
Test Coverage
- without_group_count = Server.active.without_group.count
- for_donators_count = Server.for_donators.active.count
- if current_user
  %h5
    Servers available
    (#{I18n.l(Time.current, :format => :time_without_seconds)} - #{I18n.l(1.hour.from_now, :format => :time_without_seconds)})
  - available_server_count = ServerForUserFinder.new(current_user, Time.current, 1.hour.from_now).servers.size
  - if current_user.donator?
    %h6 For you
    = "#{available_server_count} / #{Server.active.count}"
  - else
    .row
      .col-md-6
        %h6 For you
        = "#{available_server_count} / #{without_group_count}"
      .col-md-6
        %h6 Premium
        = "#{for_donators_count - used_donator_server_count} / #{for_donators_count}"

- else
  %h5 Servers in use
  %h6 Everyone
  = "#{used_free_server_count} / #{without_group_count}"
  servers
  %h6 Premium
  = "#{used_donator_server_count} / #{for_donators_count}"
  servers