diff options
author | shtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2> | 2014-04-22 15:09:57 +0000 |
---|---|---|
committer | shtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2> | 2014-04-22 15:09:57 +0000 |
commit | 49603d5386bdb31b8d93d53f3a6c26edd882d8c7 (patch) | |
tree | 03173db239c929cd282b57072ac53d4d15c99e1d | |
parent | 0846504be498cbdd6090362c8689db9e0c63b073 (diff) |
Handle missing data in comments
git-svn-id: svn+ssh://scm.narf.ssji.net/svn/shtrom/scripts@1810 1991c358-8f32-0410-a49a-990740bdf4c2
-rwxr-xr-x | Blogsum2WP.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Blogsum2WP.rb b/Blogsum2WP.rb index ec0a912..527a37a 100755 --- a/Blogsum2WP.rb +++ b/Blogsum2WP.rb @@ -145,15 +145,15 @@ Article.all.each do |a| a.comments.each do |cm| print "C #{cm.name} #{cm.email} #{cm.url} #{cm.date} #{cm.comment[0..19]}\n" + cu = WpUser.find_by_user_email(cm.email) c = WpComment.find_by_comment_content(cm.comment) || WpComment.create( - comment_author: cm.name, - comment_author_email: cm.email, - comment_author_url: cm.url, + comment_author: cu ? cu.display_name : cm.name, + comment_author_email: (cu ? cu.user_email: cm.email) || "", + comment_author_url: (cu ? cu.user_url: cm.url) || "", comment_date: cm.date, comment_date_gmt: cm.date, comment_content: cm.comment, ) - cu = WpUser.find_by_user_email(cm.email) if not cu.nil? c.wp_user = cu.id end |