Merge branch 'develop' into rep_quality

This commit is contained in:
huang 2016-10-13 09:00:35 +08:00
commit edf2a059e8
55 changed files with 723 additions and 153 deletions

View File

@ -26,7 +26,7 @@ class FilesController < ApplicationController
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description]
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description, :edit_file_description]
helper :sort
include SortHelper
@ -981,6 +981,13 @@ class FilesController < ApplicationController
def upload_files_menu
end
def edit_file_description
@attachment = Attachment.find(params[:id])
@attachment.description = params[:file_description_edit]
@attachment.save
end
def update_file_description
@attachment = Attachment.find(params[:id])
@attachment.description = params[:description]

View File

@ -146,7 +146,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_group = @homework.homework_detail_group
@homework_detail_group.min_num = params[:min_num].to_i if params[:min_num]
@homework_detail_group.max_num = params[:max_num].to_i if params[:max_num]
@homework_detail_group.base_on_project = params[:base_on_project].to_i if params[:base_on_project]
@homework_detail_group.base_on_project = params[:base_on_project] ? 1 : 0
end
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
@ -202,24 +202,24 @@ class HomeworkCommonController < ApplicationController
if @homework_detail_manual.comment_status == 1
student_works = @homework.student_works.has_committed
if student_works && student_works.size >= 2
if @homework.homework_type == 3
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
student_work_projects.each_with_index do |pro_work, pro_index|
n = @homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
work_index = -1
student_works.each_with_index do |stu_work, stu_index|
if stu_work.id.to_i == pro_work.student_work_id.to_i
work_index = stu_index
end
end
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
else
# if @homework.homework_type == 3
# student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
# student_work_projects.each_with_index do |pro_work, pro_index|
# n = @homework_detail_manual.evaluation_num
# n = n < student_works.size ? n : student_works.size - 1
# work_index = -1
# student_works.each_with_index do |stu_work, stu_index|
# if stu_work.id.to_i == pro_work.student_work_id.to_i
# work_index = stu_index
# end
# end
# assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
# assigned_homeworks.each do |h|
# student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
# student_works_evaluation_distributions.save
# end
# end
# else
student_works.each_with_index do |work, index|
user = work.user
n = @homework_detail_manual.evaluation_num
@ -230,7 +230,7 @@ class HomeworkCommonController < ApplicationController
student_works_evaluation_distributions.save
end
end
end
#end
@homework_detail_manual.update_column('comment_status', 2)
@homework_detail_manual.update_column('evaluation_start', Date.today)
@statue = 1
@ -255,11 +255,28 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.update_column('evaluation_end', Date.today)
#计算缺评扣分
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
if @homework.homework_type != 3
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
if student_work.absence_penalty != 0
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = @homework.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
st_work.update_attribute("absence_penalty", student_work.absence_penalty)
end
end
end
end
# 匿评关闭消息邮件通知
send_message_anonymous_comment(@homework, m_status = 3)
Mailer.send_mail_anonymous_comment_close(@homework).deliver

View File

@ -102,7 +102,7 @@ class SubDocumentCommentsController < ApplicationController
@subdomain = @document.sub_domain
@org_subfield = @subdomain.org_subfield
@organization = @org_subfield.organization
@act = OrgActivity.find(params[:id])
@act = OrgActivity.find(params[:act_id])
@comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:sub_content]
@document.children << @comment

View File

@ -45,12 +45,12 @@ class SyllabusMemberController < ApplicationController
member = SyllabusMember.find(params[:id])
@syllabus = member.syllabus
members = @syllabus.syllabus_members
if params[:opr] == 'up' && member.rank > 2
if params[:opr] == 'up' && member.rank > 1
before_mem = members.where("rank = #{member.rank - 1}").first
if before_mem && member.update_attribute('rank', member.rank - 1)
before_mem.update_attribute('rank', before_mem.rank + 1)
end
elsif params[:opr] == 'down' && member.rank > 1 && member.rank < members.count
elsif params[:opr] == 'down' && member.rank < members.count
after_mem = members.where("rank = #{member.rank + 1}").first
if after_mem && member.update_attribute('rank', member.rank + 1)
after_mem.update_attribute('rank', after_mem.rank - 1)

View File

@ -33,6 +33,8 @@ class SyllabusesController < ApplicationController
@syllabus.user_id = User.current.id
@syllabus.description = Message.where("id = 19412").first.nil? ? '' : Message.where("id = 19412").first.content
if @syllabus && @syllabus.save
member = SyllabusMember.create(:user_id => @syllabus.user_id, :rank => 1)
@syllabus.syllabus_members << member
respond_to do |format|
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to syllabus_path(@syllabus)}

View File

