Showing correct scores for unread stories.

This commit is contained in:
Samuel Clay 2011-07-24 20:07:38 -07:00
parent 521c050b75
commit 9a36f84543
4 changed files with 17 additions and 19 deletions

View file

@ -284,7 +284,6 @@ def load_single_feed(request, feed_id):
dupe_feed_id = None
userstories_db = None
time.sleep(1)
if page: offset = limit * (page-1)
if not feed_id: raise Http404

View file

@ -120,10 +120,10 @@
[appDelegate addStories:newStories];
}
NSLog(@"Stories: %d stories, page %d. %d new stories.", existingStoriesCount, self.feedPage, newStoriesCount);
// NSLog(@"Stories: %d stories, page %d. %d new stories.", existingStoriesCount, self.feedPage, newStoriesCount);
if (existingStoriesCount > 0 && newStoriesCount > 0) {
NSLog(@"Loading new stories on top of existing stories.");
// NSLog(@"Loading new stories on top of existing stories.");
NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
for (int i=0; i < newStoriesCount; i++) {
int row = existingStoriesCount+i;
@ -133,10 +133,10 @@
withRowAnimation:UITableViewRowAnimationNone];
[indexPaths release];
} else if (newStoriesCount > 0) {
NSLog(@"Loading first page of new stories.");
// NSLog(@"Loading first page of new stories.");
[self.storyTitlesTable reloadData];
} else if (newStoriesCount == 0) {
NSLog(@"End of feed stories.");
// NSLog(@"End of feed stories.");
self.pageFinished = YES;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:existingStoriesCount
inSection:0];
@ -283,7 +283,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Height for row: %d of %d stories. (Finished: %d)", indexPath.row, appDelegate.storyCount, self.pageFinished);
// NSLog(@"Height for row: %d of %d stories. (Finished: %d)", indexPath.row, appDelegate.storyCount, self.pageFinished);
if (indexPath.row >= appDelegate.storyCount && self.pageFinished) {
return 16;
} else {

View file

@ -172,19 +172,19 @@
+ (int)computeStoryScore:(NSDictionary *)intelligence {
int score = 0;
// int score_max = 0;
// [intelligence objectForKey:@"title"]
// var score_max = Math.max(story.intelligence['title'],
// story.intelligence['author'],
// story.intelligence['tags']);
// var score_min = Math.min(story.intelligence['title'],
// story.intelligence['author'],
// story.intelligence['tags']);
// if (score_max > 0) score = score_max;
// else if (score_min < 0) score = score_min;
//
// if (score == 0) score = story.intelligence['feed'];
int score_max = [MAX([intelligence objectForKey:@"title"],
MAX([intelligence objectForKey:@"author"],
[intelligence objectForKey:@"tags"])) integerValue];
int score_min = [MIN([intelligence objectForKey:@"title"],
MIN([intelligence objectForKey:@"author"],
[intelligence objectForKey:@"tags"])) integerValue];
if (score_max > 0) score = score_max;
else if (score_min < 0) score = score_min;
if (score == 0) score = [[intelligence objectForKey:@"feed"] integerValue];
// NSLog(@"%d/%d -- %d: %@", score_max, score_min, score, intelligence);
return score;
}

View file

@ -319,7 +319,6 @@
[feed objectForKey:@"nt"]];
NSString *positiveCountString = [NSString stringWithFormat:@"<div class=\"NB-count NB-positive\">%@</div>",
[feed objectForKey:@"ps"]];
NSLog(@"%@ %d -", [feed objectForKey:@"ps"], positiveCount);
NSString *htmlString = [NSString stringWithFormat:@"%@ %@ %@ %@",
imgCssString,
!!positiveCount ? positiveCountString : @"",