积分规则

This commit is contained in:
huang 2016-03-06 12:15:57 +08:00
parent 4f2937e1a2
commit d30e73795d
3 changed files with 41 additions and 35 deletions

View File

@ -856,7 +856,10 @@ module CoursesHelper
end
def contributor_course_scor(course_id)
ccs = CourseContributorScore.where("course_id =?", course_id).order("total_score desc") .limit(9)
puts "########################################################{course_id}"
ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by
(message_num*2 + message_reply_num + news_reply_num + news_num +
resource_num*5 + journal_num + homework_journal_num ) desc limit 9;")
end
end

View File

@ -142,9 +142,11 @@
<div class="cl"></div>
<% unless contributor_course_scor(@course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度<a style="float: right; color: #7f7f7f; font-size: 12px;" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4>
<div style="display: none" class="numIntro">
<div style="font-size: 14px;color: #3b3b3b">积分规则</div>
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a>
</h4>
<div style="display: none;padding: 5px;" class="numIntro color_888">
<div class="contributor_course_innor">积分规则</div>
资源发布:资源数 x 5 </br>
问答发布:发帖数 x 2 </br>
通知发布:通知数 x 1 </br>
@ -166,38 +168,34 @@
<p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p>
<div style="display: none" class="numIntro">
<!--<div style="display: none" class="message_title_red system_message_style">-->
<!--<p><strong>评论对象:</strong><%#= ma.course_message.commented.title %></p>-->
<!--<%# unless ma.course_message.comments.nil? %>-->
<!--<div class="fl"><strong>评论内容:</strong></div>-->
<!--<div class="ml60"><%#= ma.course_message.comments.html_safe %></div>-->
<!--<%# end %>-->
<!--</div>-->
<div style="padding-left: 65px; font-size: 14px;color: #3b3b3b">积分计算</div>
<div style="display: none" class="numIntro color_888">
<div class="contributor_course_calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %>
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
<%# end %>
总得分:<%=total_score %>
<%# end %>
总得分:<%=total_score %>
</div>
</div>
</li>
<% end %>
@ -210,9 +208,9 @@
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
<h4><span>课程英雄榜</span>
<a style="float: right; color: #7f7f7f; font-size: 12px;" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4>
<div style="display: none" class="numIntro">
<div style="font-size: 13px;color: #3b3b3b">积分规则</div>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4>
<div style="display: none" class="numIntro color_888">
<div class="hero_course_innor">积分规则</div>
英雄榜的得分是每个同学作业的得分总和
</div>
<% hero_homework_scores.each do |student_score| %>

View File

@ -1285,3 +1285,8 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}
a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: normal;}
.contributor_course_innor{font-size: 12px;color: #888;padding-left: 36px;}
.hero_course_innor{font-size: 12px;color: #888;padding-left:77px;}
.contributor_course_calculate{padding-left: 54px; font-size: 12px;color: #888}
.color_888{color: #888}