1.修改判断当前用户是不是为课程老师的方法
2.增加作业综评功能 3.其他课程的学生是不能互评的,只有本门课程的学生可以互评 4.修改添加评论方法 5.修复当作业无人评论时,作业最终得分只显示一个分字
This commit is contained in:
parent
12b1553a33
commit
27a30d44be
|
@ -102,11 +102,12 @@ class HomeworkAttachController < ApplicationController
|
|||
percent_m.to_s + "%"
|
||||
end
|
||||
@limit = 10
|
||||
@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation is null").order("created_on DESC")
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC")
|
||||
end
|
||||
|
||||
#删除留言
|
||||
|
@ -127,13 +128,14 @@ class HomeworkAttachController < ApplicationController
|
|||
#添加留言
|
||||
def addjours
|
||||
@homework = HomeworkAttach.find(params[:jour_id])
|
||||
@homework.addjours User.current.id, params[:new_form][:user_message],0
|
||||
@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
|
||||
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation is null").order("created_on DESC")
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -145,6 +145,27 @@ module BidsHelper
|
|||
people.include?(User.current)
|
||||
end
|
||||
|
||||
# 当前用户是否加入了此课程(包括教师)
|
||||
def is_cur_course_user? bid
|
||||
people = []
|
||||
#people << bid.author
|
||||
course = bid.courses.first
|
||||
course.members.each do |member|
|
||||
people << member.user
|
||||
end
|
||||
people.include?(User.current)
|
||||
end
|
||||
#当前用户是不是指定课程的学生
|
||||
def is_cur_course_student? course
|
||||
people = []
|
||||
course.members.each do |member|
|
||||
if [5,10].include? member.roles.first.id
|
||||
people << member.user
|
||||
end
|
||||
end
|
||||
people.include?(User.current)
|
||||
end
|
||||
|
||||
# def select_option_helper option
|
||||
# tmp = Hash.new
|
||||
# option.each do |project|
|
||||
|
|
|
@ -137,14 +137,24 @@ module CoursesHelper
|
|||
Course.find_by_extra(try(extra))
|
||||
end
|
||||
#判断制定用户是不是当前课程的老师
|
||||
def is_course_teacher user,project
|
||||
is_teacher = false
|
||||
searchTeacherAndAssistant(project).each do |teacher|
|
||||
if user == teacher
|
||||
is_teacher = true
|
||||
break
|
||||
def is_course_teacher user,course
|
||||
people = []
|
||||
course.members.each do |member|
|
||||
role_id = member.roles.first.id
|
||||
if TeacherRoles.include? role_id
|
||||
people << member.user
|
||||
end
|
||||
end
|
||||
is_teacher
|
||||
people.include?(user)
|
||||
end
|
||||
#当前用户是不是指定课程的学生
|
||||
def is_cur_course_student? course
|
||||
people = []
|
||||
course.members.each do |member|
|
||||
if StudentRoles.include? member.roles.first.id
|
||||
people << member.user
|
||||
end
|
||||
end
|
||||
people.include?(User.current)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,8 +13,8 @@ class HomeworkAttach < ActiveRecord::Base
|
|||
"user_id"
|
||||
acts_as_attachable
|
||||
|
||||
def addjours user_id,message,status = 0
|
||||
jfm = self.journals_for_messages.build(:user_id => user_id,:notes =>message,:status => status)
|
||||
def addjours user_id,message,status = 0,is_comprehensive_evaluation = 0
|
||||
jfm = self.journals_for_messages.build(:user_id => user_id,:notes =>message,:status => status,:is_comprehensive_evaluation => is_comprehensive_evaluation)
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<!-- fq -->
|
||||
<% is_teacher = is_course_teacher User.current,@bid.courses.first.project %>
|
||||
<% is_student = is_cur_course_student? @bid.courses.first %>
|
||||
<% is_teacher = is_course_teacher User.current,@bid.courses.first %>
|
||||
|
||||
<%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
|
||||
<div class="project-search-block">
|
||||
<table width="100%" valign="center">
|
||||
|
@ -44,8 +46,12 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td style="vertical-align: top">
|
||||
<% if display_id %>
|
||||
<% if is_student %>
|
||||
<%= link_to "互评>>" , homework_attach_path(homework)%>
|
||||
<% else %>
|
||||
<% if is_teacher %>
|
||||
<%= link_to "综评>>" , homework_attach_path(homework)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -71,7 +77,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<% if display_id %>
|
||||
<% if is_cur_course_user? @bid %>
|
||||
<strong><%= l(:label_bidding_user_studentcode) %> : <%= homework.user.user_extensions.student_id%></strong>
|
||||
<% end %>
|
||||
</td>
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
:url => {:controller => 'homework_attach',
|
||||
:action => 'addjours',
|
||||
:jour_id => homework_attach.id,
|
||||
:is_comprehensive_evaluation => is_comprehensive_evaluation,
|
||||
:sta => sta}) do |f|%>
|
||||
|
||||
<div id = 'pre_show'>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<% is_teacher = is_course_teacher User.current,homework.bid.courses.first %>
|
||||
<% if comprehensive_evaluation != nil && comprehensive_evaluation.count > 0 %>
|
||||
<% stars = homework.rates(:quality).where("rater_id = #{comprehensive_evaluation.first.user.id}").select("stars").first.stars * 2 * 10 %>
|
||||
<div style="height: 100px; padding-bottom: 10px">
|
||||
<div style="font-size: 15px">
|
||||
<strong>作业综评:</strong>
|
||||
<span class="user" style="font-size: 15px">
|
||||
<div data-kls="HomeworkAttach" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled"
|
||||
style="height: 15px; width: 100px; overflow: hidden; z-index: 1; position: relative;">
|
||||
<div class="jRatingColor" style="width: <%=stars %>%;"></div>
|
||||
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
|
||||
<div class="jStar" style="width: 115px; height: 20px; top: -40px;
|
||||
background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<div style="font-size: 14px;">
|
||||
<div style="margin-left: 20px;margin-bottom: 10px;margin-top: 10px;"> <%= comprehensive_evaluation.first.notes%> </div>
|
||||
</div>
|
||||
<% if is_teacher %>
|
||||
<div style="text-align: center;">评分:
|
||||
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if is_teacher %>
|
||||
<div style="height: 200px; padding-bottom: 10px">
|
||||
<div style="font-size: 15px">
|
||||
<strong>作业综评:</strong>
|
||||
</div>
|
||||
<div style="text-align: center;">评分:
|
||||
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
||||
</div>
|
||||
<div>
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => homework, :sta => 0,:is_comprehensive_evaluation => 1} %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div style="height: 80px; padding-bottom: 10px">
|
||||
<div style="font-size: 15px">
|
||||
<strong>作业综评:</strong>
|
||||
</div>
|
||||
<div style="text-align: center;font-size: 15px;color: #15BCCC;vertical-align:middle;padding-top: 15px; "><strong>老师还未进行评价!</strong></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -38,10 +38,25 @@
|
|||
<% if jour.size > 0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in jour%>
|
||||
<% seems = homework.rates(:quality).where("rater_id = #{journal.user.id}").select("stars").first %>
|
||||
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||
<span class="body">
|
||||
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||
<span class="user" style="font-size: 15px">
|
||||
<%= link_to journal.user, user_path(journal.user)%>
|
||||
<!--
|
||||
<% if seems != nil %>
|
||||
<div data-kls="HomeworkAttach" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled"
|
||||
style="height: 15px; width: 100px; overflow: hidden; z-index: 1; position: relative;">
|
||||
<div class="jRatingColor" style="width: <%=seems.stars * 2 * 10 %>%;"></div>
|
||||
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
|
||||
<div class="jStar" style="width: 115px; height: 20px; top: -40px;
|
||||
background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
-->
|
||||
</span>
|
||||
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
|
||||
<div> <%= textilizable journal.notes%> </div>
|
||||
<span class="font_lighter"><%= l(:label_bids_published) %>
|
||||
|
@ -71,3 +86,11 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
|
||||
<!--分页-->
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%= pagination_links_full @feedback_pages %>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,4 +1,9 @@
|
|||
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>');
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||
$('#new_form_user_message').val("");
|
||||
$('#new_form_reference_user_id').val("");
|
||||
<% if @add_jour.is_comprehensive_evaluation == 1 %>
|
||||
$('#comprehensive_evaluation').html('<%= escape_javascript(render(:partial => 'comprehensive_evaluation',
|
||||
:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} )) %>');
|
||||
<% else %>
|
||||
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||
$('#new_form_user_message').val("");
|
||||
$('#new_form_reference_user_id').val("");
|
||||
<% end %>
|
|
@ -6,6 +6,9 @@
|
|||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
<% is_student = is_cur_course_student? @homework.bid.courses.first %>
|
||||
<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %>
|
||||
|
||||
<p id="notice"><%= notice %></p>
|
||||
<!-- <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> -->
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
|
@ -93,10 +96,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div style="float: left; padding-left: 100px; padding-top:35px ">
|
||||
<% score = @homework.average(:quality).try(:avg).try(:round, 2).to_s %>
|
||||
<div style="text-align: center">最终得分</div>
|
||||
<div style="padding-top: 1px; font-size: 15px; color: blue;text-align: center">
|
||||
<%= @homework.average(:quality).try(:avg).try(:round, 2).to_s %>
|
||||
分
|
||||
<% if score == "" %>
|
||||
0分
|
||||
<% else %>
|
||||
<%= score %>分
|
||||
<% end %>
|
||||
</div>
|
||||
<div style="padding-top: 3px">
|
||||
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
|
||||
|
@ -114,42 +121,32 @@
|
|||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<!--
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<div style="font-size: 15px">
|
||||
<strong>作业综评:</strong>
|
||||
</div>
|
||||
<div style="text-align: center;">评分:
|
||||
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
|
||||
</div>
|
||||
<!-- 作业综评 -->
|
||||
<div id="comprehensive_evaluation">
|
||||
<%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} %>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
-->
|
||||
|
||||
<div class="underline-contests_one"></div>
|
||||
<div style="height: 50px">
|
||||
<div style="font-size: 15px"><strong>作业评论:</strong></div>
|
||||
<% if is_student %>
|
||||
<div style="text-align: center;">评分:
|
||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if !is_teacher %>
|
||||
<!--提示登录后对应用进行评价-->
|
||||
<div id='leave-message'>
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0} %>
|
||||
<div id="leave-message">
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- 留言列表区 -->
|
||||
<div id="message" style="font-size: 14px;">
|
||||
<%= render :partial => 'showjour', :locals => {:jour => @jour} %>
|
||||
</div>
|
||||
|
||||
<!--分页-->
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%= pagination_links_full @feedback_pages %>
|
||||
</ul>
|
||||
<%= render :partial => 'showjour', :locals => {:jour => @jour,:homework => @homework} %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddColoumToHomeworkJournalsForMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :journals_for_messages, :is_comprehensive_evaluation, :integer
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue