From ed76941a50bf53205d61d808770a49d0f48f3397 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 5 Jul 2019 14:58:04 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 6ab6d3f6..d60de29c 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -360,7 +360,7 @@ class UsersService g = Gitlab.client g.edit_user(@current_user.gid, :password => params[:new_password]) rescue Exception => e - logger.error "change users password failed! ===> #{e}" + Rails.logger.error "change users password failed! ===> #{e}" end end end From 592161700bdeb0f77940b6c4f43e99860c449cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 15:33:29 +0800 Subject: [PATCH 2/5] =?UTF-8?q?mdwatch=E5=8F=82=E6=95=B0=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/libraries/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index b3ed4721..a813e4b7 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -66,7 +66,7 @@ //你的lib目录的路径,我这边用JSP做测试的 path: "/editormd/lib/", tex: true, - watch:false, + watch:true, toolbarIcons: function () { // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. From d17759496499127a2fefd17a6fff7051a4aa30ff Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 5 Jul 2019 15:35:30 +0800 Subject: [PATCH 3/5] fix --- .../competition_teams_controller.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 14747821..c0bde5e4 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -19,12 +19,16 @@ class CompetitionTeamsController < ApplicationController shixuns = Shixun.where(user_id: @team_user_ids, status: 2).where('shixuns.created_at > ?', Time.parse('2018-06-01')) shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2') - shixuns = shixuns.joins('left join myshixuns on myshixuns.shixun_id = shixuns.id and exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count') @shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator) - @myshixun_count_map = Myshixun.where(shixun_id: @shixuns.map(&:id)) - .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') - .group('shixun_id').count + + shixun_ids = @shixuns.map(&:id) + @myshixun_count_map = get_valid_myshixun_count(shixun_ids) + # forked shixun valid myshixun count + forked_shixun_map = Shixun.where(status: 2, fork_from: shixun_ids).select('id, fork_from') + forked_shixun_map = forked_shixun_map.each_with_object({}) { |sx, obj| obj[sx.id] = sx.fork_from } + forked_myshixun_count_map = get_valid_myshixun_count(forked_shixun_map.keys) + forked_myshixun_count_map.each { |k, v| @myshixun_count_map[forked_shixun_map[k]] += v } # todo:使用新版course_members course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) @@ -323,4 +327,10 @@ class CompetitionTeamsController < ApplicationController true end + + def get_valid_myshixun_count(ids) + Myshixun.where(shixun_id: ids) + .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') + .group('shixun_id').count + end end From bc049be76776b89905d0c980c45d6186a3e16597 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 5 Jul 2019 15:41:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_from_libraries.html.erb | 4 ++-- app/views/attachments/_links.html.erb | 6 ++++-- app/views/libraries/show.html.erb | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/attachments/_from_libraries.html.erb b/app/views/attachments/_from_libraries.html.erb index eb9126a0..fc6aa98b 100644 --- a/app/views/attachments/_from_libraries.html.erb +++ b/app/views/attachments/_from_libraries.html.erb @@ -14,7 +14,7 @@ <% size = judge_Chinese_num attachment.filename %> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly hidden color-grey fl', :size => size, :style => 'border:none; max-width:980px;white-space: nowrap; text-overflow:ellipsis;font-family: Consolas;', :readonly => 'readonly') %> <%= number_to_human_size attachment.filesize %> - <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload fl mt1') unless attachment.id.nil? %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][attachment_id]", attachment.id %> @@ -24,7 +24,7 @@ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'hidden atta_input readonly color-grey fl', :style => 'border:none; max-width:980px;', :readonly => 'readonly') %> - <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload fl mt2') unless attachment.id.nil? %> + <%= link_to(''.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload fl mt1') unless attachment.id.nil? %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <% end %> diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 80456091..1247e9cc 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -7,9 +7,11 @@ <% end%> <% if options[:length] %> - <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> + + <%= link_to_short_attachment attachment,:download => true,:length => options[:length] -%> <% else %> - <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true, :length => 32 -%> + + <%= link_to_short_attachment attachment,:download => true, :length => 32 -%> <% end %> <%if is_float%> diff --git a/app/views/libraries/show.html.erb b/app/views/libraries/show.html.erb index 6889e49d..03ad3f11 100644 --- a/app/views/libraries/show.html.erb +++ b/app/views/libraries/show.html.erb @@ -72,7 +72,7 @@
-
+
<%= render partial: 'attachments/links', locals: { attachments: @library.attachments, options: {} } %>
From d4ff681b9ad0acdce873e6c6174db8f1530845c0 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 5 Jul 2019 15:52:46 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B-?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E7=BC=96=E8=BE=91=E5=99=A8=E7=9A=84=E9=AB=98?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/libraries/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index 2e584ab4..4ce076d2 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -61,7 +61,7 @@ /* ------------------------------- 描述md ------------------------------*/ editormd("libraries_description", { width: "100%", - height: 210, + height: 400, syncScrolling: "single", //你的lib目录的路径,我这边用JSP做测试的 path: "/editormd/lib/",