@ -2280,6 +2280,8 @@ module ApplicationHelper
candown = true
elsif attachment.container.class.to_s=="Memo" #论坛资源允许下载
candown = true
elsif attachment.container.class.to_s=="Syllabus" #论坛资源允许下载
candown = true
elsif attachment.container.class.to_s == "User"
candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id)
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
@ -2829,7 +2831,7 @@ module ApplicationHelper
link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 && work.user_id == User.current.id #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
@ -3578,7 +3580,9 @@ def get_group_member_names work
end
def course_syllabus_option user = User.current
syllabuses = user.syllabuses
syllabus_members = SyllabusMember.where("user_id = #{user.id}")
syllabus_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|mem| mem.syllabus_id}.join(',') + ")"
syllabuses = Syllabus.where("id in #{syllabus_ids}")
type = []
option1 = []
option1 << "请选择课程"

View File

@ -41,7 +41,7 @@ class Attachment < ActiveRecord::Base
validates :filename, presence: true, length: {maximum: 254}
validates :author, presence: true
validates :disk_filename, length: {maximum: 254}
validates :description, length: {maximum: 254}
# validates :description, length: {maximum: 254}
validate :validate_max_file_size
#elasticsearch

View File

@ -24,7 +24,7 @@ class Course < ActiveRecord::Base
end
end
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
@ -96,7 +96,9 @@ class Course < ActiveRecord::Base
'class_period',
'open_student',
'is_delete',
'syllabus_id'
'syllabus_id',
'end_time',
'end_term'
acts_as_customizable

View File

@ -1,6 +1,6 @@
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品
class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time, :late_penalty, :absence_penalty
belongs_to :homework_common
belongs_to :user

View File

@ -853,6 +853,13 @@ class User < Principal
OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0
end
def member_of_syl?(syllabus)
if !self.logged?
return false
end
SyllabusMember.where("user_id =? and syllabus_id =?", self.id, syllabus.id).count > 0
end
def admin_of_org?(org)
if self.admin?
return true

View File

@ -418,7 +418,7 @@ class CoursesService
course.send(:safe_attributes=, params[:course], current_user)
#course.safe_attributes = params[:course]
#course.password = params[:course][:password]
course.syllabus_id = params[:syllabus_id].to_i
#course.syllabus_id = params[:syllabus_id].to_i
course.time = params[:time]
course.term = params[:term]
course.end_time = params[:end_time]

View File

@ -32,8 +32,9 @@
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>
<span><%=@course.syllabus.title %></span>
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>

View File

@ -43,8 +43,10 @@
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_org_subfield_file_path(file.container,file)%>','<%= file.id %>');"><%= file.description %></textarea>
<%= form_tag(edit_file_description_org_subfield_file_path(file, :org_subfield_id => org_subfield.id ),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
<div class="fontGrey2 mb4">
@ -108,3 +110,8 @@
<%end%>
<% end%>
<script>
function commit_files_description(id) {
$(id).submit();
}
</script>

View File

@ -40,8 +40,10 @@
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_project_file_path(project,file)%>','<%= file.id %>');"><%= file.description %></textarea>
<%= form_tag(edit_file_description_project_file_path(file, :project_id => project.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
<div class="fontGrey2 mb4">
@ -70,6 +72,11 @@
<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
</ul>
<script>
function commit_files_description(id) {
$(id).submit();
}
</script>

View File

@ -42,8 +42,10 @@
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_course_file_path(@course,file)%>','<%= file.id %>');"><%= file.description %></textarea>
<%= form_tag(edit_file_description_course_file_path(file, :course_id => @course.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
<div class="fontGrey2 mb4">
@ -100,3 +102,8 @@
</div>
</div>
<div class="cl"></div>
<script>
function commit_files_description(id) {
$(id).submit();
}
</script>

View File

@ -0,0 +1,3 @@
$("#file_description_show_<%= @attachment.id %>").html("<%= escape_javascript render(:partial => "files/file_description", :locals => {:file => @attachment}) %>");
$("#file_description_show_<%= @attachment.id %>").show();
$("#file_description_edit_<%= @attachment.id %>").hide();

View File

@ -35,5 +35,5 @@
<% end %>
<% else %>
<%= render :partial => "layouts/no_content" %>
<%#= render :partial => "layouts/no_content" %>
<% end %>

View File

@ -158,6 +158,8 @@ function cookieget(n)
})
</script>
<% forum = Forum.where(:id => 1).first %>
<% unless forum.nil? %>
<div class="scrollsidebar" id="scrollsidebar" style="float: right">
<div class="side_content">
<div class="side_list">
@ -189,4 +191,5 @@ function cookieget(n)
<a href="#" class="closeSidebar"></a>
</div>
</div>
<% end %>
</body>

View File

@ -4,7 +4,10 @@
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="https://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_recruitment_information)%></a>|</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
<select class="languageBox">

View File

@ -4,7 +4,8 @@
<li class="fl"><a href="<%= about_us_path %>" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<% if hidden_unproject_infos %>
<% memo = Memo.where(:id => 1168).first %>
<% if hidden_unproject_infos && !memo.nil? %>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>

View File

@ -1,5 +1,7 @@
<%= javascript_include_tag "feedback" %>
<% forum = Forum.where(:id => 1).first %>
<% unless forum.nil? %>
<div class="scrollsidebar" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
@ -49,3 +51,4 @@
</div>
</div>
</div>
<% end %>

View File

@ -14,9 +14,12 @@
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr30">
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
</li>
<% end %>
<% else %>
<li class="navHomepageMenu fl mr40">
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>

View File

@ -14,10 +14,13 @@
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr30">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="fl" id="navHomepageSearch">

View File

@ -1,5 +1,6 @@
<%= javascript_include_tag "feedback" %>
<% forum = Forum.where(:id => 1).first %>
<% unless forum.nil? %>
<div class="scrollsidebar pr" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
@ -49,3 +50,4 @@
</div>
</div>
</div>
<% end %>

View File

@ -2,7 +2,10 @@
<ul>
<li ><a href="<%= about_us_path %>" target="_blank" class="" >关于我们<span>|</span></a></li>
<li ><a href="<%= agreement_path %>" target="_blank" class="" >服务协议<span>|</span></a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li ><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="" >帮助中心<span>|</span></a></li>
<% end %>
<li ><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="" > 贴吧交流</a></li>
<div class="cl"></div>
</ul>

View File

@ -3,7 +3,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>

View File

@ -7,9 +7,12 @@
<!--<li class="navHomepageMenu fl mr40">-->
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
<!--</li>-->
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
</li>
<% end %>
</ul>
</div>
<script>

View File

@ -152,7 +152,10 @@
<ul class="footerAbout">
<li class="fl"><a href="<%= about_us_path %>" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
<li class="fl"><a href="<%= agreement_path %>" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
<% end %>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank">贴吧交流</a></li>
</ul>
</div>

View File

@ -172,8 +172,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>
<div class="sn-address">地 址湖南省长沙市开福区东风路89号观园大厦23层<br />

View File

@ -406,7 +406,10 @@
<ul>
<li><a href="<%= about_us_path %>" target="_blank" class="fl">关于我们</a></li>
<li><a href="<%= agreement_path %>" target="_blank" class="fl"> 服务协议 </a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="fl">帮助中心</a></li>
<% end %>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="fl"> 贴吧交流</a></li>
</ul>
<div class="cl"></div>

View File

@ -106,7 +106,10 @@
<ul class="footerAbout">
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
<% end %>
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
</ul>
</div>

View File

@ -166,13 +166,13 @@
<% else%>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user.id)%>" class=" f14 c_blue02">
TA的课程
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.visible.count%>)</span>
</a>
</div>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_projectlist',:id=>@user.id)%>" class=" f14 c_blue02">
TA的项目
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.visible.count%>)</span>
</a>

