fixed a bug in story filtering code

git-svn-id: file:///tmp/snv/trunk@11 12951d8a-c33d-4b7c-b961-822215c816e1
master
Abhinav Sarkar 2008-12-04 18:47:15 +00:00
parent 04a1088a4a
commit 4a260ec737
1 changed files with 8 additions and 5 deletions

View File

@ -133,17 +133,20 @@ var DiggSidebar = {
Application.console.log("DiggSidebar.stories.length = " + DiggSidebar.stories.length);
var jp = new JPath(DiggSidebar.stories);
var filtedStories = DiggSidebar.stories;
var filteredStories = jp.$(function(story){
return (story.$("category").json == DiggSidebar.endpoint.category) ;
}).json;
jp = new JPath(filteredStories);
if (DiggSidebar.endpoint.topic)
filtedStories = jp.$(function(story){
return story.$("topic/short_name").json == DiggSidebar.endpoint.topic;
filteredStories = jp.$(function(story){
return (story.$("topic/short_name").json == DiggSidebar.endpoint.topic);
}).json;
if (DiggSidebar.endpoint.container)
filtedStories = jp.$(function(story){
filteredStories = jp.$(function(story){
return story.$("container/short_name").json == DiggSidebar.endpoint.container;
}).json;
filtedStories.forEach(function (story, index) {
filteredStories.forEach(function (story, index) {
if (index < DiggSidebar.shownStoriesCount) {
var now = new Date();
if (story.promote_date != null)