Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
daiao 2018-09-03 10:55:45 +08:00
commit 6e31183f7c
9 changed files with 541 additions and 1088 deletions

View File

@ -162,12 +162,22 @@ class PullRequestsController < ApplicationController
path = "./"
# qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
version = 1
properties = "sonar.projectKey=#{job_name}
if language == "java"
properties = "sonar.projectKey=#{job_name}
sonar.projectName=#{job_name}
sonar.projectVersion=#{version}
sonar.sources=#{path}
sonar.language=#{language.downcase}
sonar.sourceEncoding=utf-8
sonar.java.binaries=./"
else
properties = "sonar.projectKey=#{job_name}
sonar.projectName=#{job_name}
sonar.projectVersion=#{version}
sonar.sources=#{path}
sonar.language=#{language.downcase}
sonar.sourceEncoding=utf-8"
end
# 替换配置文件
@doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))

View File

@ -592,7 +592,8 @@ update
entry_and_raw(false)
@content = @repository.cat(@path, @rev)
# @changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
@changesets_latest_coimmit = @g.commits(@project.gpid, :rev => @rev, :path => @paht).try(:first)
# @changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
if is_entry_text_data?(@content, @path)
@ -604,7 +605,7 @@ update
entry_and_raw(false)
@content = @repository.cat(@path, @rev)
# @changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
@changesets_latest_coimmit = @g.commits(@project.gpid, :rev => @rev, :path => @paht).try(:first)
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
if is_entry_text_data?(@content, @path)

View File

@ -906,7 +906,6 @@ class StudentWorkController < ApplicationController
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2
@score = student_work_score @work,User.current
#@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
#@score.score = params[:score] if params[:score]
#if User.current.admin?
@ -918,16 +917,19 @@ class StudentWorkController < ApplicationController
#@is_new = false
@is_last_a = @work.student_works_scores.empty?
@new_score = StudentWorksScore.new
if @score && params[:score]
@new_score.score = params[:score].to_i == -1 ? @score.score : params[:score]
elsif @score.nil? && params[:score]
@new_score.score = params[:score].to_i == -1 ? nil : params[:score]
if params[:score] == -1
score = student_work_score @work,User.current
@new_score.score = @score.try(:score)
else
@new_score.score = params[:score]
end
@new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@new_score.user_id = User.current.id
@new_score.student_work_id = @work.id
if @is_teacher && !@new_score.score.nil? && @work.work_status == 0
@work.update_attributes(:work_status => 1, :commit_time => Time.now)
@work.work_status = 1
@work.commit_time = Time.now
#更新CourseHomeworkStatistics中学生的已交作品数、未交作品数
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, @work.user_id)
course_statistics.update_attribute('committed_work_num', course_statistics.committed_work_num + 1) if course_statistics
@ -939,16 +941,6 @@ class StudentWorkController < ApplicationController
role = User.current.members.where("course_id = ?",@course.id).first.roles.where("is_current = 1").first.name
@new_score.reviewer_role = get_role_by_name(role)
end
if @score
if @is_teacher
@is_new = true
@is_last_a = false
else
@is_new = false
end
else
@is_new = true
end
@new_score.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@new_score)
@ -994,7 +986,7 @@ class StudentWorkController < ApplicationController
@homework.update_column('updated_at', Time.now)
update_course_activity(@homework.class,@homework.id)
update_user_activity(@homework.class,@homework.id)
update_org_activity(@homework.class,@homework.id)
# update_org_activity(@homework.class,@homework.id)
if @work.save
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
@count = @homework.student_works.has_committed.count

View File

@ -206,11 +206,9 @@ class StudentWork < ActiveRecord::Base
course_homework_statistics = CourseHomeworkStatistics.where(:user_id => self.user_id, :course_id => self.homework_common.course_id).first
if course_homework_statistics
course = self.homework_common.course
homework_ids = course.homework_commons.empty? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
user = self.user
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
average_score = user.student_works.where(:homework_common_id => course.homework_commons.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:homework_common_id => course.homework_commons.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:homework_common_id => course.homework_commons.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:homework_common_id => course.homework_commons.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
course_homework_statistics.update_attributes(:average_score => average_score, :total_score => total_score)
end
end

View File

@ -13,6 +13,7 @@
}
});
<% end %>
<p class="none c_red ml100" id="issue_subject_notice"></p>
<% end %>
<span ></span>
</li>
@ -186,17 +187,22 @@
}
function issue_create(){
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
var str = "";
for(var i=0; i < issue_commit_ids.length; i++){
str += $(issue_commit_ids[i]).html();
if(i != issue_commit_ids.length -1){
str += ",";
if($("#issue_subject").val().trim() == ""){
$("#issue_subject_notice").html("主题不能为空").show();
} else {
$("#issue_subject_notice").hide();
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
var str = "";
for(var i=0; i < issue_commit_ids.length; i++){
str += $(issue_commit_ids[i]).html();
if(i != issue_commit_ids.length -1){
str += ",";
}
}
issue_desc_editor.sync();
$('#commit_ids').val(str);
$('#issue-form').submit();
}
issue_desc_editor.sync();
$('#commit_ids').val(str);
$('#issue-form').submit();
}
function get_issue_commit_ids(id, project_id){

View File

@ -17,7 +17,6 @@
<div class="sy_teachers_txt fl ">
<p class="clear mb5">
<%= link_to_user_login(comment.author.try(:username), "pullreques_reply_name fl") %>
<span class="fl ml15 c_grey"><%= time_tag(comment.created_at) %>前</span>
</p>
<p class="pullreques_reply_txt"><%= comment.note %></p>
</div>

View File

@ -1,4 +1,4 @@
<% is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty? %>
<% is_member_work = @homework.homework_type == 3 && !@is_group_leader %>
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score,:is_member_work => is_member_work}) %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'});

View File

@ -0,0 +1,7 @@
class AddIndexToMessageAll < ActiveRecord::Migration
def change
remove_index :message_alls, name: 'index_message_alls_on_user_id_and_message_id_and_created_at'
remove_index :message_alls, :message_type
add_index :message_alls, [:message_id]
end
end

File diff suppressed because it is too large Load Diff