View File

@ -3,7 +3,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>

View File

@ -1,6 +1,6 @@
<% if @polls.empty? %>
alert('您目前其他课程无问卷可导入');
alert('您的其它班级下没有问卷可供导入');
<% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');

View File

@ -77,7 +77,11 @@
<%= render :partial => 'dir_list' %>
<% end %>
<% memo = Memo.where(:id => 1232).first %>
<% unless memo.nil? %>
<a href="<%= Setting.protocol + "://" %><%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
<% end %>
<div class="fr">
<a style="color: #7f7f7f;">导出统计结果:</a>
<%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "week" } %> <a style="color: #7f7f7f;">|</a>

View File

@ -33,7 +33,7 @@
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work, :index => i}%>
<tr>
<td colspan="12">
<div id="about_hwork_<%= student_work.id%>">
<div id="about_hwork_<%= student_work.id%>" class="about_hwork">
</div>
</td>
</tr>

View File

@ -1,9 +1,9 @@
<div class="syllabus_courses_box">
<% @stundet_works.each_with_index do |student_work, i| %>
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default;">
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default; background-color:#f6f6f6;">
<%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
</div>
<div id="about_hwork_<%= student_work.id %>"></div>
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div>
<div id="group_member_work_<%= student_work.id%>">
<%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>

View File

