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] 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 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 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