| |||||||||||
PyWeek - Hey Richard...It seems that there is a bug or something with the site,several of the diary entries/threads say that the person who started the thread has had the latest post, when this is not alwas the case, am I just seeing things? http://pyweek.org/d/580/ http://pyweek.org/d/578/ http://pyweek.org/d/559/ Among others... These all say that whoever started the entry had the last post, but it is actually someone else who had posted last — RB[0] on 2007/03/28 02:59 of Team Quicksilver Comments: (log in to comment) |
Last Challenge
September 2008 [entries, ratings] Previous March 2008 [entries, ratings] September 2007 [entries, ratings] > April 2007 [entries, ratings] September 2006 [entries, ratings] March 2006 [entries, ratings] (June 2006) August 2005 [entries, ratings] Not logged in Login | ||||||||||
By richard on 2007/03/28 03:38:
I have NO IDEA what's going on there... the code is pretty simple, perhaps someone could identify the mistake here:l = [] for diary in challenge.get_diaryentry_list(limit=40, order_by=['-created']): entry = diary.get_entry() l.append({ 'title': diary.title, 'author': diary.get_user(), 'date': diary.created, 'id': diary.id, 'entry': entry.title, 'reply_count': diary.get_diarycomment_count(), 'entry_name': entry.name, 'commid': None, }) for comment in challenge.get_diarycomment_list(limit=40, order_by=['-created']): diary = comment.get_diary_entry() entry = diary.get_entry() l.append({ 'title': diary.title, 'entry': entry.title, 'entry_name': entry.name, 'author': comment.get_user(), 'date': comment.created, 'reply_count': diary.get_diarycomment_count(), 'id': diary.id, 'commid': comment.id, }) l.sort(key=operator.itemgetter('date')) l.reverse() s = sets.Set() diary = [] for item in l: if not item['id'] in s: diary.append(item) s.add(item['id'])I then iterate over the "diary" list in the template.By korg on 2007/03/28 09:24:
What is the problem? A leeeeeeeeeeettle more info please. :)By korg on 2007/03/28 09:26:
No its ok. im just confused as usual.By meta on 2007/03/28 14:02:
The "comment" list does not hold all comments for all the diary entries. So while you have diary comments for the newer diary entries and get the right author/date of these diary entries you don't have diary comments for the older entries and the original author/date is shown.
A quick and very ugly fix would be to just set the limit of challenge.get_diarycomment_list to something like 200.
A nicer fix would probably involve somehow loading the last comment for every diary entry explicitly instead of relying on it being loaded from the second loop.