tweaked user promotion formula
This commit is contained in:
@@ -16,7 +16,7 @@ module Reports
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.confidence_interval_for(user, n)
|
def self.confidence_interval_for(user, n)
|
||||||
up_votes = Post.where("created_at >= ?", min_time).where(:uploader_id => user.id).where("fav_count >= ?", n).count
|
up_votes = Post.where("created_at >= ?", min_time).where(:is_deleted => false, :uploader_id => user.id).where("score >= ?", n).count
|
||||||
total_votes = Post.where("created_at >= ?", min_time).where(:uploader_id => user.id).count
|
total_votes = Post.where("created_at >= ?", min_time).where(:uploader_id => user.id).count
|
||||||
ci_lower_bound(up_votes, total_votes, 0.95)
|
ci_lower_bound(up_votes, total_votes, 0.95)
|
||||||
end
|
end
|
||||||
@@ -36,7 +36,7 @@ module Reports
|
|||||||
end
|
end
|
||||||
|
|
||||||
def users
|
def users
|
||||||
::User.where("users.level < ? and users.post_upload_count >= 100", ::User::Levels::CONTRIBUTOR).order("created_at desc").limit(50).map {|x| Reports::UserPromotions::User.new(x)}
|
::User.where("users.level < ? and users.post_upload_count >= 150", ::User::Levels::CONTRIBUTOR).order("created_at desc").limit(50).map {|x| Reports::UserPromotions::User.new(x)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div id="a-user-promotions">
|
<div id="a-user-promotions">
|
||||||
<h1>User Promotion Confidence Intervals</h1>
|
<h1>User Promotion Confidence Intervals</h1>
|
||||||
|
|
||||||
<p>Binomial proportion confidence interval for how likely a user's uploads will achieve a fav count of at at least n with 95% confidence within the past 30 days.</p>
|
<p>Binomial proportion confidence interval for how likely a user's uploads will achieve a score of at at least n with 95% confidence within the past 30 days.</p>
|
||||||
|
|
||||||
<table width="100%" class="striped" id="sortable">
|
<table width="100%" class="striped" id="sortable">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<th data-sort="int">Level</th>
|
<th data-sort="int">Level</th>
|
||||||
<th data-sort="int">Uploads</th>
|
<th data-sort="int">Uploads</th>
|
||||||
<th data-sort="string">Age</th>
|
<th data-sort="string">Age</th>
|
||||||
<th data-sort="int">score:1+</th>
|
|
||||||
<th data-sort="int">score:5+</th>
|
<th data-sort="int">score:5+</th>
|
||||||
<th data-sort="int">score:10+</th>
|
<th data-sort="int">score:10+</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -19,15 +18,16 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% cache("user-promotions-report/#{Date.today}") do %>
|
<% cache("user-promotions-report/#{Date.today}") do %>
|
||||||
<% @report.users.each do |user| %>
|
<% @report.users.each do |user| %>
|
||||||
<tr>
|
<% if user.confidence_interval_for(5) > 0 %>
|
||||||
<td><%= link_to user.name, user_path(user.user) %></td>
|
<tr>
|
||||||
<td data-sort-value="<%= user.level %>"><%= user.level_string %></td>
|
<td><%= link_to user.name, user_path(user.user) %></td>
|
||||||
<td><%= user.post_upload_count %></td>
|
<td data-sort-value="<%= user.level %>"><%= user.level_string %></td>
|
||||||
<td data-sort-value="<%= user.created_at.to_formatted_s(:db) %>"><%= time_ago_in_words user.created_at %></td>
|
<td><%= user.post_upload_count %></td>
|
||||||
<td><%= number_to_percentage user.confidence_interval_for(1), :precision => 0 %></td>
|
<td data-sort-value="<%= user.created_at.to_formatted_s(:db) %>"><%= time_ago_in_words user.created_at %></td>
|
||||||
<td><%= number_to_percentage user.confidence_interval_for(5), :precision => 0 %></td>
|
<td><%= number_to_percentage user.confidence_interval_for(5), :precision => 0 %></td>
|
||||||
<td><%= number_to_percentage user.confidence_interval_for(10), :precision => 0 %></td>
|
<td><%= number_to_percentage user.confidence_interval_for(10), :precision => 0 %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user