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 %>
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_url_in_org(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: + <% first_pro = project_sort_first(projects).first %> + # <%=time_from_now first_pro.first.updated_at %><%= link_to User.find(first_pro.first.user_id).show_name, user_activities_url_in_org(first_pro.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% sort_projects.each_with_index do |pro, i| %> diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index a7e223ac1..453f717c9 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -5,7 +5,7 @@ <% end %> \ No newline at end of file +
\ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 56ceb1ab6..5b273d014 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -197,7 +197,8 @@ <% sort_projects = project_sort_update projects %>
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: + <% first_pro = project_sort_first(projects).first %> + # <%=time_from_now first_pro.first.updated_at %><%= link_to User.find(first_pro.first.user_id).show_name, user_activities_path(first_pro.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% sort_projects.each_with_index do |pro, i| %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 4e84d1a73..5d43b5567 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -201,7 +201,8 @@ <% sort_projects = project_sort_update projects %>
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: + <% first_pro = project_sort_first(projects).first %> + # <%=time_from_now first_pro.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% sort_projects.each_with_index do |pro, i| %> @@ -362,7 +363,7 @@ <% end %>
<% end %> -
+
<%= comment.notes.html_safe %>
diff --git a/config/routes.rb b/config/routes.rb index cb5fe0388..df46d342f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -549,7 +549,7 @@ RedmineApp::Application.routes.draw do match 'user_project_activities', :to => 'users#user_project_activities', :via => :get match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get - match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :get + match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :post match 'apply_homework', :to => 'users#apply_homework', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get match 'student_homeworks', :to => 'users#student_homeworks', :via => :get @@ -621,6 +621,7 @@ RedmineApp::Application.routes.draw do get 'user_homework_type' get 'user_ref_homework_search' get 'show_homework_detail' + post 'apply_for_homework' # end end #resources :blogs diff --git a/db/migrate/20160506104128_change_course_messages_cloumn.rb b/db/migrate/20160506104128_change_course_messages_cloumn.rb new file mode 100644 index 000000000..39e882b39 --- /dev/null +++ b/db/migrate/20160506104128_change_course_messages_cloumn.rb @@ -0,0 +1,8 @@ +class ChangeCourseMessagesCloumn < ActiveRecord::Migration + def up + change_column :course_messages, :content, :text + end + + def down + end +end