diff --git a/app/models/message.rb b/app/models/message.rb index fc561a9..bd4f2c6 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -87,6 +87,10 @@ def from_string(str) end end + def list + @list ||= List.find_by_id(list_id) + end + def count_recursively(count = 0) count + 1 + (children&.sum(&:count_recursively) || 0) end diff --git a/bin/import_mails b/bin/import_mails index a5e2a2f..1678060 100755 --- a/bin/import_mails +++ b/bin/import_mails @@ -34,7 +34,7 @@ Message.transaction do STDERR.puts("#{list}:#{seq} already exists in Postgres") rescue StandardError => e errors << [seq, e] - STDERR.puts("failed to import #{list}:#{seq}: #{e}") + STDERR.puts("failed to import #{list.name}:#{seq}: #{e}") end end end