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

(log in to comment)

Comments

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.
What is the problem? A leeeeeeeeeeettle more info please. :)
No its ok. im just confused as usual.

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.