From 5fb1b220e570222d78f2d71f6544b1f8b16d0de7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 18 Aug 2014 16:46:34 +0800 Subject: [PATCH 01/15] =?UTF-8?q?#1369=20=E4=BF=AE=E5=A4=8D=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index be27a71ea..047f7103e 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -488,6 +488,11 @@ class BidsController < ApplicationController if @bid.homework_type @homework = HomeworkAttach.new + if @bid.proportion + teacher_proportion = @bid.proportion * 1.0 / 100 + else + teacher_proportion = 1.0 + end #@homework_list = @bid.homeworks #增加作业按评分排序, #@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC") @@ -495,7 +500,7 @@ class BidsController < ApplicationController (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY - (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC") + (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC") if params[:student_id].present? @temp = [] @homework_list.each do |pro| From 1e234a9adfe4b7b3fa62889567269e42e54c4ae9 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 19 Aug 2014 17:03:26 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=80=9F=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 4 +- app/helpers/user_score_helper.rb | 185 +++++++++++++++++++++---- lib/tasks/user_new_score.rake | 23 +++ 3 files changed, 183 insertions(+), 29 deletions(-) create mode 100644 lib/tasks/user_new_score.rake diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ccbff8e50..1dba60a6d 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -683,8 +683,8 @@ class ProjectsController < ApplicationController else # @project.project_type == Project::ProjectType_project roles = Role.find_all_givable @subPage_title = l :label_member_list - @members = @project.member_principals.includes(:roles, :principal).all - @members = sort_project_members(@project, @members) + @members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2").order("#{OptionNumber.table_name}.total_score DESC").all + #@members = sort_project_members(@project, @members) @applied_members = appied_project_members(@project, @members) end @members = paginateHelper @members diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb index 1353f9a1c..37cffae05 100644 --- a/app/helpers/user_score_helper.rb +++ b/app/helpers/user_score_helper.rb @@ -418,11 +418,26 @@ module UserScoreHelper #发帖数 def memo_num(user,project=nil) if project.nil? - Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count #+ Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count - + #Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count #+ Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count + users = User.find_by_sql("SELECT `users`.id,(SELECT COUNT(*) FROM `messages` JOIN `boards` ON boards.project_id != -1 AND messages.board_id = boards.id +WHERE messages.parent_id IS NULL AND messages.author_id = `users`.id) AS m_count +FROM `users` where id = #{user.id}") + result = 0 + users.each do |user| + result = user.m_count + end + result #user.messages.where("parent_id IS NULL").count else - Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count + #Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count + users = User.find_by_sql("SELECT `users`.id,(SELECT COUNT(*) FROM `messages` JOIN `boards` ON boards.project_id = '#{project.id}' AND messages.board_id = boards.id +WHERE messages.parent_id IS NULL AND messages.author_id = `users`.id) AS m_count +FROM `users` where id = #{user.id}") + result = 0 + users.each do |user| + result = user.m_count + end + result end end @@ -448,9 +463,21 @@ FROM `users` where id = #{user.id}") def messges_for_issue_num(user,project=nil) if project.nil? - Journal.includes(:user).where("user_id = '#{user.id}' and notes is not null and notes != ''").all.count + #Journal.includes(:user).where("user_id = '#{user.id}' and notes is not null and notes != ''").all.count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals WHERE journals.user_id = users.id AND journals.notes IS NOT NULL AND journals.notes != '') AS m_count FROM users where id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Journal.includes(:user).joins(:issue).where("#{Journal.table_name}.user_id = '#{user.id}' and #{Issue.table_name}.project_id = '#{project.id}' and #{Journal.table_name}.notes != '' and #{Journal.table_name}.notes is not null").all.count + #Journal.includes(:user).joins(:issue).where("#{Journal.table_name}.user_id = '#{user.id}' and #{Issue.table_name}.project_id = '#{project.id}' and #{Journal.table_name}.notes != '' and #{Journal.table_name}.notes is not null").all.count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals join issues on #{Journal.table_name}.journalized_type = 'Issue' and #{Journal.table_name}.journalized_id = #{Issue.table_name}.id WHERE journals.user_id = users.id AND journals.notes IS NOT NULL AND journals.notes != ''and #{Issue.table_name}.project_id = '#{project.id}') AS m_count FROM users where id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -471,9 +498,21 @@ FROM `users` where id = #{user.id}") def issues_status_num(user,project=nil) if project.nil? - Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count + #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id) AS m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count + #Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id and issues.project_id = '#{project.id}') AS m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -481,10 +520,10 @@ FROM `users` where id = #{user.id}") def issues_status_score(user,project=nil) if project.nil? #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count - User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id) AS m_score FROM users WHERE users.id = '#{user.id}'") + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id) AS m_count FROM users WHERE users.id = '#{user.id}'") else #Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count - User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id and issues.project_id = '#{project.id}') AS m_score FROM users WHERE users.id = '#{user.id}'") + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id and issues.project_id = '#{project.id}') AS m_count FROM users WHERE users.id = '#{user.id}'") end end @@ -497,9 +536,21 @@ FROM `users` where id = #{user.id}") def replay_for_message_num(user,project=nil) if project.nil? - JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project'").count + #JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project'").count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project') as m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project' and jour_id = '#{project.id}'").count + #JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project' and jour_id = '#{project.id}'").count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project' and jour_id = '#{project.id}') as m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -508,7 +559,7 @@ FROM `users` where id = #{user.id}") if project.nil? User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project') as m_score FROM users WHERE users.id = '#{user.id}'") else - User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project' and jour_id = '#{project.id}') as m_score FROM users WHERE users.id = '#{user.id}'") + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project' and jour_id = '#{project.id}') as m_score FROM users WHERE users.id = '#{user.id}'") end end @@ -521,9 +572,21 @@ FROM `users` where id = #{user.id}") def replay_for_memo_num(user,project=nil) if project.nil? - Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count + #Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id != -1) as m_count FROM users WHERE users.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count + #Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count + users = User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id = #{project.id}) FROM users WHERE users.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -538,16 +601,21 @@ FROM `users` where id = #{user.id}") #更新被关注的人数 def update_follow(user,type) option_number = get_option_number(user,type) - option_number.follow = Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count + option_number.follow = follow_num(user)#Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count update_score(option_number) end def follow_num(user) - Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count + #Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count + users = User.find_by_sql("SELECT users.id, (SELECT COUNT(*) FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = users.id) as m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end end def follow_score(user) - User.find_by_sql("SELECT users.id, (SELECT COUNT(*) * 2 FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = '#{user.id}') FROM users WHERE users.id = '#{user.id}'") + User.find_by_sql("SELECT users.id, (SELECT COUNT(*) * 2 FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = users.id) FROM users WHERE users.id = '#{user.id}'") end #更新帖子踩各项数量 @@ -689,9 +757,21 @@ FROM `users` where id = #{user.id}") def changeset_num(user,project=nil) if project.nil? - Changeset.includes(:user).where("user_id = '#{user.id}'").all.count + #Changeset.includes(:user).where("user_id = '#{user.id}'").all.count + users = User.find_by_sql("SELECT users.id, (SELECT COUNT(*) FROM #{Changeset.table_name} WHERE user_id = users.id) as m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Changeset.includes(:user).joins(:repository).where("#{Changeset.table_name}.user_id = '#{user.id}' and #{Repository.table_name}.project_id = #{project.id}").all.count + #Changeset.includes(:user).joins(:repository).where("#{Changeset.table_name}.user_id = '#{user.id}' and #{Repository.table_name}.project_id = #{project.id}").all.count + users = User.find_by_sql("SELECT users.id, (SELECT COUNT(*) FROM #{Changeset.table_name} JOIN #{Repository.table_name} ON #{Changeset.table_name}.repository_id = #{Repository.table_name}.id WHERE #{Changeset.table_name}.user_id = users.id and #{Repository.table_name}.project_id = #{project.id}) as m_count FROM users WHERE users.id = '#{user.id}'") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -705,9 +785,21 @@ FROM `users` where id = #{user.id}") def document_num(user,project=nil) if project.nil? - Document.includes(:user).where("user_id = '#{user.id}'").all.count + #Document.includes(:user).where("user_id = '#{user.id}'").all.count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Document.table_name} WHERE #{Document.table_name}.user_id = #{User.table_name}.id) as m_count FROM #{User.table_name} where #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Document.includes(:user,:project).where("user_id = '#{user.id}' and project_id = '#{project.id}'").all.count + #Document.includes(:user,:project).where("user_id = '#{user.id}' and project_id = '#{project.id}'").all.count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Document.table_name} WHERE #{Document.table_name}.user_id = #{User.table_name}.id and #{Document.table_name}.project_id = '#{project.id}') as m_count FROM #{User.table_name} where #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -721,9 +813,21 @@ FROM `users` where id = #{user.id}") def attachment_num(user,project=nil) if project.nil? - Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project'").all.count + #Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project'").all.count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Attachment.table_name} WHERE author_id = '#{user.id}' and container_type = 'Project') as m_count FROM #{User.table_name} WHERE #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}").all.count + #Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}").all.count + User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Attachment.table_name} WHERE author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}) as m_count FROM #{User.table_name} WHERE #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_coumt + end + result end end @@ -736,9 +840,21 @@ FROM `users` where id = #{user.id}") def issue_done_ratio_num(user,project=nil) if project.nil? - Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count + #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Journal.table_name} JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id WHERE #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{Journal.table_name}.user_id = #{User.table_name}.id) as m_count FROM #{User.table_name} WHERE #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count + #Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Journal.table_name} JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{Journal.table_name}.user_id = #{User.table_name}.id and #{Issue.table_name}.project_id = '#{project.id}') as m_count FROM #{User.table_name} WHERE #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -752,9 +868,21 @@ FROM `users` where id = #{user.id}") def post_issue_num(user,project=nil) if project.nil? - Issue.includes(:author).where("author_id = '#{user.id}'").all.count + #Issue.includes(:author).where("author_id = '#{user.id}'").all.count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Issue.table_name} WHERE author_id = #{User.table_name}.id ) as m_count FROM #{User.table_name} WHERE #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result else - Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count + #Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count + users = User.find_by_sql("SELECT #{User.table_name}.id,(SELECT COUNT(*) FROM #{Issue.table_name} WHERE author_id = #{User.table_name}.id and project_id = '#{project.id}' ) as m_count FROM #{User.table_name} WHERE #{User.table_name}.id = #{user.id}") + result = 0 + if users.count > 0 + result = users.first.m_count + end + result end end @@ -778,6 +906,9 @@ FROM `users` where id = #{user.id}") update_attachment(user,type,project) update_issue_done_ratio(user,type,project) update_post_issue(user,type,project) + if project.nil? + update_follow(user,type) + end update_score(ooption_num) ooption_num end diff --git a/lib/tasks/user_new_score.rake b/lib/tasks/user_new_score.rake new file mode 100644 index 000000000..32a43e07a --- /dev/null +++ b/lib/tasks/user_new_score.rake @@ -0,0 +1,23 @@ +desc "User New Score description" +task :user_new_score do + puts "user_score sync." +end + +namespace :user_new_score do + desc "calculating user score" + task :calculate => :environment do + include UserScoreHelper + User.all.each do |user| + result = user_scores(user,1) + puts "score of #{user.login} is #{result}" + end + + Project.where("project_type != 1").all.each do |project| + project.member_principals.includes(:roles, :principal).all.each do |member| + result = user_scores(member.user,2,project) + puts "#{user.login}/'s score in #{project.name} is #{result}" + end + end + puts "calculate completed" + end +end \ No newline at end of file From c13eeee56d81b3b60d84e258c269c4892d95cf7e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 20 Aug 2014 15:51:35 +0800 Subject: [PATCH 03/15] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E9=94=99=E8=AF=AF=202.=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_form.html.erb | 2 +- app/views/news/_form.html.erb | 5 ++--- app/views/news/_news.html.erb | 10 +++++----- app/views/news/new.html.erb | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 1f2198a3b..ad2c7835c 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -5,7 +5,7 @@

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

