From 44dadbc1733a83d18b1c9fdba5601f325452f51f Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 25 Apr 2019 08:54:39 +0800 Subject: [PATCH 1/4] fix ruby version not support ** operation --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6bc8f9f6..c02f7e5a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5515,7 +5515,7 @@ challengeProgramNames=(CHALLENGEPROGRAMNAMES)" end 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] From c9ed7351396aa0ecf88ceb931dd99bec1041fe47 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 25 Apr 2019 09:08:15 +0800 Subject: [PATCH 2/4] removeExceptGitDir --- public/react/scripts/build.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index eb5bcbae..cf7c1377 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -43,13 +43,29 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { process.exit(1); } +function removeExceptGitDir(dir) { + fs2.readdir(dir, function(err, list) { + if (err) return done(err); + var pending = list.length; + if (!pending) return done(null, results); + list.forEach(function(file) { + if (file.indexOf('.git') == -1) { + file = path.resolve(dir, file); + fs.remove(file) + } + }); + }); +} + // First, read the current file sizes in build directory. // This lets us display how much they changed later. measureFileSizesBeforeBuild(paths.appBuild) .then(previousFileSizes => { // Remove all content but keep the directory so that // if you're in it, you don't end up in Trash - fs.emptyDirSync(paths.appBuild); + // fs.emptyDirSync(paths.appBuild); + removeExceptGitDir(paths.appBuild) + // Merge with the public folder copyPublicFolder(); // Start the webpack build From f1b1ea0cd300fa335946a3758d85be897e1179fc Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 25 Apr 2019 09:33:14 +0800 Subject: [PATCH 3/4] fix not support &. operation in low ruby version --- app/services/management/school_report_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/management/school_report_service.rb b/app/services/management/school_report_service.rb index f47230ac..9b794b7b 100644 --- a/app/services/management/school_report_service.rb +++ b/app/services/management/school_report_service.rb @@ -14,7 +14,7 @@ class Management::SchoolReportService def call schools = School.select(select_columns_sql) - keyword = params[:keyword]&.to_s&.strip + keyword = params[:keyword].try(:to_s).try(:strip) if keyword.present? schools = schools.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%") end From f37d02bcfb93552a2f238c61ae2dddd0fb2d530d Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 25 Apr 2019 09:45:50 +0800 Subject: [PATCH 4/4] fix low ruby version support bug --- app/libs/custom_sortable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/custom_sortable.rb b/app/libs/custom_sortable.rb index a127c9bd..721cbd1e 100644 --- a/app/libs/custom_sortable.rb +++ b/app/libs/custom_sortable.rb @@ -17,7 +17,7 @@ module CustomSortable relations.send(order_method, "#{sort_by} #{sort_direction}") end - def multiple_custom_sort(relations, **opts) + def multiple_custom_sort(relations, opts) opts.each do |sort_by, sort_direction| relations = custom_sort(relations, sort_by, sort_direction) end