用户列表排序问题、项目得分不一致问题

This commit is contained in:
z9hang 2014-08-15 17:43:10 +08:00
parent 2b6a376d31
commit 746022506d
3 changed files with 7 additions and 7 deletions

View File

@ -295,8 +295,8 @@ class UsersController < ApplicationController
# 活跃度排序, 就是所谓的得分情况 # 活跃度排序, 就是所谓的得分情况
@s_type = 1 @s_type = 1
@users = scope. @users = scope.
joins("LEFT JOIN user_scores ON users.id = user_scores.user_id"). joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1").
reorder('user_scores.active DESC') reorder('option_numbers.total_score DESC')
when '2' when '2'
# 粉丝数排序 # 粉丝数排序
@s_type = 2 @s_type = 2
@ -308,8 +308,8 @@ class UsersController < ApplicationController
# 默认活跃度排序 # 默认活跃度排序
@s_type = 1 @s_type = 1
@users = scope. @users = scope.
joins("LEFT JOIN user_scores ON users.id = user_scores.user_id"). joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1").
reorder('user_scores.active DESC') reorder('option_numbers.total_score DESC')
end end
# limit and offset # limit and offset

View File

@ -54,7 +54,7 @@
<div id="sidebar"> <div id="sidebar">
<div class="spaceleft"> <div class="spaceleft">
<div class="inf_user_image"> <div class="inf_user_image">
<% @project = Project.find_by_id(@project.id)%> <% #@project = Project.find_by_id(@project.id)%>
<table> <table>
<tr> <tr>
<td><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td> <td><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
@ -66,7 +66,7 @@
<% if @project.project_type == 0 %> <% if @project.project_type == 0 %>
<%= l(:label_project_grade)%> : <%= l(:label_project_grade)%> :
<%= link_to(format("%.2f" , project_scores(@project) ).to_i, {:controller => 'projects', <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score', :action => 'show_projects_score',
:remote => true, :remote => true,
:id => @project.id :id => @project.id

View File

@ -79,7 +79,7 @@
<span class='font_lighter' title ='<%=project.short_description%>'><%=project.description.truncate(100, omission: '...')%></span> <span class='font_lighter' title ='<%=project.short_description%>'><%=project.description.truncate(100, omission: '...')%></span>
</div> </div>
<div > <div >
<%= content_tag "span", l(:label_project_score)+ ":" + project_scores(project).to_s, <%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s,
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;", :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip", :class => "tooltip",