- +

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

<%= render :partial => 'attachments/form', :locals => {:container => @news} %>

diff --git a/app/views/news/_form.html.erb b/app/views/news/_form.html.erb index 0601ee25b..f92559903 100644 --- a/app/views/news/_form.html.erb +++ b/app/views/news/_form.html.erb @@ -1,11 +1,10 @@ <%= error_messages_for @news %>
- <% str = @project ? l(:bale_news_notice) : l(:label_news_new) %> - <%= str %> + <%= @project ? l(:label_news_new) : l(:bale_news_notice) %>

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

- +

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

<%= render :partial => 'attachments/form', :locals => {:container => @news} %>

diff --git a/app/views/news/_news.html.erb b/app/views/news/_news.html.erb index 704e0eef3..7684a5949 100644 --- a/app/views/news/_news.html.erb +++ b/app/views/news/_news.html.erb @@ -1,9 +1,9 @@ - + <%# unless news.summary.blank? %><%#=h news.summary %><%# end %> +<%#= authoring news.created_on, news.author %>

--> diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 68fad17f2..836d3b6ed 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -1,4 +1,4 @@ - + <% if @project %> <%= labelled_form_for @news, :url => project_news_index_path(@project), :html => {:id => 'news-form', :multipart => true} do |f| %> From 136c991060adcba8af9e86df0ad5a60b56c999dc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 20 Aug 2014 16:28:04 +0800 Subject: [PATCH 04/15] =?UTF-8?q?#1413=20=E4=BF=AE=E5=A4=8D=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=90=8D=E7=A7=B0=E8=BF=87=E9=95=BF=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E9=A6=96=E9=A1=B5=E4=BC=9A?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E8=BE=B9=E7=95=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index a3412142b..366ec0c39 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,6 +1,6 @@ <% if @events_by_day != nil && @events_by_day.size >0 %>
- +

