From b97a6935ea0543ed2dcb44538de2ff9754775b7d Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 22 Aug 2019 16:12:38 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E5=9B=9E=E5=A4=8D=E6=97=B6=E9=97=B4=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=B0=8F=E4=BA=8E=E4=B8=BB=E8=B4=B4=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_message.rake | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/tasks/public_message.rake b/lib/tasks/public_message.rake index ace16dbdf..44b28b336 100644 --- a/lib/tasks/public_message.rake +++ b/lib/tasks/public_message.rake @@ -54,19 +54,53 @@ namespace :sync do discusses = Discuss.where(dis_id: shixun_id).where("parent_id is null and created_at >? and created_at parent_time + large_time = random_time(start_time, end_time) + end + large_time + end end end From 5d2b98a27d3b69e3a3e80f37d51ede5f8395bb28 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 22 Aug 2019 16:17:53 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/public_message.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/public_message.rake b/lib/tasks/public_message.rake index 44b28b336..0db04aafc 100644 --- a/lib/tasks/public_message.rake +++ b/lib/tasks/public_message.rake @@ -68,7 +68,9 @@ namespace :sync do replies.each do |reply| reply_time = random_smaller_time(rand_created_on, start_time, end_time) reply_message = Message.create!(board_id: board_id.to_i, author_id: reply.user_id, parent_id: new_message.id, root_id: message_id) - MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content)) + reply_message.update_columns(created_on: reply_time, updated_on: reply_time) + reply_message_detail = MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content)) + reply_message_detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on) end end end From e8fea5cb3ee79beee956c14421ded38f514a79b0 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 22 Aug 2019 16:21:31 +0800 Subject: [PATCH 3/6] admins: modify style --- app/helpers/application_helper.rb | 7 +++++-- .../daily_school_statistics/shared/_list.html.erb | 14 ++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e2a438faf..0f536433d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -438,7 +438,7 @@ module ApplicationHelper content_tag(:span, text, opts) end - def sort_tag(content, opts) + def sort_tag(content = '', **opts) options = {} options[:sort_by] = opts.delete(:name) is_current_sort = params[:sort_by].to_s == options[:sort_by] @@ -450,10 +450,13 @@ module ApplicationHelper when 'asc' then 'fa-sort-amount-asc' else '' end + opts[:style] = "#{opts[:style]} ;position: relative;" content_tag(:span, opts) do link_to path, remote: true do - content += content_tag(:i, '', class: "fa color-light-green ml-1 #{arrow_class}") if is_current_sort + content = content_tag(:span) { yield } if block_given? + + content += content_tag(:i, '', class: "fa color-light-green ml-1 #{arrow_class}", style: 'position: absolute;top:0;') if is_current_sort raw content end end diff --git a/app/views/admins/daily_school_statistics/shared/_list.html.erb b/app/views/admins/daily_school_statistics/shared/_list.html.erb index af23e09f6..611acdd2a 100644 --- a/app/views/admins/daily_school_statistics/shared/_list.html.erb +++ b/app/views/admins/daily_school_statistics/shared/_list.html.erb @@ -1,19 +1,21 @@ - + - - - + + From 97aecd0ea4757e34c47195cc54010cd2eac9e0c5 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 22 Aug 2019 16:25:45 +0800 Subject: [PATCH 4/6] .. --- lib/tasks/public_message.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/public_message.rake b/lib/tasks/public_message.rake index 0db04aafc..9d145df27 100644 --- a/lib/tasks/public_message.rake +++ b/lib/tasks/public_message.rake @@ -67,6 +67,7 @@ namespace :sync do if replies.present? replies.each do |reply| reply_time = random_smaller_time(rand_created_on, start_time, end_time) + puts("666") reply_message = Message.create!(board_id: board_id.to_i, author_id: reply.user_id, parent_id: new_message.id, root_id: message_id) reply_message.update_columns(created_on: reply_time, updated_on: reply_time) reply_message_detail = MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content)) From 7e37da40b49e6662c995057e7c2e74cab02596c1 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 22 Aug 2019 16:27:44 +0800 Subject: [PATCH 5/6] .. --- lib/tasks/public_message.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/public_message.rake b/lib/tasks/public_message.rake index 9d145df27..dddc330cd 100644 --- a/lib/tasks/public_message.rake +++ b/lib/tasks/public_message.rake @@ -66,7 +66,7 @@ namespace :sync do message_detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on) if replies.present? replies.each do |reply| - reply_time = random_smaller_time(rand_created_on, start_time, end_time) + reply_time = smaller_time(rand_created_on, start_time, end_time) puts("666") reply_message = Message.create!(board_id: board_id.to_i, author_id: reply.user_id, parent_id: new_message.id, root_id: message_id) reply_message.update_columns(created_on: reply_time, updated_on: reply_time) @@ -98,7 +98,7 @@ namespace :sync do end # 子评论的时间必须小于父评论 - def random_smaller_time(parent_time, start_time, end_time) + def smaller_time(parent_time, start_time, end_time) large_time = random_time(start_time, end_time) while large_time > parent_time large_time = random_time(start_time, end_time) From c1ccb69a51c12d026c46090b2e12898cf90b1a42 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 22 Aug 2019 16:30:51 +0800 Subject: [PATCH 6/6] .. --- lib/tasks/public_message.rake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tasks/public_message.rake b/lib/tasks/public_message.rake index dddc330cd..437b9c37f 100644 --- a/lib/tasks/public_message.rake +++ b/lib/tasks/public_message.rake @@ -66,8 +66,12 @@ namespace :sync do message_detail.update_columns(created_at: rand_created_on, updated_at: rand_created_on) if replies.present? replies.each do |reply| - reply_time = smaller_time(rand_created_on, start_time, end_time) - puts("666") + puts("reply id si #{reply.id}") + reply_time = random_time(start_time, end_time) + while reply_time > rand_created_on + reply_time = random_time(start_time, end_time) + end + reply_message = Message.create!(board_id: board_id.to_i, author_id: reply.user_id, parent_id: new_message.id, root_id: message_id) reply_message.update_columns(created_on: reply_time, updated_on: reply_time) reply_message_detail = MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content))
单位名称单位名称 <%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('课堂总数', name: 'course_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('实训总数', name: 'shixun_count', path: admins_daily_school_statistics_path) %> - <%= sort_tag('实训评测总数', name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) %> - + + <%= sort_tag(name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) do %> + 实训评测总数 + + <% end %> <%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %><%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %><%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %><%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %>