fix error

This commit is contained in:
chiu 2021-09-06 13:53:11 +08:00
parent faedbd4a11
commit d2b9b86d35
1 changed files with 3 additions and 2 deletions

View File

@ -116,9 +116,10 @@ if bundle_update_flag
update_flag = false
last_index = widget_info[-1]["filename"].match(/\d+/)[0].to_i rescue nil
if !last_index.nil?
idx_regex = /^(\d+[\. \t]*)|[ \t]+$/
default_announcement_widget_info.each do |h|
name_without_index = h["name"]["zh_tw"].sub(/\d+/,'')
widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].include?(name_without_index)} rescue -1)
name_without_index = h["name"]["zh_tw"].gsub(idx_regex,'')
widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].gsub(idx_regex,'') == name_without_index}||-1 rescue -1)
if (widget_info_index == -1 || widget_info_index.nil?)
update_flag = true
copy_h = h.dup