fix silly misthought

This commit is contained in:
Andrew Brown 2019-12-17 20:29:04 -06:00
parent 2e4f2d388e
commit f5ab3c399a
2 changed files with 8 additions and 6 deletions

View File

@ -15,11 +15,12 @@ class CacheMostUsedAttributeCategoriesJob < ApplicationJob
puts "Suggestion count: #{suggestions}"
suggestions.each do |suggestion, weight|
AttributeCategorySuggestion.find_or_create_by!(
suggestion = AttributeCategorySuggestion.find_or_create_by!(
entity_type: entity_type,
suggestion: suggestion,
weight: weight
suggestion: suggestion
)
suggestion.weight = weight
suggestion.save!
end
end
end

View File

@ -21,12 +21,13 @@ class CacheMostUsedAttributeFieldsJob < ApplicationJob
puts "Suggestion count: #{suggestions}"
suggestions.each do |suggestion, weight|
AttributeFieldSuggestion.find_or_create_by!(
suggestion = AttributeFieldSuggestion.find_or_initialize_by(
entity_type: entity_type,
category_label: category_label,
suggestion: suggestion,
weight: weight
suggestion: suggestion
)
suggestion.weight = weight
suggestion.save!
end
end
end