<%#= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>

@@ -29,7 +29,7 @@ <%= l(:label_new_activity) %> - <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url %> + <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:style => "word-break:break-all;" %>
From 3a2754eb278d2d7802aa462f42ea33ff792afeac Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 10:16:01 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E7=AB=9E=E8=B5=9B=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E8=A2=AB?= =?UTF-8?q?=E9=81=AE=E4=BD=8F=E7=9A=84bug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 95 ++++++++++++------------ 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 34e254f3d..efc83dcbc 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -3,51 +3,54 @@
-
- - - +
- - - - - - - - - <% contest = @softapplication.contests.first %> - - - - - - - - - - - - - - - - - - -
<%= @softapplication.name %> - <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  - <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> -
<%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
<%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %>
- <%=l(:label_attendingcontestwork_download)%>: - - <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> - - <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %>
<%=l(:label_attendingcontestwork_average_scores)%>: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %>
- <% if @project %> - <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %> - <% end %> -
-
+ + + + +
<%= @softapplication.name %> + <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  + <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> +
+ + +
+ + + + + <% contest = @softapplication.contests.first %> + + + + + + + + + + + + + + + + + + + + + + + + +
<%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
<%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %>
<%=l(:label_attendingcontestwork_download)%>: + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> + <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %>
<%=l(:label_attendingcontestwork_average_scores)%>:<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %>
+ <% if @project %> + <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %> + <% end %> +
@@ -56,7 +59,7 @@
<%=l(:label_work_description)%>:
-
<%= @softapplication.description %>
+
<%= @softapplication.description %>
From 532cb231416788d4a7d1a51bbfe7d373d2791e7a Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 10:19:46 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=92=8C=E5=86=85=E5=AE=B9=E4=B9=8B=E9=97=B4=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=A4=AA=E5=A4=9A=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index efc83dcbc..2863d5bfd 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -18,30 +18,30 @@ - + <% contest = @softapplication.contests.first %> - + - + - + - - + - + - + From 16d86a1fbd2596a9e3381a84b5980c82cf85788a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 10:37:53 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 23 +++++ app/models/attachment.rb | 6 +- .../_course_show_all_attachment.html.erb | 94 ++++++++++--------- app/views/files/_show_all_attachment.html.erb | 26 +++-- 4 files changed, 95 insertions(+), 54 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c80ce6d69..666c39d30 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -38,6 +38,17 @@ class FilesController < ApplicationController @isproject = true @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + all_attachments = [] + @containers.each do |container| + all_attachments += container.attachments + end + @limit = 10 + @feedback_count = all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = all_attachments[@offset, @limit] + render :layout => !request.xhr? elsif params[:course_id] @isproject = false @@ -67,6 +78,18 @@ class FilesController < ApplicationController else @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)] end + + all_attachments = [] + @containers.each do |container| + all_attachments += container.attachments + end + + @limit = 10 + @feedback_count = all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = all_attachments[@offset, @limit] + render :layout => 'base_courses' end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8f3d68d02..e25434e6e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -29,9 +29,9 @@ class Attachment < ActiveRecord::Base include UserScoreHelper validates_presence_of :filename, :author - validates_length_of :filename, :maximum => 255 - validates_length_of :disk_filename, :maximum => 255 - validates_length_of :description, :maximum => 255 + validates_length_of :filename, :maximum => 254 + validates_length_of :disk_filename, :maximum => 254 + validates_length_of :description, :maximum => 254 validate :validate_max_file_size diff --git a/app/views/files/_course_show_all_attachment.html.erb b/app/views/files/_course_show_all_attachment.html.erb index 76112bc78..f70142a05 100644 --- a/app/views/files/_course_show_all_attachment.html.erb +++ b/app/views/files/_course_show_all_attachment.html.erb @@ -25,60 +25,70 @@ - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - + <%# @containers.each do |container| %> + <%# next if container.attachments.empty? -%> + <%# if container.is_a?(Version) -%> + - - --> + <%# end -%> + <% if @curse_attachments != nil %> + <% @curse_attachments.each do |file| %> + <%if file.is_public == 0 && !User.current.member_of_course?(@course)%> + <%next%> + <%end%> + "> + + + + - - + + - - - - - - - - <% end -%> - <% reset_cycle %> + + + + + + + + <% end -%> + <% end %> + <%# reset_cycle %> + <%# end -%> + +
<%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %><%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
<%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%= @softapplication.user.name %> <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %><%= @softapplication.android_min_version_available %>
<%=l(:label_attendingcontestwork_download)%>: + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %><%= @softapplication.application_developers %>
<%=l(:label_attendingcontestwork_average_scores)%>:<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> <%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %><%=format_time @softapplication.created_at %>
From 3343e1c4135f29a07a70df51c75690fa92fb3ae2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 10:24:23 +0800 Subject: [PATCH 07/15] =?UTF-8?q?#1203=20=E4=BF=AE=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=AF=84=E5=AE=A1=E5=BF=AB=E9=80=9F=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=96=B0=E5=BB=BAISSUE=E6=97=B6=E6=8A=A5=E9=94=99=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/code_review/_issues_show_details_bottom.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb b/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb index e60198fff..480119ca7 100644 --- a/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb +++ b/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb @@ -46,8 +46,8 @@ review = issue.code_review %> <%= l(:label_revision) + " "%> <%= link_to_revision(assignment.revision, repo) %> - <% elsif assignment.attachment %> - <%= link_to(assignment.attachment.filename, :controller => 'attachments', :action => 'show', :id => attachment.id) %> + <% elsif assignment.respond_to?("attachment") && assignment.attachment %> + <%= link_to(assignment.attachment.filename.to_s, :controller => 'attachments', :action => 'show', :id => assignment.attachment.id) %> <% end %>
<%= number_to_human_size(file.filesize) %> - <%= file.attachmentstype.typeName unless file.attachmentstype.nil? %> +
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName unless file.attachmentstype.nil? %> <%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %> - <%= file.show_suffix_type %> - <%= file.file_dense_str %> -   + <%= file.show_suffix_type %> + <%= file.file_dense_str %> +   <%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list, :attachment => file} %> - <%= file.downloads %> - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> -
-
- <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> -
-
- -
<%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
+
+ <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
+
+ +
+ + diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index 838153c78..043fe1183 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -25,16 +25,17 @@ - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - + <%# @containers.each do |container| %> + <%# next if container.attachments.empty? -%> + <%# if container.is_a?(Version) -%> + + <%# end -%> + <% if @curse_attachments != nil %> + <% @curse_attachments.each do |file| %> <%if file.is_public == 0 && !User.current.member_of?(@project)%> <%next%> <%end%> @@ -75,10 +76,17 @@ <% end -%> - <% reset_cycle %> + <%# reset_cycle %> <% end -%> + + + From e303a3789a16ec98b99f71c4c529cf8380889170 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 10:50:53 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E6=96=B0?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B5=84=E6=BA=90=E6=90=9C=E7=B4=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=B3=BB=E7=BB=9F=E6=94=AF=E6=8C=81=E8=BF=87=E9=95=BF?= =?UTF-8?q?=E9=81=AE=E4=BD=8F=E5=85=B6=E4=BB=96=E6=A0=87=E7=AD=BE=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/_list.html.erb | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/views/softapplications/_list.html.erb b/app/views/softapplications/_list.html.erb index 4f99519b5..e31aedda7 100644 --- a/app/views/softapplications/_list.html.erb +++ b/app/views/softapplications/_list.html.erb @@ -9,9 +9,30 @@
<%= softapplication.description.truncate(95, omission: '...') %>
<%contest = softapplication.contests.first%> + + + + + + + + + + + + + + + + + + + +

