OSDN Git Service

* Model::Feeds::Items: fix select() by feed_id
authorhylom <hylom@users.sourceforge.jp>
Thu, 3 Aug 2017 11:34:17 +0000 (20:34 +0900)
committerhylom <hylom@users.sourceforge.jp>
Thu, 3 Aug 2017 11:34:17 +0000 (20:34 +0900)
src/newslash_web/lib/Newslash/Model/Feeds/Items.pm
src/newslash_web/t/models/feeds.t

index cbcaed7..05d3c9e 100644 (file)
@@ -8,10 +8,11 @@ sub select {
     my $params = {@_};
 
     my $unique_keys = { id => "ns_feed_items.id",
-                        feed_id => "ns_feed_items.feed_id",
                         url => "ns_feed_items.url",
                       };
-    my $keys = { create_time => "ns_feed_items.create_time" };
+    my $keys = { create_time => "ns_feed_items.create_time",
+                 feed_id => "ns_feed_items.feed_id",
+               };
     my $timestamp = "ns_feed_items.create_time";
 
     my ($where_clause, $where_values, $unique) = $self->build_where_clause(unique_keys => $unique_keys,
index 945e837..af01da3 100644 (file)
@@ -72,6 +72,10 @@ EOT
     is($item->{content_type} => $test_content_type, "check content");
     is($item->{modified} => DateTime::Format::MySQL->format_datetime($test_modified), "check content");
 
+    $rs = $feeds->items->select(feed_id => $feed->{feed_id});
+    ok($rs, "select by feed_id");
+    ok(@$rs, "retrive items");
+
     my $test_title2 = "ほげほげ";
     ok($feeds->items->update(id => $item_id,
                              title => $test_title2),