remove janitor trial report
This commit is contained in:
@@ -3,10 +3,6 @@ class ReportsController < ApplicationController
|
|||||||
before_filter :gold_only, :only => [:similar_users]
|
before_filter :gold_only, :only => [:similar_users]
|
||||||
before_filter :moderator_only, :only => [:post_versions, :post_versions_create]
|
before_filter :moderator_only, :only => [:post_versions, :post_versions_create]
|
||||||
|
|
||||||
def janitor_trials
|
|
||||||
@report = Reports::JanitorTrials.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def contributors
|
def contributors
|
||||||
@report = Reports::Contributors.new
|
@report = Reports::Contributors.new
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
module Reports
|
|
||||||
class JanitorTrials
|
|
||||||
class Janitor
|
|
||||||
attr_reader :user
|
|
||||||
|
|
||||||
def initialize(user)
|
|
||||||
@user = user
|
|
||||||
end
|
|
||||||
|
|
||||||
def trial
|
|
||||||
JanitorTrial.where(user_id: user.id).first
|
|
||||||
end
|
|
||||||
|
|
||||||
def created_at
|
|
||||||
trial.try(:created_at) || 10.years.ago
|
|
||||||
end
|
|
||||||
|
|
||||||
def since
|
|
||||||
3.months.ago
|
|
||||||
end
|
|
||||||
|
|
||||||
def approval_count
|
|
||||||
@approval_count ||= Post.where("approver_id = ? and created_at >= ?", user.id, since).count
|
|
||||||
end
|
|
||||||
|
|
||||||
def percentile_25_score
|
|
||||||
ActiveRecord::Base.select_value_sql("select percentile_cont(0.25) within group (order by score) from posts where created_at >= ? and approver_id = ?", since, user.id).to_i
|
|
||||||
end
|
|
||||||
|
|
||||||
def percentile_50_score
|
|
||||||
ActiveRecord::Base.select_value_sql("select percentile_cont(0.50) within group (order by score) from posts where created_at >= ? and approver_id = ?", since, user.id).to_i
|
|
||||||
end
|
|
||||||
|
|
||||||
def deletion_chance
|
|
||||||
hits = Post.where("approver_id = ? and created_at >= ? and is_deleted = true", user.id, since).count
|
|
||||||
total = Post.where("approver_id = ? and created_at >= ?", user.id, since).count
|
|
||||||
Reports::UserPromotions.ci_lower_bound(hits, total, 0.95).to_i
|
|
||||||
end
|
|
||||||
|
|
||||||
def neg_score_chance
|
|
||||||
hits = Post.where("approver_id = ? and created_at >= ? and score < 0", user.id, since).count
|
|
||||||
total = Post.where("approver_id = ? and created_at >= ?", user.id, since).count
|
|
||||||
Reports::UserPromotions.ci_lower_bound(hits, total, 0.95).to_i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def janitors
|
|
||||||
User.where("bit_prefs & ? > 0", User.flag_value_for("can_approve_posts")).to_a.map {|x| Janitor.new(x)}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<div id="c-reports">
|
|
||||||
<div id="a-user-promotions">
|
|
||||||
<h1>Janitor Trial Report</h1>
|
|
||||||
|
|
||||||
<p>All numbers shown are for the past 3 months. Binomial proportion confidence interval for how likely a janitor's approvals will achieve a score of at at least n with 95% confidence. Most statistics are not significant unless there are at least 300 approvals.</p>
|
|
||||||
|
|
||||||
<table width="100%" class="striped" id="sortable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th data-sort="string">User</th>
|
|
||||||
<th data-sort="int">Age</th>
|
|
||||||
<th data-sort="int">Level</th>
|
|
||||||
<th data-sort="int">Approvals</th>
|
|
||||||
<th data-sort="int">Del Chance</th>
|
|
||||||
<th data-sort="int">Neg Score Chance</th>
|
|
||||||
<th data-sort="int" title="25% of approvals received this score or less">Quartile Score</th>
|
|
||||||
<th data-sort="int" title="50% of approvals received this score or less">Median Score</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% @report.janitors.each do |janitor| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= link_to_user janitor.user %></td>
|
|
||||||
<td data-sort-value="<%= janitor.created_at.to_i %>"><%= time_ago_in_words(janitor.created_at) %></td>
|
|
||||||
<td data-sort-value="<%= janitor.user.level %>"><%= janitor.user.level_string %></td>
|
|
||||||
<td><%= link_to janitor.approval_count, posts_path(:tags => "approver:#{janitor.user.name} order:random", :limit => 200) %></td>
|
|
||||||
<td><%= link_to janitor.deletion_chance, posts_path(:tags => "approver:#{janitor.user.name} status:deleted", :limit => 200) %></td>
|
|
||||||
<td><%= link_to janitor.neg_score_chance, posts_path(:tags => "approver:#{janitor.user.name} score:<0", :limit => 200) %></td>
|
|
||||||
<td><%= janitor.percentile_25_score %></td>
|
|
||||||
<td><%= janitor.percentile_50_score %></td>
|
|
||||||
<td>
|
|
||||||
<% if CurrentUser.user.is_moderator? && janitor.trial && janitor.trial.active? %>
|
|
||||||
<%= link_to "Promote", promote_janitor_trial_path(janitor.trial), :method => :put, :remote => true %>
|
|
||||||
| <%= link_to "Demote", demote_janitor_trial_path(janitor.trial), :method => :put, :remote => true %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
|
||||||
Janitor Trial Report - <%= Danbooru.config.app_name %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= content_for(:html_header) do %>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
$("#sortable").stupidtable().on("aftertablesort", function() {
|
|
||||||
$("#sortable tbody tr:even").removeClass("odd").addClass("even");
|
|
||||||
$("#sortable tbody tr:odd").removeClass("even").addClass("odd");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<% end %>
|
|
||||||
@@ -230,7 +230,6 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
resources :artist_commentary_versions, :only => [:index]
|
resources :artist_commentary_versions, :only => [:index]
|
||||||
resource :related_tag, :only => [:show, :update]
|
resource :related_tag, :only => [:show, :update]
|
||||||
get "reports/janitor_trials" => "reports#janitor_trials"
|
|
||||||
get "reports/contributors" => "reports#contributors"
|
get "reports/contributors" => "reports#contributors"
|
||||||
get "reports/uploads" => "reports#uploads"
|
get "reports/uploads" => "reports#uploads"
|
||||||
get "reports/similar_users" => "reports#similar_users"
|
get "reports/similar_users" => "reports#similar_users"
|
||||||
|
|||||||
Reference in New Issue
Block a user