<%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

-

<%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(10, omission: '...') %>

-

<%=l(:label_attendingcontestwork_adaptive_system)%>:<%= softapplication.android_min_version_available %>

+

<%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(14, omission: '...') %>

+ <%strTitle = softapplication.android_min_version_available%> +

<%=l(:label_attendingcontestwork_adaptive_system)%>:<%= strTitle.truncate(10,omisiion:'...') %>

<%=l(:label_attendingcontestwork_developers)%>:<%= softapplication.application_developers %> From 50e1f413459afee5ee458e3a5ab17f7adcfc96b6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 11:16:40 +0800 Subject: [PATCH 10/15] =?UTF-8?q?#1307=E4=BF=AE=E5=A4=8D=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D=E5=8F=AA?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8D=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=A7=93?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/views/bids/_homework_list.html.erb | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index aad350d22..e08e50e80 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -441,7 +441,7 @@ module CoursesHelper def homework_user_of_homework homework,is_teacher homework_users = "" homework.users.each do |user| - homework_users = homework_users + (is_teacher ? user.realname : user.name) + homework_users = homework_users + (is_teacher ? (user.firstname + user.lastname) : user.login) if user != homework.users.last homework_users = homework_users + "、" end diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 6797bc9eb..6d3a2adcc 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -28,13 +28,15 @@ + <% user_name = is_teacher ? (homework.user.firstname + homework.user.lastname) : homework.user.login %> - + - From a690fd79cf901d4712f2a6e71fc957563ed901d0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 14:43:29 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=97=B6=E6=A0=87=E9=A2=98=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_form.html.erb | 2 +- config/locales/en.yml | 3 +++ config/locales/zh.yml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index ad2c7835c..186bab18d 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -1,6 +1,6 @@ <%= error_messages_for @news %>
- <% str = l(:bale_news_notice)%> + <% str = l(:bale_edit_notice)%> <%= str %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 367624f89..602e7a659 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1782,6 +1782,7 @@ en: label_no_file_uploaded: No file uploaded label_forum_new: New forum label_memo_new_from_forum: Release memo + bale_edit_notice: Edit label_user_grade: Individual score label_active_homework: homework @@ -1797,6 +1798,8 @@ en: label_record: 湘ICP备09019772 label_check_comment: Check comment label_notification: Notification + + #end # ajax异步验证 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d17f4c3bd..a73f9db56 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -707,6 +707,7 @@ zh: label_news: 新闻 label_news_new: 添加新闻 bale_news_notice: 添加通知 #huang + bale_edit_notice: 修改通知 label_news_notice: 发布课程通知 label_news_plural: 新闻 label_news_latest: 最近的新闻 From 38188804a15dfcbb26b977988d873a4e8c247322 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 14:46:14 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=97=B6=E6=A0=87=E9=A2=98=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_form.html.erb | 3 +-- app/views/news/_course_news.html.erb | 2 +- app/views/news/_course_show.html.erb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 186bab18d..91b35670c 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -1,7 +1,6 @@ <%= error_messages_for @news %>
- <% str = l(:bale_edit_notice)%> - <%= str %> + <%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%>

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 5104cd851..adb2ce283 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -15,7 +15,7 @@
+
<%= image_tag(url_to_avatar(homework.user), :class => "avatar")%><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%>
+ +

