From e5e9942cd6f99fc0759c880b28fd1c4aeadd1981 Mon Sep 17 00:00:00 2001 From: hylom Date: Wed, 29 Mar 2017 01:00:14 +0900 Subject: [PATCH] Model::Stories: fix some warnings and add alias story->{discussiond_id} --- src/newslash_web/lib/Newslash/Model/Stories.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/newslash_web/lib/Newslash/Model/Stories.pm b/src/newslash_web/lib/Newslash/Model/Stories.pm index ca30bb50..b16cd2af 100644 --- a/src/newslash_web/lib/Newslash/Model/Stories.pm +++ b/src/newslash_web/lib/Newslash/Model/Stories.pm @@ -995,13 +995,15 @@ sub _generalize { #my $max_weight = 0; for my $t (@{$story->{topics}}) { - if ($t->{tid} == $story->{tid}) { + if ($t->{tid} && $t->{tid} == $story->{tid}) { $story->{primary_topic} = $t; } #if ($t->{weight} && $t->{weight} > $max_weight) { # $max_weight = $t->{weight}; #} } + + $story->{discussion_id} = $story->{discussion}; } # delete story from database -- 2.11.0