# HG changeset patch # User Chris Cannam # Date 1358874230 0 # Node ID 6676c0284df2fed8dca96ec5267dab9d877d435a # Parent d67ed1030451cca6322edbe078f8273c8cb37732 Add "mature projects" box. This isn't good enough on its own, it's just a test -- we need this to inform other relationships diff -r d67ed1030451 -r 6676c0284df2 app/helpers/projects_helper.rb --- a/app/helpers/projects_helper.rb Tue Jan 22 16:54:14 2013 +0000 +++ b/app/helpers/projects_helper.rb Tue Jan 22 17:03:50 2013 +0000 @@ -295,4 +295,12 @@ end phash end + + def mature_projects(count) + phash = all_maturity_scores + scores = phash.values.sort + threshold = scores[scores.length / 2] + if threshold == 0 then threshold = 1 end + phash.keys.select { |k| phash[k] > threshold }.sample(count) + end end diff -r d67ed1030451 -r 6676c0284df2 app/views/projects/explore.html.erb --- a/app/views/projects/explore.html.erb Tue Jan 22 16:54:14 2013 +0000 +++ b/app/views/projects/explore.html.erb Tue Jan 22 17:03:50 2013 +0000 @@ -6,9 +6,9 @@ <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> +

<%= l(:label_explore_projects) %>

+ <% cache(:action => 'explore', :action_suffix => 'tags', :expires_in => 1.hour) do %> - -

<%= l(:label_explore_projects) %>

<%=l(:label_project_tags_all)%>

<%= render :partial => 'projects/tagcloud' %> @@ -37,4 +37,10 @@ <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }, :class => 'more' %>
<% end %> + <% cache(:action => 'explore', :action_suffix => 'mature_projects', :expires_in => 1.hour) do %> +
+

<%=l(:label_projects_mature)%>

+ <%= render :partial => 'projects/mature' %> +
+ <% end %>