- <%= link_to (is_teacher ? homework.user.realname : homework.user ), user_path(homework.user),{:style => "color:#727272"} %> + <%= link_to user_name, user_path(homework.user),{:style => "color:#727272"} %>

<%#=h news.summary %><% end %><%#= authoring news.created_on, news.author %>

--> diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 91b35670c..7ce42439a 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -3,9 +3,11 @@ <%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%>
-

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

+

<%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onblur => "regexTitle();" %>

+

(60个字符以内)

-

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

+

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:470px;", :onblur => "regexDescription();" %>

+

<%= render :partial => 'attachments/form', :locals => {:container => @news} %>

diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index adb2ce283..fdf12c06d 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -3,6 +3,59 @@ label_tips = l(:label_course_news) %> + + <%= label_tips %> @@ -16,7 +69,8 @@ <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %> - <%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> | + <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> + <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :class => 'whiteButton m3p10' %>| <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> | <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %> diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index eb4b5e8b7..c6661d9fe 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -1,3 +1,56 @@ + +
<%= watcher_link(@news, User.current) %> <%= link_to(l(:button_edit), @@ -15,7 +68,8 @@ <%= labelled_form_for :news, @news, :url => news_path(@news), :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %> - <%= submit_tag l(:button_save) %> + <%#= submit_tag l(:button_save) %> + <%= link_to l(:button_save), "#", :onclick => 'submitNews();' %> <%= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => ''} %> | <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;' %> <% end %>