@ -4,22 +4,22 @@
<div class="syllabus_class_w fontGrey3 student_work_<%= st.id%>" style="<%=!is_expand ? '' : 'cursor: pointer;' %>" <%= !is_expand ? '' : "onclick = "+"show_student_work('"+"#{student_work_path(st)}"+"')" %>>
<%= link_to(image_tag(url_to_avatar(st.user),:width =>"40",:height => "40", :style => "display:block;"),user_activities_path(st.user), :class => "fl") %>
<% if !is_expand %>
<span class="fl student_work_<%= st.id%>" style="width:135px;">
<span class="fl hidden ml5" style="max-width:90px;"><%= st.user.show_name %></span>
<span class="fl student_work_<%= st.id%>" style="width:105px;">
<span class="fl hidden ml5" style="max-width:60px;"><%= st.user.show_name %></span>
<span class="fl">(组长)</span>
</span>
<span class="fl mr15 hidden student_work_<%= st.id%>" style="width:90px;">
<span class="fl hidden student_work_<%= st.id%>" style="width:90px; margin-right:3px;">
<span class="fontGrey2">学号</span><%= st.user.user_extensions.nil? ? "--" : st.user.user_extensions.student_id%>
</span>
<% else %>
<span class="fl student_work_<%= st.id%>" style="width:135px;">
<span class="fl hidden ml5" style="max-width:90px;"><%= st.user.show_name %></span>
<span class="fl student_work_<%= st.id%>" style="width:105px;">
<span class="fl hidden ml5" style="max-width:60px;"><%= st.user.show_name %></span>
</span>
<span class="fl student_work_<%= st.id%> mr15 hidden" style="width:90px;">
<span class="fl student_work_<%= st.id%> hidden" style="width:90px; margin-right:3px;">
<span class="fontGrey2">学号</span><%= st.user.user_extensions.nil? ? "--" : st.user.user_extensions.student_id%>
</span>
<% end %>
<div class="flex-container fl" style="width:365px;">
<div class="flex-container fl" style="width:376px;">
<div class="flex-cell"><span class="<%= score_color st.teacher_score%> ml35"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
<div class="flex-cell"><span class="<%= score_color st.teaching_asistant_score%> ml35"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
<% if @homework.anonymous_comment == 0 %>
@ -47,9 +47,6 @@
<div class="flex-cell">
<% score = st.work_score %>
<div class="<%= score_color score%> student_final_scor_info ml35 pr" style="display: inline">
<% if is_expand %>
<span style="position: absolute;top: -33px; color: #3b94d6; white-space:nowrap;" onclick = "show_student_work(<%= student_work_path(st)%>)">评分</span>
<% end %>
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="g_infoNi none width180" style="line-height: 18px;">
@ -70,6 +67,9 @@
</div>
</div>
</div>
<% if is_expand %>
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px;" onclick = "show_student_work(<%= student_work_path(st)%>)">评分</div>
<% end %>
</div>
<div class="hworkTip" style="display: none; left:700px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击进行评分' %></font></div>
</li>
@ -83,4 +83,11 @@
}).mouseleave(function(){
$("#work_click_<%= st.id%>").hide();
}).mouse;
$(".syllabus_class_list").mouseenter(function(){
$(this).css("background-color","#f6fafd");
});
$(".syllabus_class_list").mouseleave(function(){
$(this).css("background-color","#fff");
});
</script>

View File

@ -1,7 +1,7 @@
<div class="sy_courses_open f14 fontGrey3">
<span class="icons_sy_open fl mr5" title="点击展开/收起详情" style="cursor: pointer;"></span>
<span class="fl" style="width:280px;">
<span class="hidden fl" style="max-width:240px;"><%=student_work.name %></span>
<span class="hidden fl" style="max-width:220px;"><%=student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
@ -9,19 +9,18 @@
</span>
</span>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<span class="ml15 fl">关联项目:</span>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "width:200px;", :title => "项目名称"%>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称"%>
<% else %>
<span class="fontBlue fl hidden" style="width:200px;" title="该项目是私有的"><%= student_work.project.name %></span>
<span class="fontBlue fr hidden" style="max-width:200px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% end %>
<span class="fr">关联项目:</span>
<% end %>
<a href="javascript:void(0)" onclick="show_student_work('<%= student_work_path(student_work)%>');" class="link-blue fr">评分</a>
<div class="cl"></div>
</div>
<div class="fl sy_p_grey">
<span class="fl" style="width:296px;">提交时间:<%=format_date(student_work.commit_time) %></span>
<div class="flex-container fl" style="width:368px;">
<span class="fl" style="width:255px;">提交时间:<%=format_date(student_work.commit_time) %></span>
<div class="flex-container fl" style="width:376px;">
<div class="flex-cell">教师:<span class="<%= score_color student_work.teacher_score%>"><%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%></span></div>
<div class="flex-cell">助教:<span class="<%= score_color student_work.teaching_asistant_score%>"><%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%></span></div>
<% if @homework.anonymous_comment == 0 %>
@ -53,15 +52,15 @@
<% unless score.nil?%>
<div class="g_infoNi none width180">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。<br/>
迟交扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
&nbsp;</span>分,
&nbsp;</span>分,<br/>
缺评扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%>
&nbsp;</span>分,
&nbsp;</span>分,<br/>
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",score<0 ? 0 : score)%>&nbsp;</span>分。
</div>
@ -69,5 +68,6 @@
</div>
</div>
</div>
<a href="javascript:void(0)" onclick="show_student_work('<%= student_work_path(student_work)%>');" class="link-blue fr ml5" style="width:28px; text-align:right;">评分</a>
</div>
<div class="cl"></div>

View File

@ -78,7 +78,7 @@
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i} %>
<tr>
<td colspan="12">
<div id="about_hwork_<%= student_work.id %>">
<div id="about_hwork_<%= student_work.id %>" class="about_hwork">
</div>
</td>
</tr>

View File

@ -2,10 +2,10 @@
<% student_work_groups = @homework.student_works.where("user_id in #{user_ids}").order("created_at asc") %>
<% anon_count = student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
<% student_work_groups.each_with_index do |st, j| %>
<div class="syllabus_class_box" id="student_work_<%= st.id%>">
<div class="syllabus_class_box" id="student_work_<%= st.id%>" style="background-color:#fff;">
<%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count} %>
</div>
<% if j != 0 %>
<div id="about_hwork_<%= st.id %>"></div>
<div id="about_hwork_<%= st.id %>" class="about_hwork"></div>
<% end %>
<% end %>

