Skip to content

Commit

Permalink
Add failures tab to flag log index
Browse files Browse the repository at this point in the history
  • Loading branch information
Undo1 committed May 16, 2017
1 parent aee94c6 commit f48f88a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/controllers/flag_log_controller.rb
Expand Up @@ -10,8 +10,11 @@ def index
@applicable_flag_logs = FlagLog.auto
end

if params[:filter] == 'fps'
@applicable_flag_logs = @applicable_flag_logs.joins(:post).where(:success => true).where(:posts => { :is_tp => false }).where('`posts`.`is_fp` = 1 OR `posts`.`is_naa` = 1')
case params[:filter]
when 'fps'
@applicable_flag_logs = @applicable_flag_logs.joins(:post).where(:success => true).where(:posts => { :is_tp => false }).where('`posts`.`is_fp` = 1 OR `posts`.`is_naa` = 1')
when "failures"
@applicable_flag_logs = @applicable_flag_logs.where(:success => false)
end

@flag_logs = @applicable_flag_logs.order('flag_logs.created_at DESC, flag_logs.id DESC').includes(:post => [:feedbacks => [:user, :api_key]]).includes(:post => [:reasons]).includes(:user).paginate(:page => params[:page], :per_page => 100)
Expand Down
1 change: 1 addition & 0 deletions app/views/flag_log/index.html.erb
Expand Up @@ -23,6 +23,7 @@
<li class="<%= 'active' if params[:user_id].to_i == current_user.id %>"><%= link_to "Mine (#{FlagLog.where(:is_auto => true, :success => true, :user => current_user).count})", flag_logs_by_user_path(:user_id => current_user.id) %></li>
<% end %>
<li class="<%= 'active' if params[:filter] == 'fps' %>"><%= link_to "False Positives", flag_logs_path(filter: 'fps') %></li>
<li class="<%= 'active' if params[:filter] == 'failures' %>"><%= link_to "Failures", flag_logs_path(filter: 'failures') %></li>
</ul>
<% end %>

Expand Down

0 comments on commit f48f88a

Please sign in to comment.