diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 2f2f014d4..919ca0a34 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -406,12 +406,17 @@ class HomeworkCommonController < ApplicationController unless homeworks.nil? homeworks.each do |h| if h.homework_type == 3 - student_works = h.student_works.where("project_id != 0") + student_works = h.student_work_projects.where("is_leader = 1") time = h.updated_at unless student_works.nil? student_works.each do |s| project = Project.find s.project_id unless project.nil? && project.gpid.nil? + project_time=project.updated_on + project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last + if time < project_time + time = project_time + end begin # gitlab端获取默认分支 g = Gitlab.client diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 344c7d0ad..fdda98008 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -1157,7 +1157,7 @@ class StudentWorkController < ApplicationController sheet1[count_row,3] = homework.user.user_extensions.student_id sheet1[count_row,4] = homework.user.mail sheet1[count_row,5] = homework.name - sheet1[count_row,6] = homework.description + sheet1[count_row,6] = strip_html homework.description sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 83b2e6a2a..9b19b8c7c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2959,6 +2959,14 @@ int main(int argc, char** argv){ return sort_projects end end + + def project_sort_first projects + unless projects.empty? + project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')' + sort_projects = ForgeActivity.find_by_sql("SELECT updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} ORDER BY updated_at DESC limit 1") + return sort_projects + end + end end def user_url_in_org(user_id) diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 07bfb22de..703da936b 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -15,7 +15,7 @@ class CourseMessage < ActiveRecord::Base validates :course_id,presence: true validates :course_message_id,presence: true validates :course_message_type, presence: true - validates_length_of :content, :maximum => 100 + #validates_length_of :content, :maximum => 100 after_create :add_user_message def add_user_message diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 33e2835dd..068d50437 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -182,7 +182,8 @@ <% sort_projects = project_sort_update projects %>