View File

@ -2,6 +2,7 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0){
$("#about_hwork_<%= @work.id%>").html("");
}
else{
$(".about_hwork").html("");
<% if @homework.homework_type == 2%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");

View File

@ -1,4 +1,4 @@
<div class="resources mt10" id="organization_document_<%= document.id %>">
<div class="resources mt10" id="organization_sub_document_comments_<%= document.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %>

View File

@ -1,2 +1,2 @@
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => @document,:flag => params[:flag], :act => @act, :organization => @organization}) %>");
$("#organization_sub_document_comments_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => @document,:flag => params[:flag], :act => @act, :organization => @organization}) %>");
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");

View File

@ -129,7 +129,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="javascript:void(0);" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="javascript:void(0);" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="javascript:void(0);" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
<li><a href="javascript:void(0);" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>

View File

@ -62,7 +62,7 @@
<% if User.current.member_of_course?(course) %>
<%=link_to '进入班级', course_path(course), :class => 'btn_orange_big fr mt5', :target => '_blank' %>
<% else %>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "btn_green_big fr mt5",:method => "post"%>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green2 fr mt5",:method => "post"%>
<% end %>
<div class="cl"></div>
</ul>
@ -75,9 +75,9 @@
</div>
</div>
<% else %>
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<% if User.current == @syllabus.user %>
<p class="sy_tab_con_p">您建立的课程还未创建班级,请
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<% if User.current.member_of_syl?(@syllabus) %>
<p class="sy_tab_con_p">课程还未创建班级,请
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_corange", :target => '_blank'%>
,谢谢啦!</p>
<% else %>

View File

@ -13,13 +13,14 @@
</tr>
</thead>
<tbody>
<% count = @members.count %>
<% @members.each_with_index do |member, i| %>
<% user = member.user %>
<% allow_delete = @syllabus.courses.where(:tea_id => member.user_id).empty? && i != 0 %>
<% allow_delete = is_admin && @syllabus.courses.where(:tea_id => member.user_id).empty? %>
<tr>
<td><%= member.rank %></td>
<td>
<% if member.rank == 1 %>
<% if user == @syllabus.user %>
<div style="display: inline-block"><span class="sy_new_name fl"><%= user.show_name %></span><span class="sy_new_orange ml5 fl mt12">创建者</span></div>
<% else %>
<span class="sy_new_long_name"><%= user.show_name %></span>
@ -35,22 +36,21 @@
<td><%= courses.where("tea_id != #{user.id}").count %></td>
<% if is_admin %>
<td>
<% if i == 0 %>
&nbsp;
<% else %>
<% if allow_delete %>
<% if user == @syllabus.user %>
<% elsif allow_delete %>
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
<% else %>
<a href="javascript:void(0)" class="fr sy_btn_grey mr5" title="该老师已在本课程下创建了班级,不能删除">删除</a>
<% end %>
<% if i == 1 %>
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
<% elsif i == @members.count - 1 %>
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
<% else %>
<% if i == 0 && count == 1 %>
&nbsp;
<% elsif i != 0 && i < count - 1 %>
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
<% end %>
<% elsif i < count - 1 %>
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
<% elsif i == count - 1 %>
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
<% end %>
</td>
<% end %>

View File

@ -13,11 +13,11 @@
<div id="sy_tab_con_3">
<div class="sy_new_tablebox clear">
<%= render :partial => 'syllabus_member_list' %>
<% if User.current == @syllabus.user %>
<% if User.current == @syllabus.user || User.current.admin? %>
<a href="javascript:void(0);" class="fl sy_btn_green" onclick="toggle_search();">添加成员</a>
<% end %>
</div>
<% if User.current == @syllabus.user %>
<% if User.current == @syllabus.user || User.current.admin? %>
<div class="sy_new_tchbox clear <%= @show == 1 ? '' : 'undis' %>" id="sy_search_box">
<%= form_tag url_for(:controller => 'syllabus_member', :action => 'create', :syllabus => @syllabus),:id => 'syllabus_member_add_form', :remote => true do |f|%>
<input hidden="hidden" value="true" name="flag">

View File

@ -5,6 +5,15 @@
$(function() {
sd_create_editor_from_data(<%= @syllabus.id %>, null, "100%", "<%= @syllabus.class.to_s %>");
showNormalImage('syllabus_description_<%= @syllabus.id %>');
$("#syllabus_description_<%= @syllabus.id%> p,#syllabus_description_<%= @syllabus.id%> span,#syllabus_description_<%= @syllabus.id%> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$(this).html(postContent);
});
autoUrl('syllabus_description_<%= @syllabus.id %>');
});
</script>
<ul id="sy_tab_nav">
@ -29,9 +38,9 @@
<div class="sy_tab_con">
<div class="syllabuscon upload_img" id="syllabus_description_<%= @syllabus.id %>">
<%=@syllabus.description.html_safe %>
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @syllabus} %>
</div>
<div class="mt10" style="font-weight:normal; font-size: 12px;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @syllabus} %>
</div>
<% if User.current.logged? && User.current == @syllabus.user%>
<div class="homepagePostSetting" style="margin:10px;">

