diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index e73c779a..1a42a9c6 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -28,6 +28,8 @@ class CompetitionsController < ApplicationController competitions = Competition.where('status = 1 or published_at is not null') case params[:category] + when 'nearly_published' then + competitions = competitions.where('published_at is not null AND status = 0') when 'progressing' then competitions = competitions.where('end_time > NOW()') when 'ended' then diff --git a/app/views/competitions/index.html.erb b/app/views/competitions/index.html.erb index 36743613..44607ef8 100644 --- a/app/views/competitions/index.html.erb +++ b/app/views/competitions/index.html.erb @@ -3,6 +3,8 @@
<%= link_to '全部', competitions_path(category: ''), remote: true, class: "fl mr20 font-16 bestChoose shixun_repertoire #{params[:category].blank? ? 'active' : ''}" %> + <%= link_to '即将发布', competitions_path(category: 'nearly_published'), remote: true, + class: "fl mr20 font-16 bestChoose shixun_repertoire #{params[:category] == 'nearly_published' ? 'active' : ''}" %> <%= link_to '进行中', competitions_path(category: 'progressing'), remote: true, class: "fl mr20 font-16 bestChoose shixun_repertoire #{params[:category] == 'progressing' ? 'active' : ''}" %> <%= link_to '往期比赛', competitions_path(category: 'ended'), remote: true,