<% if @competitions.count > 0 %>
<% @competitions.each do |competition| %>
<% if competition.status? %>
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
<%= [competition.name, competition.sub_title.presence].compact.join('——') %>
<% if competition.start_time > Time.now %>
<% unless competition.enroll_end_time.present? && competition.enroll_end_time < Time.now %>
报名中
<% else %>
即将开始
<% end %>
<% elsif competition.end_time < Time.now %>
已结束
<% else %>
<% max_min_stage = max_min_stage_time competition %>
<% if max_min_stage.count == 1 %>
距离结束还剩<%= how_much_day competition.end_time %>
<% else %>
<% max_min_stage.each do |stage| %>
<% if stage.min_start_time > Time.now %>
<%= stage.competition_stage.name %>即将开始
<% break %>
<% elsif stage.max_end_time > Time.now %>
<%= stage.competition_stage.name %>正在进行
<% break %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= format_date competition.start_time %> ~ <%= com_end_date competition.end_time %>
<%= competition.visits %>
<% if competition.member_count > 0 %>
<%= competition.identifier == "hn" ? 1125 : competition.member_count %>
<% end %>
<% elsif competition.published_at.present? %>
<% end %>
<% end %>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>