View File

@ -5,7 +5,7 @@
<li class="resource-list-time fr">
<%= link_to "上传时间", resource_search_user_path(:type => @type, :status => @status, :sort => @score, :order => "created_on", :search => " "), :class => "fl", :remote => true %>
<% if @order == "created_on" %>
<%= link_to "", user_resource_user_path(:type => @type, :status => @status, :sort => @score, :order => "created_on", :search => " "), :class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt16", :remote => true %>
<%= link_to "", user_resource_user_path(:type => @type, :status => @status, :sort => @score, :order => "created_on", :search => " "), :class => "#{@score == 'desc' ? 'st_down' : 'st_up'} mt16", :remote => true %>
<% end %>
</li>
<!--<li class="resource-list-quote fr">-->
@ -17,14 +17,14 @@
<li class="resource-list-download fr">
<%= link_to "下载数", resource_search_user_path(:type => @type, :status => @status, :sort => @score, :order => "downloads"), :class => "fl", :remote => true %>
<% if @order == "downloads" %>
<%= link_to "", user_resource_user_path(:type => @type, :status => @status, :sort => @score, :order => "downloads"), :class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt16", :remote => true %>
<%= link_to "", user_resource_user_path(:type => @type, :status => @status, :sort => @score, :order => "downloads"), :class => "#{@score == 'desc' ? 'st_down' : 'st_up'} mt16", :remote => true %>
<% end %>
</li>
<li class="resource-list-size fr">
<div style="margin: 0 auto; width: 40px">
<%= link_to "大小", resource_search_user_path(:type => @type, :status => @status, :sort => @score, :order => "filesize"), :class => "fl", :remote => true %>
<% if @order == "filesize" %>
<%= link_to "", user_resource_user_path(:type => @type, :status => @status, :sort => @score, :order => "filesize"), :class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt16", :remote => true %>
<%= link_to "", user_resource_user_path(:type => @type, :status => @status, :sort => @score, :order => "filesize"), :class => "#{@score == 'desc' ? 'st_down' : 'st_up'} mt16", :remote => true %>
<% end %>
</div>
</li>

View File

@ -134,6 +134,7 @@ RedmineApp::Application.routes.draw do
member do
match "quote_resource_show_org_subfield", :via => [:get]
get "update_file_description"
post "edit_file_description"
end
end
@ -810,6 +811,7 @@ RedmineApp::Application.routes.draw do
match "quote_resource_show", :via => [:get]
get "file_hidden"
get "update_file_description"
post "edit_file_description"
end
end
@ -1220,6 +1222,7 @@ RedmineApp::Application.routes.draw do
get "file_hidden"
post "republish_file"
get "update_file_description"
post "edit_file_description"
end
end
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do

View File

@ -0,0 +1,13 @@
class AddSyllabusMembers < ActiveRecord::Migration
def up
Syllabus.all.each do |syllabus|
if syllabus.syllabus_members.empty?
member = SyllabusMember.create(:user_id => syllabus.user_id, :rank => 1)
syllabus.syllabus_members << member
end
end
end
def down
end
end

View File

