Support numeric inputs for the category

This commit is contained in:
BrokenEagle
2020-03-06 07:27:00 +00:00
parent be0bb42ba9
commit a70433e78f
2 changed files with 12 additions and 1 deletions

View File

@@ -87,7 +87,14 @@ class Tag < ApplicationRecord
end
def value_for(string)
TagCategory.mapping[string.to_s.downcase] || 0
norm_string = string.to_s.downcase
if norm_string =~ /#{TagCategory.category_ids_regex}/
norm_string.to_i
elsif TagCategory.mapping[string.to_s.downcase]
TagCategory.mapping[string.to_s.downcase]
else
0
end
end
end