Merge branch 'szzh' into dev_hjq
This commit is contained in:
commit
e1f5ae657c
|
@ -838,7 +838,7 @@ class CoursesController < ApplicationController
|
|||
sql_select = ""
|
||||
if groupid == 0
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT AVG(student_works.final_score)
|
||||
SELECT SUM(student_works.final_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
@ -850,7 +850,7 @@ class CoursesController < ApplicationController
|
|||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT AVG(student_works.final_score)
|
||||
SELECT SUM(student_works.final_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
|
|
@ -95,9 +95,12 @@ module IssuesHelper
|
|||
elsif value == "高" || value == 3
|
||||
issuetype << "orange_btn_cir ml10"
|
||||
issuetype << "高"
|
||||
else
|
||||
elsif value == "低" || value == 1
|
||||
issuetype << "bgreen_btn_cir ml10"
|
||||
issuetype << "低"
|
||||
else
|
||||
issuetype << "red_btn_cir ml10"
|
||||
issuetype << "立刻"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -143,6 +143,10 @@ class Member < ActiveRecord::Base
|
|||
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
|
||||
end
|
||||
|
||||
def student_work_score_sum
|
||||
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def validate_role
|
||||
|
|
|
@ -700,12 +700,12 @@ class CoursesService
|
|||
latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] }
|
||||
# 课程学霸 学生总分数排名靠前的5个人
|
||||
homework_count = course.homework_commons.count
|
||||
sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
|
||||
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score limit 0,4"
|
||||
sql = "select users.*,ROUND(sum(student_works.final_score),2) score from student_works left outer join users on student_works.user_id = users.id" <<
|
||||
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score desc limit 0,4"
|
||||
better_students = User.find_by_sql(sql)
|
||||
# 找出在课程讨论区发帖回帖数最多的
|
||||
active_students = []
|
||||
sql1 = " select users.*,count(author_id) active_count from messages " <<
|
||||
sql1 = " select users.*,count(author_id)*2 active_count from messages " <<
|
||||
" LEFT JOIN users on messages.author_id = users.id " <<
|
||||
" where messages.board_id in (select id from boards where boards.course_id = #{course.id} ) " <<
|
||||
" GROUP BY messages.author_id ORDER BY count(author_id) desc " <<
|
||||
|
@ -734,10 +734,9 @@ class CoursesService
|
|||
user_list = []
|
||||
max_size = 0
|
||||
if params[:type] == 1
|
||||
homework_count = Course.find(params[:course_id]).homework_commons.count
|
||||
|
||||
sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
|
||||
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score limit #{page*10},10"
|
||||
sql = "select users.*,ROUND(sum(student_works.final_score),2) score from student_works left outer join users on student_works.user_id = users.id" <<
|
||||
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score desc limit #{page*10},10"
|
||||
sql_count = " select count(distinct(student_works.user_id) ) " <<
|
||||
" from student_works left outer join users on student_works.user_id = users.id " <<
|
||||
" where homework_common_id in " <<
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
<p style="float:left;color:#ff5722;"> :</p>
|
||||
|
||||
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:360px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
<% if topic.course_editable_by?(User.current) %>
|
||||
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;
|
||||
margin-right: 10px;"><%= l(:button_edit) %></a>
|
||||
|
|
|
@ -35,14 +35,14 @@
|
|||
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
|
||||
<div class="talkmain_txt fl mt5 f14">
|
||||
<% author = topic.author.to_s %>
|
||||
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
|
||||
<div style="max-width:80px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
|
||||
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl f14",:title=>author,
|
||||
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
|
||||
:style=>'max-width:80px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
|
||||
</div>
|
||||
<p style="float:left;color:#ff5722;"> :</p>
|
||||
|
||||
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
<div style="float:right;max-width:110px;">
|
||||
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:390px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
|
||||
<% if topic.editable_by?(User.current) %>
|
||||
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
|
||||
<% end %>
|
||||
|
@ -90,7 +90,7 @@
|
|||
// }
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="project_board_content break_word f14" id="content_<%=topic.id%>">
|
||||
<div id="contentmessage<%=topic.id %>" class="upload_img">
|
||||
|
|
|
@ -1,53 +1,56 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<% if journals.size > 0 %>
|
||||
<% for journal in journals %>
|
||||
<div class="ping_C" id='word_li_<%= journal.id.to_s %>'>
|
||||
<div class="ping_dispic">
|
||||
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
|
||||
</div>
|
||||
<div class="ping_discon upload_img" style="width: 610px;">
|
||||
<div class="ping_distop f14">
|
||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||
<% if journals.size > 0 %>
|
||||
<% for journal in journals %>
|
||||
<div class="ping_C" id='word_li_<%= journal.id.to_s %>'>
|
||||
<div class="ping_dispic">
|
||||
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
|
||||
</div>
|
||||
<div class="ping_discon upload_img" style="width: 610px;">
|
||||
<div class="ping_distop f14">
|
||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||
<span>
|
||||
<%= link_to User.current.member_of_course?(@course) ? "#{journal.user.show_name}(#{journal.user.login})" : "#{journal.user.login}", user_path(journal.user),:class => 'c_blue fb fl mb10 f14', :target => "_blank"%>
|
||||
<%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:class => 'c_blue fb fl mb10 f14', :target => "_blank"%>
|
||||
</span>
|
||||
<span class="c_grey fr f14">
|
||||
<%= format_time(journal.created_on) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<%= journal.notes.html_safe %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ping_disfoot f14">
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
|
||||
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
|
||||
:class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% if reply_allow %>
|
||||
<%#= link_to l(:label_bid_respond_quote),'',
|
||||
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
|
||||
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<% if reply_allow %>
|
||||
<div id='<%= ids %>' class="respond-form">
|
||||
<%= render :partial => 'words/new_respond_course', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true , :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<%= journal.notes.html_safe %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="ping_disfoot f14">
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
|
||||
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<%= link_to(l(:label_bid_respond_delete),
|
||||
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
|
||||
:class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% if reply_allow %>
|
||||
<%#= link_to l(:label_bid_respond_quote),'',
|
||||
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
|
||||
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<% if reply_allow %>
|
||||
<div id='<%= ids %>' class="respond-form">
|
||||
<%= render :partial => 'words/new_respond_course', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true, :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><span class="c_blue03 w280">作业积分(平均分)</span><span class="c_red w70"><%= @member_score.student_work_score_avg %></span></li>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= @member_score.student_work_score_sum %></span></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -13,20 +13,14 @@
|
|||
</div>
|
||||
<div class="recall_con f14">
|
||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||
<% if User.current.member_of_course?(@course) %>
|
||||
<%= link_to User.current.member_of_course?(@course)? "#{reply.user.show_name}(#{reply.user.login})" : "#{reply.user.login}" , user_path(reply.user) %>
|
||||
<%= l(:label_reply_to)%>
|
||||
<% if show_name %>
|
||||
<%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %>
|
||||
<% else %>
|
||||
<%#= 之所以改成这样是因为觉得没有真实姓名的用“匿名用户”替换不合理 %>
|
||||
<%= link_to "#{parent_jour.user}", user_path(parent_jour.user) %>
|
||||
<% end %>
|
||||
<%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %>
|
||||
<%= l(:label_reply_to)%>
|
||||
<% if show_name %>
|
||||
<%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %>
|
||||
<% else %>
|
||||
<%= link_to "#{reply.user}", user_path(reply.user) %>
|
||||
<%= l(:label_reply_to)%>
|
||||
<%= link_to "#{parent_jour.user}", user_path(parent_jour.user) %>
|
||||
<%= l(:label_anonymous) %>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= reply.notes.html_safe %>
|
||||
</p>
|
||||
|
@ -34,17 +28,17 @@
|
|||
<span class="c_grey fl">
|
||||
<%= format_time reply.created_on %>
|
||||
</span>
|
||||
<div class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
|
||||
<% if User.current.admin? || reply.user.id == User.current.id || allow_delete%>
|
||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% if reply_allow %>
|
||||
<%#= link_to l(:button_reply),'',
|
||||
<div class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
|
||||
<% if User.current.admin? || reply.user.id == User.current.id || allow_delete%>
|
||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% if reply_allow %>
|
||||
<%#= link_to l(:button_reply),'',
|
||||
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
|
||||
<%= link_to l(:button_reply),'javascript:;',{:nhname=>"reply_btn"} %>
|
||||
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
|
||||
</div>
|
||||
<%= link_to l(:button_reply),'javascript:;',{:nhname=>"reply_btn"} %>
|
||||
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id='<%=id%>' class="respond-form">
|
||||
<% if reply_allow %>
|
||||
|
|
|
@ -45,7 +45,7 @@ a:hover.subnav_green{ background:#14ad5a;}
|
|||
/*简介*/
|
||||
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
|
||||
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
|
||||
.project_board_content{overflow: hidden;max-height: 182px;word-break: break-all;word-wrap: break-word;}
|
||||
.project_board_content{overflow: hidden;max-height: 212px;word-break: break-all;word-wrap: break-word;}
|
||||
.project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;}
|
||||
.course_description_none{max-height: none;}
|
||||
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
|
||||
|
|
|
@ -49,7 +49,7 @@ a:hover.subnav_green{ background:#14ad5a;}
|
|||
/*简介*/
|
||||
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
|
||||
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
|
||||
.project_board_content{overflow: hidden;max-height: 182px;word-break: break-all;word-wrap: break-word;}
|
||||
.project_board_content{overflow: hidden;max-height: 212px;word-break: break-all;word-wrap: break-word;}
|
||||
.project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;}
|
||||
.course_description_none{max-height: none;}
|
||||
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
|
||||
|
|
Loading…
Reference in New Issue