@ -0,0 +1,9 @@
class ChangeDescriptionForAttachment < ActiveRecord::Migration
def up
change_column :attachments, :description, :text
end
def down
change_column :attachments, :description, :string
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160921062340) do
ActiveRecord::Schema.define(:version => 20161009053958) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,6 +52,28 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
create_table "application_settings", :force => true do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "signin_enabled"
t.boolean "gravatar_enabled"
t.text "sign_in_text"
t.datetime "created_at"
t.datetime "updated_at"
t.string "home_page_url"
t.integer "default_branch_protection", :default => 2
t.boolean "twitter_sharing_enabled", :default => true
t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", :default => true
t.integer "max_attachment_size", :default => 10, :null => false
t.integer "default_project_visibility"
t.integer "default_snippet_visibility"
t.text "restricted_signup_domains"
t.boolean "user_oauth_applications", :default => true
t.string "after_sign_out_path"
t.integer "session_expire_delay", :default => 10080, :null => false
end
create_table "applied_messages", :force => true do |t|
t.integer "user_id"
t.integer "applied_id"
@ -165,7 +187,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "downloads", :default => 0, :null => false
t.integer "author_id", :default => 0, :null => false
t.datetime "created_on"
t.string "description"
t.text "description"
t.string "disk_directory"
t.integer "attachtype", :default => 1
t.integer "is_public", :default => 1
@ -184,6 +206,20 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.string "typeName", :limit => 50
end
create_table "audit_events", :force => true do |t|
t.integer "author_id", :null => false
t.string "type", :null => false
t.integer "entity_id", :null => false
t.string "entity_type", :null => false
t.text "details"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id"
add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type"
add_index "audit_events", ["type"], :name => "index_audit_events_on_type"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -281,6 +317,17 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
add_index "boards", ["project_id"], :name => "boards_project_id"
create_table "broadcast_messages", :force => true do |t|
t.text "message", :null => false
t.datetime "starts_at"
t.datetime "ends_at"
t.integer "alert_type"
t.datetime "created_at"
t.datetime "updated_at"
t.string "color"
t.string "font"
end
create_table "bug_to_osps", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
@ -318,6 +365,8 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -599,6 +648,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "syllabus_id"
t.string "invite_code"
t.string "qrcode"
t.integer "qrcode_expiretime", :default => 0
end
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
@ -665,6 +715,15 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -714,6 +773,16 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "created_at"
end
create_table "emails", :force => true do |t|
t.integer "user_id", :null => false
t.string "email", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true
add_index "emails", ["user_id"], :name => "index_emails_on_user_id"
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -736,6 +805,25 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "events", :force => true do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
t.text "data"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "action"
t.integer "author_id"
end
add_index "events", ["action"], :name => "index_events_on_action"
add_index "events", ["author_id"], :name => "index_events_on_author_id"
add_index "events", ["created_at"], :name => "index_events_on_created_at"
add_index "events", ["project_id"], :name => "index_events_on_project_id"
add_index "events", ["target_id"], :name => "index_events_on_target_id"
add_index "events", ["target_type"], :name => "index_events_on_target_type"
create_table "exercise_answers", :force => true do |t|
t.integer "user_id"
t.integer "exercise_question_id"
@ -838,6 +926,15 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
create_table "forked_project_links", :force => true do |t|
t.integer "forked_to_project_id", :null => false
t.integer "forked_from_project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -967,6 +1064,21 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "identities", :force => true do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id"
add_index "identities", ["user_id"], :name => "index_identities_on_user_id"
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1113,6 +1225,20 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "private", :default => 0
end
create_table "keys", :force => true do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "key"
t.string "title"
t.string "type"
t.string "fingerprint"
t.boolean "public", :default => false, :null => false
end
add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id"
add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
create_table "kindeditor_assets", :force => true do |t|
t.string "asset"
t.integer "file_size"
@ -1124,6 +1250,27 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "owner_type", :default => 0
end
create_table "label_links", :force => true do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id"
add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type"
create_table "labels", :force => true do |t|
t.string "title"
t.string "color"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
@ -1177,6 +1324,47 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "viewed_count", :default => 0
end
create_table "merge_request_diffs", :force => true do |t|
t.string "state"
t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647
t.integer "merge_request_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true
create_table "merge_requests", :force => true do |t|
t.string "target_branch", :null => false
t.string "source_branch", :null => false
t.integer "source_project_id", :null => false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "milestone_id"
t.string "state"
t.string "merge_status"
t.integer "target_project_id", :null => false
t.integer "iid"
t.text "description"
t.integer "position", :default => 0
t.datetime "locked_at"
end
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id"
add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id"
add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true
add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@ -1211,6 +1399,39 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
create_table "milestones", :force => true do |t|
t.string "title", :null => false
t.integer "project_id", :null => false
t.text "description"
t.date "due_date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "state"
t.integer "iid"
end
add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id"
add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t|
t.string "name", :null => false
t.string "path", :null => false
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
t.string "description", :default => "", :null => false
t.string "avatar"
end
add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id"
add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true
add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true
add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
create_table "news", :force => true do |t|
t.integer "project_id"
t.string "title", :limit => 60, :default => "", :null => false
@ -1236,6 +1457,31 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "notes", :force => true do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "commit_id"
t.integer "noteable_id"
t.boolean "system", :default => false, :null => false
t.text "st_diff", :limit => 2147483647
end
add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id"
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at"
create_table "notificationcomments", :force => true do |t|
t.string "notificationcommented_type"
t.integer "notificationcommented_id"
@ -1245,6 +1491,49 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "oauth_access_grants", :force => true do |t|
t.integer "resource_owner_id", :null => false
t.integer "application_id", :null => false
t.string "token", :null => false
t.integer "expires_in", :null => false
t.text "redirect_uri", :null => false
t.datetime "created_at", :null => false
t.datetime "revoked_at"
t.string "scopes"
end
add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
create_table "oauth_access_tokens", :force => true do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", :null => false
t.string "refresh_token"
t.integer "expires_in"
t.datetime "revoked_at"
t.datetime "created_at", :null => false
t.string "scopes"
end
add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
create_table "oauth_applications", :force => true do |t|
t.string "name", :null => false
t.string "uid", :null => false
t.string "secret", :null => false
t.text "redirect_uri", :null => false
t.string "scopes", :default => "", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "owner_id"
t.string "owner_type"
end
add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
create_table "onclick_times", :force => true do |t|
t.integer "user_id"
t.datetime "onclick_time"
@ -1402,6 +1691,23 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "allow_teacher", :default => 0
end
create_table "permissions", :force => true do |t|
t.string "controller", :limit => 30, :default => "", :null => false
t.string "action", :limit => 30, :default => "", :null => false
t.string "description", :limit => 60, :default => "", :null => false
t.boolean "is_public", :default => false, :null => false
t.integer "sort", :default => 0, :null => false
t.boolean "mail_option", :default => false, :null => false
t.boolean "mail_enabled", :default => false, :null => false
end
create_table "permissions_roles", :id => false, :force => true do |t|
t.integer "permission_id", :default => 0, :null => false
t.integer "role_id", :default => 0, :null => false
end
add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -1484,6 +1790,11 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "project_import_data", :force => true do |t|
t.integer "project_id"
t.text "data"
end
create_table "project_infos", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1563,6 +1874,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "hot", :default => 0
t.string "invite_code"
t.string "qrcode"
t.integer "qrcode_expiretime", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1576,6 +1888,16 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
create_table "protected_branches", :force => true do |t|
t.integer "project_id", :null => false
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "developers_can_push", :default => false, :null => false
end
add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
create_table "pull_requests", :force => true do |t|
t.integer "pull_request_id"
t.integer "gpid"
@ -1732,6 +2054,25 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.integer "is_teacher_score", :default => 0
end
create_table "services", :force => true do |t|
t.string "type"
t.string "title"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "active", :default => false, :null => false
t.text "properties"
t.boolean "template", :default => false
t.boolean "push_events", :default => true
t.boolean "issues_events", :default => true
t.boolean "merge_requests_events", :default => true
t.boolean "tag_push_events", :default => true
t.boolean "note_events", :default => true, :null => false
end
add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id"
add_index "services", ["project_id"], :name => "index_services_on_project_id"
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@ -1770,6 +2111,26 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "snippets", :force => true do |t|
t.string "title"
t.text "content", :limit => 2147483647
t.integer "author_id", :null => false
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "file_name"
t.datetime "expires_at"
t.string "type"
t.integer "visibility_level", :default => 0, :null => false
end
add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id"
add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level"
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -1923,6 +2284,17 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "subscriptions", :force => true do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
t.boolean "subscribed"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true
create_table "syllabus_members", :force => true do |t|
t.integer "rank"
t.integer "syllabus_id"
@ -2196,6 +2568,17 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
add_index "users", ["type"], :name => "index_users_on_type"
create_table "users_star_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id"
add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true
add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id"
create_table "versions", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :default => "", :null => false
@ -2247,6 +2630,23 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
t.datetime "updated_at", :null => false
end
create_table "web_hooks", :force => true do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type", :default => "ProjectHook"
t.integer "service_id"
t.boolean "push_events", :default => true, :null => false
t.boolean "issues_events", :default => false, :null => false
t.boolean "merge_requests_events", :default => false, :null => false
t.boolean "tag_push_events", :default => false
t.boolean "note_events", :default => false, :null => false
end
add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id"
add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"

