mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
safety on job
This commit is contained in:
parent
877990bc15
commit
af9b47839e
@ -6,8 +6,9 @@ class CacheSumAttributeWordCountJob < ApplicationJob
|
||||
entity_id = args.shift
|
||||
|
||||
entity = entity_type.constantize.find_by(id: entity_id)
|
||||
sum_attribute_word_count = Attribute.where(entity_type: entity_type, entity_id: entity_id).sum(:word_count_cache)
|
||||
return if entity.nil?
|
||||
|
||||
sum_attribute_word_count = Attribute.where(entity_type: entity_type, entity_id: entity_id).sum(:word_count_cache)
|
||||
update = entity.word_count_updates.find_or_initialize_by(
|
||||
for_date: DateTime.current,
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user