View File

@ -14,24 +14,24 @@ namespace :homework_evaluation do
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
student_works = homework_common.student_works.has_committed
if student_works && student_works.size >= 2
if homework_common.homework_type == 3
student_work_projects = homework_common.student_work_projects.where("student_work_id is not null")
student_work_projects.each_with_index do |pro_work, pro_index|
n = homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
work_index = -1
student_works.each_with_index do |stu_work, stu_index|
if stu_work.id.to_i == pro_work.student_work_id.to_i
work_index = stu_index
end
end
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
else
# if homework_common.homework_type == 3
# student_work_projects = homework_common.student_work_projects.where("student_work_id is not null")
# student_work_projects.each_with_index do |pro_work, pro_index|
# n = homework_detail_manual.evaluation_num
# n = n < student_works.size ? n : student_works.size - 1
# work_index = -1
# student_works.each_with_index do |stu_work, stu_index|
# if stu_work.id.to_i == pro_work.student_work_id.to_i
# work_index = stu_index
# end
# end
# assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
# assigned_homeworks.each do |h|
# student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
# student_works_evaluation_distributions.save
# end
# end
# else
student_works.each_with_index do |work, index|
user = work.user
n = homework_detail_manual.evaluation_num
@ -42,7 +42,7 @@ namespace :homework_evaluation do
student_works_evaluation_distributions.save
end
end
end
#end
homework_detail_manual.update_column('comment_status', 2)
# 匿评开启消息邮件通知,# 所有人
#send_message_anonymous_comment(homework_common, 2)
@ -77,11 +77,27 @@ namespace :homework_evaluation do
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
#计算缺评扣分
work_ids = "(" + homework_common.student_works.has_committed.map(&:id).join(",") + ")"
if homework_common.homework_type != 3
homework_common.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
else
homework_common.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
if student_work.absence_penalty != 0
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = homework_common.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
st_work.update_attribute("absence_penalty", student_work.absence_penalty)
end
end
end
end
homework_detail_manual.update_column('comment_status', 3)
# 匿评关闭消息通知 给所有人发
course = homework_common.course